【发布时间】:2022-12-02 07:39:07
【问题描述】:
I've got a React site which uses Slate-React (https://docs.slatejs.org/libraries/slate-react) to create a rich text input field. Slate uses the browser's prompt() function to apply hyperlinks to selected text, but I need to be able to style the prompt modal so I have to find an alternative. However, if I create a simple Javascript popup with an input field, the selected text is deselected as soon as the focus is applied to the modal so no link is inserted.
Is there a way to move focus to another element whilst still keeping the original text selected?
Essentially I'm trying to emulate the Insert Hyperlink functionality/styling that Google Docs uses:
【问题讨论】:
标签: javascript reactjs slatejs