Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save comment context #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Save comment context #33

wants to merge 1 commit into from

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.

2 participants