editor-js / list

Advanced List tool for the Editor.js.
MIT License
48 stars 47 forks source link

Links are stripped out when pasting a list #114

Closed hobailey closed 17 hours ago

hobailey commented 2 days ago

If you copy and paste a list which contains a link, the link is removed/stripped out when pasting: eg:

  1. item one
  2. item two

From our research, this was an issue with the "Nest list" class (which has since been folded into the v2 of the "List" class) so we chose the latter previously to avoid the issue (and compromised on not having nested lists) but now it's unavoidable due to this bug.

You can test with this simple demo (copy and paste the above list) and see it working (with the v1 of the "List" class):

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <div id="editorjs_content" style="border: 1px solid blue"></div>

    <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
    <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@1"></script>

    <script type="text/javascript">
          new EditorJS({
              holder: "editorjs_content",
              tools: {
                  list: {
                    class: List,
                    inlineToolbar: true,
                    config: {
                      defaultStyle: 'unordered'
                    },
                  },
              }
          });
    </script>
  </body>
</html>

And it won't work here (with the v2):

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <div id="editorjs_content" style="border: 1px solid blue"></div>

    <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
    <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@latest"></script>

    <script type="text/javascript">
          new EditorJS({
              holder: "editorjs_content",
              tools: {
                  list: {
                    class: EditorjsList,
                    inlineToolbar: true,
                    config: {
                      defaultStyle: 'unordered'
                    },
                  },
              }
          });
    </script>
  </body>
</html>
e11sy commented 17 hours ago

this issue is resolved since @editorjs/list 2.0.2