nhn / tui.editor

πŸžπŸ“ Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.22k stars 1.76k forks source link

Latest version has broken the insert URL link functionality #2687

Closed posel closed 2 years ago

posel commented 2 years ago

Describe the bug

After the update to the @toast-ui/editor@3.2.0 the dialog for URL link insert fails.

When started in the debug mode, The debuger raises an exception getCustomAttrs is not defined at line 19255 (in the transpilled code).

To Reproduce

Steps to reproduce the behavior:

  1. Write a text in the wysiwyg format
  2. Insert URL link filled both URL and text
  3. The link is not visible in the wysiwyg and window for insert doesn't close
  4. The link is inserted - as is visible in the mardown, but complete text is put to the text source code (to the `txt .... block)

Expected behaviour

As before update - simply insert the link

Screenshots

If applicable, add screenshots to help explain your problem.

obrazek

The OK button doesn't close the window.

However, when closed using the Cancel (ZruΕ‘it on the image), link is visible - but only in the markdown: obrazek

Unfortunately, save fails with an exception and change is not saved. Doing again and saving without former switching to the markdown passes, but the text is converted to the string code: obrazek

With the markdown: obrazek

What's worse, the same problem occurs when I am trying to insert the link directly in the markdowns without using the dialog: obrazek

it puts several ~to the code and when debugged it always fails with the error: obrazek

and application hangs up.

Additional context

The used modules are: aymine.com@5.56.7 β”œβ”€β”€ @babel/core@7.18.10 β”œβ”€β”€ @babel/plugin-proposal-class-properties@7.18.6 β”œβ”€β”€ @babel/plugin-proposal-object-rest-spread@7.18.9 β”œβ”€β”€ @babel/preset-env@7.18.10 β”œβ”€β”€ @babel/preset-typescript@7.18.6 β”œβ”€β”€ @rollup/plugin-alias@3.1.9 β”œβ”€β”€ @rollup/plugin-babel@5.3.1 β”œβ”€β”€ @rollup/plugin-commonjs@15.1.0 β”œβ”€β”€ @rollup/plugin-node-resolve@9.0.0 β”œβ”€β”€ @toast-ui/chart@4.4.3 β”œβ”€β”€ @toast-ui/editor@3.2.0 β”œβ”€β”€ check-dependencies@1.1.0 β”œβ”€β”€ composer@4.1.0 β”œβ”€β”€ npm-dts@1.3.12 β”œβ”€β”€ npm@8.18.0 β”œβ”€β”€ rollup-cache@1.2.0 β”œβ”€β”€ rollup-plugin-terser@7.0.2 β”œβ”€β”€ rollup-plugin-typescript2@0.27.3 β”œβ”€β”€ rollup@2.78.1 β”œβ”€β”€ tui-calendar@1.15.3 β”œβ”€β”€ tui-code-snippet@2.3.3 β”œβ”€β”€ tui-color-picker@2.2.8 β”œβ”€β”€ tui-tree@4.0.9 └── typescript@4.7.4

posel commented 2 years ago

Bug is partly duplicate with #2671 but not completely - some of the errors are not new:

williamsun1993 commented 2 years ago

mark.

jethrolarson commented 2 years ago

This is happening to me as well. Seems to not be triggered by adding the link but by attempting to render a link as any existing markdown that is loaded with a link causes the same exception:

[TSfoft Latam](https://google.com)

image

jethrolarson commented 2 years ago

Seems like some kind of bundling error. Like the react-editor isn't handling the dependency on @tui/editor right when building it.

Then again this could be caused by my bundling system as I'm using dynamic import with nextjs to load the editor

jethrolarson commented 2 years ago

Seems to be because build inserted $1 at the end of the variable definition for getCustomAttrs everywhere except in the definition of Link which you can see at line 19255 of node_modules/@toast-ui/editor/dist/esm/index.js at version 3.2.0.

I pulled this project and ran npm run build editor and that generated the file without the $1 suffix so maybe just a rerelease of tui.editor will resolve?

jethrolarson commented 2 years ago

No, wait, I fixed it on accident by removing an unnecessary cast and typescript suppression :D

I'll put up an MR.

spencerpowell commented 2 years ago

@jethrolarson Thank you! Weirdly enough it is working for me locally, but not on my Vercel deployed Next.js app. Hoping your PR fixes the issue though

suny-am commented 2 years ago

Seems to be because build inserted $1 at the end of the variable definition for getCustomAttrs everywhere except in the definition of Link which you can see at line 19255 of node_modules/@toast-ui/editor/dist/esm/index.js at version 3.2.0.

I pulled this project and ran npm run build editor and that generated the file without the $1 suffix so maybe just a rerelease of tui.editor will resolve?

I spotted this as well after having run into the issue via both Hugo's internal ESbuild pipe and Snowpack; glad to see a resolution is in sight!

jwlee1108 commented 2 years ago

check v3.2.1 please, if you use react or vue wrapper, you need to use v3.2.2