BUG: Illegal Invocation error when using keepEmptyTextNodes
Question
Version: 0.16.44
Are you able to reproduce the bug from the demo?
- Yes
- No
Set editor.Parser.getConfig().keepEmptyTextNodes = true; in the console and then attempt to drag a form into a 2 column plugin.
What is the expected behavior?
Describe the bug detailed
From my observation a keepEmptyTextNodes will throw an error with Sorter.js when a droppable attribute is defined. When it tries to figure out validity it ends up getting the actual text node ahead of the content which means that the matches comparison fails (text node doesn't support matches).
What is the current behavior? Problem area seems to be the below in Sorter.js
const tempModel = comps.add(dropContent, { ...opts, temporary: 1 });
dropModel = comps.remove(tempModel, opts);
dropModel = dropModel instanceof Array ? dropModel[0] : dropModel;
this.dropModel = dropModel;
This is due to the tempModel then having the text nodes that may wrap the content defined in the block. When it is removed to obtain the dropModel we end up with the text node and not the actual content because of the parsing options.
Describe the bug detailed Attempt to drop plugin 2 into plugin 1 and note an illegal invocation error in the console.
https://codepen.io/neilkyoung/pen/abBxqmY
Are you able to attach screenshots, screencasts or a live demo?
- Yes
- No
https://codepen.io/neilkyoung/pen/abBxqmY
https://user-images.githubusercontent.com/3243711/111464171-5762f500-8718-11eb-9765-11d394c2c581.mp4
Answers (3)
Well, yeah makes sense, probably we should take the first "valid" element (the one which actually supports matches).
But I'm also curious to know your case for the use of keepEmptyTextNodes. A few days ago I was actually thinking about removing it 😂
@artf A system we use for web page authoring implements this. Although we have now managed to convince them to disable this thanks to your comment above :-D
Great, I'll close this then. Let me know in case there is something wrong/different with that change on your side
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2974
BUG: Hover editor result in TypeError: this[0].getAttribute is not a function
Version: "0.16.18" Are you able to reproduce the bug from the demo? Yes Describe the bug detailedSet the padding for the body inside the if...
Issue #2982
BUG: Executing editor.load(x) on x = editor.store() results in error.
Version: 0.16.18 Are you able to reproduce the bug from the demo? [X ] Yes [ ] No What is the expected behavior? I would expect that assets...
Issue #3622
BUG: I18n functionality
Version: latest Are you able to reproduce the bug from the demo?[] Yes[ ] No What is the expected behavior? to editor.I18n.setLocale("es")...
Issue #3334
BUG: Attempts to load scripts to canvas maybe breaks javascript??
Version: 0.16.44 Are you able to reproduce the bug from the demo? [ ] Yes [x] No What is the expected behavior? Legit anything else Describ...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.