Steps for Reproduction
Some text in a div.
More text in another div.
Expected behavior:
The text should be visible in the quill editor. Ideally it should be formatted as it was in the original.
Note: this applies to a lot of HTML formatting, but not all of it (e.g. a wrapping in bold-tags works)
Actual behavior:
Most of the time, non of the selected text is pasted into quill (see below for details). This used to work with Quill Editor v0.20.1
Platforms:
Not working at all:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36 OPR/49.0.2725.39
The given range isn't in document.
setNativeRange @ quill.js:3145
(anonymous) @ quill.js:2824
emit @ quill.js:8591
emit @ quill.js:1893
update @ quill.js:4333
(anonymous) @ quill.js:7118
quill.js:4329 Uncaught TypeError: Cannot read property 'emit' of undefined
at Scroll.update (VM61 quill.js:4329)
at MutationObserver.<anonymous> (VM61 quill.js:7118)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.140 Chrome/64.0.3282.140 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
TypeError: this.emitter is undefined
Partially working:
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko (the first line of text is pasted)
Couldn't test in:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299 (jsfiddle refuses to run the test and I don't know why)
Version:
1.3.6 (see jsFiddle)
Edit: Included error-messages of Opera and Firefox
This is because you do not currently have any blot registered that matches text directly inside of a <div> tag. If you change your text to be inside of a <p> tag or modify and existing/create a custom blot that matches the pattern <div>Some text here</div>, then the dragging/dropping of that text works.
Thanks for the explanation, we're thinking about creating a custom blot.
Since text can be dragged from any website, we don't really have control over whether it resides inside a <p> or a <div> (or anything else), but I guess covering <div>s additionally should cover most use cases.
Anyway, if this is the "to be expected" behaviour for text in <div>s, I'm fine with closing this issue.
Something does seem off here though. The default behaviour here should be that pasted content that doesn't match falls back to being plain text (in whatever your BlockBlot is).
You can add this
var Block = Quill.import('blots/block');
class Div extends Block {
}
Div.tagName = "div";
Div.blotName = "div";
Div.allowedChildren = Block.allowedChildren;
Div.allowedChildren.push(Block)
Quill.register(Div);
Sorry for the delayed reply: The blot-approach seems to work, closing this ticket now
@aboosoyeed buddy thank you so much it worked for me
@awais2080 my pleasure
Most helpful comment
You can add this
var Block = Quill.import('blots/block');
class Div extends Block {
}
Div.tagName = "div";
Div.blotName = "div";
Div.allowedChildren = Block.allowedChildren;
Div.allowedChildren.push(Block)
Quill.register(Div);