-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Shadow DOM support - continued #2961
Comments
@yananym all power to you. It's a shame this Shadow DOM supporting implementation wasn't merged before becoming stale: https://github.com/web-padawan/quill |
Any update on this issue? |
Any update on this? I think as a community we must encourage the web component standard and we cannot be a bottle neck. |
I'm glad to see a relatively new issue addressing shadow DOM support. I'd be happy to help in any way. Will integrating the changes from https://github.com/web-padawan/quill into a fresh fork of quill be useful? |
This is actually exactly what one of my engineers had done. He had reported that some Jasmine unit tests are failing and he was not able to resole them, i had not been able to find time to look into it as of yet. @kr05 Kevin would you be able to take a look at tests failures? i would be grateful! |
Of course, I'll see what I can do! |
@yananym it still not work on Safari (my safari version: 13.1). But it's work on Chrome & Firefox, although I see some errors on the console |
I try the https://github.com/yananym/quill, I didn't see setup issue on mac. |
@kr05 I think the error is realtively clear. you'll need to install pkg-config (program that helps C compiler discover libraries to link - it essentially generates -l* falgs to cc). You might also need to install libxml2 and other dependencies. Last time I used windows was 10 years ago so I can't provide more specific help but perhaps you can just I'm also interested seeing some progress here. Shadow dom support is not a deal breaker for me but I would still rather use the shadow dom if I could. Is anyone working on this at the moment? And if not are PRs implementing this accepted? |
@kr05 actually I think you find answers to your questions in this post https://davemateer.com/2020/10/20/running-jekyll-on-wsl2 |
Any updates on this? I am using react-quill in shadow dom and I have strange issues with it. |
@dman777 yes that's what I also experienced just with my hand-coded web-component embedded in elm application. For time being I would recommend you to abandon shadow DOM and just namespace things as best as you can. It seems to me that quill depends on some of the global stuff (event handlers on window and such) to work properly. Luckily these things are not a major problem if you're careful™. The limitation is probably the biggest problem for folks who need to integrate quill to code that itself is used in shadow dom like the micro frontend oriented apps. It seems there is no interest in maintainers on this so the options seems to be either to fork quill or to live with it as is. |
I'm another person who wants to use Quill but needs it inside a web component context. I can get Quill to import and render and it kind of works, but the issue preventing me from using it is that it can get into a state where every keypress sends the cursor back to the start and inserts a newline, so trying to type a word will produce each character on its own line and in reverse order. Clicking inside the text box while it's empty toggles this state somewhat reliably. It only happens when it's inside a web component, but that's my only lead. |
@yujiri8 isn't it possible that you have quill in some vdom based FW (like React) and that every keypress causes react to render Quill again (insert after v dom diff) so the problem is not the quill itself but the fact you initialize it again after every key? I'm 100% certain it's possible to embed quill as web-component (without shadow DOM). I think the problem is somewhere in your approach. |
The FW I'm using is Lit-Element. It only re-renders a component when
an attribute changes, so keypresses should not trigger that.
…On 3/9/21, Marek Fajkus ***@***.***> wrote:
@yujiri8 isn't it possible that you have quill in some vdom based FW (like
React) and that every keypress causes react to render Quill again (insert
after v dom diff) so the problem is not the quill itself but the fact you
initialize it again after every key?
I'm 100% certain it's possible to embed quill as web-component (without
shadow DOM). I think the problem is somewhere in your approach.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#2961 (comment)
|
I would start by checking your data flow to see what causes it but it's definitely not because of a web component. For instance call to |
I'm not calling setContent or any other post-constructor API. This is a minimal element that experiences it:
|
This is the vanila JS (ES2015) custom elment wrapper that works: const toolbarOptions = [
[{ 'header': [1, 2, false] }],
['bold', 'underline', 'italic', 'strike'], // toggled buttons
[{ 'background': [] }, { 'color': [] }], // dropdown with defaults from theme
[{ 'script': 'super' }, { 'script': 'sub'}], // superscript/subscript
[{ 'list': 'bullet' }, { 'list': 'ordered'}],
[{ 'indent': '+1'}, { 'indent': '-1' }], // outdent/indent
['code-block', 'blockquote'],
['clean'] // remove formatting button
];
class MyQuill extends HTMLElement {
constructor() {
// Always call super first in constructor
super();
// Setup container
this.editorContainer = document.createElement('div');
}
connectedCallback() {
this.prepend(this.editorContainer);
const quill = new Quill(this.editorContainer, {
modules: {
toolbar: toolbarOptions
},
theme: 'snow' // or 'bubble'
});
this._quill = quill;
}
}
customElements.define("my-quill", MyQuill); Your example is using shadow dom as it says in code:
as I said:
|
Oh, I missed that part of your reply. But yes I need it inside shadow DOM. And that is the title of this issue, after all. |
In this example, editor is created inside Shadow Root. |
Kind of fixed. |
thank you very mush! |
Wanted to note a couple of interesting details which I saw mentioned elsewhere
|
Happy new year everyone. Anyone else still eagerly awaiting some traction here? Please feel free to provide some comments/thoughts on my branch - robrez#1 |
parse not work. |
I noticed that copy-pasting text is not working with this approach, which can be observed here. Does anyone have a workaround for this? |
We are also using Quill and WebComponents ( Lit Element ) as part of our rich / fully featured text editor. |
In case anyone is still trying to solve this, here's what I have (seems to work ok in Chromium, Gecko, Webkit browsers, including copy/paste, selection, keyboard shortcuts, etc. Note: for Safari it requires > Safari 17 which has the new Selection API All issues seemed to boil down to three problems:
Here's a codepen example: https://codepen.io/John-Hefferman/pen/yLZygKo?editors=1000
|
@jhefferman-sfdc Thank you for this! I went in circles for hours trying to find a fix for this and finally found your comment, and you wrote it only a couple days ago! Great timing. Thanks again. |
I wonder if this solution can't be turned into patch that could get accepted. cc @dlitsman how do you feel about @jhefferman-sfdc's solution? |
If folks are generally OK with this approach, I'd be happy to rework it so it functions in Light DOM too and submit a PR for review? Let me know. |
@jhefferman-sfdc I'm very happy with your code. This fixed our problem too. Thanks a lot! |
Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏 |
Follow up of issues #2021 and #1472 to add support for Shadow DOM.
More and more apps are being built with Micro Front End architecture in mind, which means components including editor experience are delivered through as a web component, which means, Shadow DOM.
Cisco had been leveraging quill in Contact Center cloud enterprise solution, and now is moving to MFE architecture.
I will be opening a simple PR on behalf of Cisco to address it, please let me know if quill team would have bandwidth to review it within the next 3-4 months, it would help greatly!
The text was updated successfully, but these errors were encountered: