Skip to content

Conversation

@senadir
Copy link
Collaborator

@senadir senadir commented Jun 20, 2020

This pull adds comment context (selected text for that comment), I haven't yet decided how to show it yet, this is essential for unattached comments, I don't know if there's a more straightforward way of getting the selected text from the editor.

limitations

  • Currently, this only supports text-based comments (comments created from text selection).
  • It saves the original selected text, if you edit that text, the context won't update, this is by design.

Testing

You can console log the addComment action generator or the edit object to see the selected text saved under context, it will be null for other non-text based comments.

@senadir senadir requested a review from youknowriad June 20, 2020 21:34
_selectedText = block.attributes[ attributeKey ].slice(
startOffset,
endOffset
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the attributeKey for the block and the attributeKey for the RichText are not always the same thing, so this will break in some blocks. For instance in a Table block, there's multiple RichTexts but a single attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants