0

I want to give suggestions to users when user click on a tip-tap editor. the suggestion will be some preloaded text. if the user like that suggestion then he could be saved that suggestion in his database by clicking on enter or the right arrow key button on the keypad. enter image description here

2
  • This is kind of the same as the question you posted yesterday: stackoverflow.com/questions/75732318/… Have you tried to create your own extension of Floating menu?
    – Disco
    Mar 15 at 8:08
  • yes, I have tried that .dots animation is shown now when the user clicks on a text editor. but I don't know how to give suggestions to users .and save that suggestion by clicking on an enter button if a user likes it.@Disco Mar 15 at 9:12

1 Answer 1

0

You could use a Floating Menu as in the example in docs and use insert content.

{
  editor && (
    <FloatingMenu editor={editor} tippyOptions={{ duration: 100 }}>
      <button
        onClick={() => editor.chain().focus().insertContent("hello").run()}
      >
        hello
      </button>
      <button
        onClick={() => editor.chain().focus().insertContent("world").run()}
      >
        world
      </button>
    </FloatingMenu>
  );
}
<EditorContent editor={editor} />

Note that you might need to play around with shouldShow prop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.