-
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
Cannot load quill in polymer component #904
Comments
Right before you pass |
A working polymer example |
@jhchen it shows null, which is correct so as specified by benbro it needs to be accessed as this.$.editor (due to local dom). But in that case it cannot load the styles due to polymer restriction on External Styles, So it still doesn't work properly inspite of changing #editor to this.$.editor |
@vikrantrathore external styles still works in polymer (but it's deprecated): Not sure how to use "style modules" |
@benbro Its not just a polymer question since quill works on adding dom nodes, its relevant for quill as well. Quill in its current form will not work with webcomponents specification directly implemented in browser, it will only work with polyfilles using webcomponents-lite.js. Also the way its implemented it will make it hard to convert into web components which can directly be used within react, angular or other frameworks. |
@vikrantrathore Can you post code that does not use Polymer that demonstrates Quill not working in Chrome, which has a stable implementation of all web component specs? I will reopen when it is demonstrated this has nothing to do with Polymer. |
The problem here is that the styles defined by Quill assume access to the whole DOM tree. However, the new shadow dom specification (which is used in Polymer) defines that styles do not leak accross the shadow-root boundary. Therefore Quill is incompatible with shadow dom, not Polymer per se. For more information see the recent blog as it is shipped in Chrome 53: http://blog.chromium.org/2016/08/chrome-53-beta-shadow-dom.html. You can read a guide at https://developers.google.com/web/fundamentals/primers/shadowdom/ |
Can you give an example of Quill doing this? |
https://github.com/quilljs/quill/blob/develop/core/quill.js#L363 document.querySelector does not traverse beyond shadow boundaries and therefore can not find elements inside the shadow dom. |
This is a convenience that allows you to do If the discussion here is not that Quill if fundamentally incompatible, but that it is currently inconvenient for early adoption of a draft web spec, early web components adopters are encouraged to contribute. |
@jhchen The source of my original issue was quill not working with web components library. So based on your suggestion opened a ticket with polymer. But indeed the issue is with quilljs itself not following the Web Component standards, as it doesn't work with W3C's web components Shadow Dom specification. Probably you should have kept the ticket open if you are expecting a contribution, otherwise people won't know that quill doesn't work with web components. |
|
So in my view this ticket is unresolved and not just minor inconvenience, still thanks for all the help and responses really appreciate it. |
If I understand the responses in this thread (keep in mind I have zero experience with Quill) it seems you have to replace |
@TimvdLippe Yes and @benbro provided a demonstration but apparently for @vikrantrathore expected more. |
It is obvious that Polymer does not "like" external libraries with separate CSS files. That said, @jhchen quill.js compatibility with frameworks such as Polymer, is not those frameworks' responsibility. The provided example is based on a deprecated feature of Polymer and using a style module does not seem to work out of the box. I will invest a few more hours on this but if it doesn't work I will have to move on to an alternative editor... If I do make it work, then I will definitely share the solution here. |
@voxelperfect How is one supposed to styles at all? It is bad practice to inline styles; it is against many websites' security policies to dynamically create |
@jhchen Web Components are based on a very specific philosophy: each component is independent and all its CSS, HTML and Javascript code is encapsulated in one file. In a few months maybe a little bit more, most modern browsers will support this natively without the need of polyfills such as Polymer. React and Angular follow similar approaches. By the way... the oldest and most popular HTML editor, does have a polymer wrapper provided by a third-party developer... :-) That said, every product is designed for a specific target group; therefore, I totally respect your choices. You cannot satisfy everyone. |
A demo of quill polymer element with scoped styles: I had to add ":host ::content" to workaround a polymer bug when styling dynamic elements. |
@benbro thanks for quill polymer demo!!! 👍 Everything worked fine except when I added When I try to add a link I get this error:
When I click on existing link I get this error:
You can try it here: |
@chuckh I've updated the plunker example.
#editor {
height: 400px;
}
var quill = new Quill(this.$.editor, {
modules: {
toolbar: true
},
bounds: document.body,
theme: 'snow'
}); |
Great job @benbro ! That could become the official "wrapper" for Polymer in Quill website / repo. And then "wrappers" for Angular and React could follow. Web app development has changed a lot the last couple of years. |
@benbro thank you. You inspired me to create I based it on @benbro Plunker at https://plnkr.co/edit/rlysj0CzZl9xq33nAySp?p=preview and @jhchen Codepen at http://codepen.io/quill/pen/RRYBEP. PTAL. |
Someone have the implementation in angular 2? |
Learn more at: https://beta.webcomponents.org/element/chuckh/polymer-quill. |
@chuckh Bold and italic dosent work |
@chuckh Is there a Polymer 2.0 version? running the command
|
We were trying to include polymer in polymer web component, but it throws an error.
Does quill work with web components and polymer library?
Steps for Reproduction
Add the following lines to your polymer component:
Expected behavior: [expected]
An editor in the my-view3 component.
Actual behavior: [actual]
Just the plan text.
Error in the logs is "Invalid Quill container line 10283
Platforms: [ex. Chrome 48 on Mac 10.11]
Chrome, Mac 10.11
Version: [version]
The text was updated successfully, but these errors were encountered: