skip to Main Content

I’m using tip-tap editor for the purpose of making a messaging feature required in a project I’m working. Everything seems to work in my favor except for the fact that there is no native option that I can find to upload files in it other than images.

Is it even possible to upload files in Tip-Tap editor for react?

2

Answers


  1. tiptap editor doesn’t support files only images, and on fast search there’s no third party extensions to do it ether.

    Login or Signup to reply.
  2. Since tiptap does not have support for files and what you will use it for is messaging, I share with you a solution that I implemented for a chat.

    It consists of adding a button to upload the files in this way:
    Ejemplo del botón

    then the button can be called using the shortcuts offered by the editor

    const EventHandler = Extension.create({
      name: "eventHandler",
    
      addProseMirrorPlugins() {
        return [
          new Plugin({
            key: new PluginKey("eventHandler"),
            props: {
              handleKeyDown: (view, event) => {
                if (event.metaKey || event.ctrlKey) {
                  // Open files
                  if (event.key === "o") {
                    event.preventDefault();
                    let plusMenuFile = document.getElementById("plus-menu-tools-item-file");
                    if (plusMenuFile) {
                      plusMenuFile.click();
                    } else {
                      document.getElementById("MediaFilesText-input-file").click();
                    }
                  }
                  // ...
                }
              }
            }
          })
        ];
      }
    });
    
    const editor = useEditor({
       extensions: [
          StarterKit,
          EventHandler,
          //...
       ]
    });

    Here then I leave the example of how I use it in the tiptap editor: https://codesandbox.io/s/adoring-grothendieck-fu82ju

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search