How to edit the text in editor with tooltip input?
viperfx opened this issue · comments
I am trying to create a plugin based on the Link plugin in this repo, that add another input to the tooltip for the text label. I was able to get this working by adding a label to the entity data, and showing this entity label as the text for the entity in the editor.
However, I think the better implementation would be to editor the editortext directly and modify the text.
I was able to find the modifytext and replacetext methods on draftjs, but I struggled with tying it together.
replaceText(
contentState: ContentState,
rangeToReplace: SelectionState,
text: string,
inlineStyle?: DraftInlineStyle,
entityKey?: ?string
): ContentState
How would I get the ContentState for the range matched with the Entity I am modifying?