Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe node example works but with error; I fixed it (?) #11

Open
2 tasks done
sensiblearts opened this issue Sep 5, 2024 · 0 comments
Open
2 tasks done

iframe node example works but with error; I fixed it (?) #11

sensiblearts opened this issue Sep 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@sensiblearts
Copy link

Initial checklist

  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything (or linked relevant results below)

Affected packages and versions

core 7.3.5, kit 7.5.5

Link to runnable example

No response

Steps to reproduce

Copy the code from your iframe example, example-iframe-plugin, into a .svelte file (I don't think it matters that I'm using svelte).

Expected behavior

Renders the iframe properly. No errors.

Actual behavior

Renders the iframe properly. But throws error:

Uncaught RangeError: Content hole not allowed in a leaf node spec
    at _DOMSerializer.serializeNodeInner (chunk-NHPDIOUZ.js?v=41b99bdd:3154:15)
    at chunk-NHPDIOUZ.js?v=41b99bdd:3143:28
    at _Fragment.forEach (chunk-NHPDIOUZ.js?v=41b99bdd:366:7)
    at _DOMSerializer.serializeFragment (chunk-NHPDIOUZ.js?v=41b99bdd:3117:14)
    at Plugin.handlePaste (@milkdown_plugin-clipboard.js?v=41b99bdd:117:43)
    at chunk-DE7QC25T.js?v=41b99bdd:12891:43
    at EditorView.someProp (chunk-DE7QC25T.js?v=41b99bdd:14511:43)
    at doPaste (chunk-DE7QC25T.js?v=41b99bdd:12891:12)
    at editHandlers.paste (chunk-DE7QC25T.js?v=41b99bdd:12913:15)
    at view.dom.addEventListener.view.input.eventHandlers.<computed> (chunk-DE7QC25T.js?v=41b99bdd:12396:9)

...which led me to this
ueberdosis/tiptap#1321

...and this fix
ueberdosis/tiptap@8169eef

So for milkdown I changed this:
toDOM: (node: Node) => ['iframe', {...node.attrs, 'contenteditable': false}], 0],
to this
toDOM: (node: Node) => ['iframe', {...node.attrs, 'contenteditable': false}],

And the error is gone. Fixed?

(I have not had time to dig into why it works, but it works to stop the error.)

(FYI,
in a .svelte file, $ is reserved in the code section, so the imports have to be modified, e.g.,:
import { $node as nnode, $inputRule as iinputRule, $remark as rremark } from '@milkdown/kit/utils';
)

Runtime

Chrome

OS

Windows, Linux

Build and bundle tools

Vite

@sensiblearts sensiblearts added the bug Something isn't working label Sep 5, 2024
@Saul-Mirone Saul-Mirone transferred this issue from Milkdown/milkdown Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants