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

Problem using ngx-quill with ViewEncapsulation.ShadowDom #381

Closed
cmyksvoll opened this issue May 8, 2019 · 2 comments
Closed

Problem using ngx-quill with ViewEncapsulation.ShadowDom #381

cmyksvoll opened this issue May 8, 2019 · 2 comments
Labels

Comments

@cmyksvoll
Copy link

I am trying to use ngx-quill in a custom component (created using Angular Elements). The purpose is to create Angular based plugins to be hosted in another Angular application. To ensure that styles in my Angular Elements component will not affect the hosting application, I have set encapsulation to ViewEncapsulation.ShadowDom in my component (default is ViewEncapsulation.Emulated):

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.scss'],
  encapsulation: ViewEncapsulation.ShadowDom
})

To make this work, I also import the quill css files in my test.component.scss instead of adding them to angular.json:

@import "~quill/dist/quill.core.css";
@import "~quill/dist/quill.bubble.css";
@import "~quill/dist/quill.snow.css";

My problem is that ViewEncapsulation.ShadowDom changes the behavior of the quill editor, especially for numbered lists and bullet lists. It is also not possible to use the tab key to change indent level for list items.

quill

If I change the encapsulation back to ViewEncapsulation.Emulated, the editor works perfectly fine. But... then I risk leaking styles into the application that will host my custom component.

@KillerCodeMonkey
Copy link
Owner

KillerCodeMonkey commented May 8, 2019

If you use the default emulated encapsulation there should be nothing leaking in the host component.
Because each component and styling gets encapsulated by a custom data attribute.

This is a core functionality of angular. ;)

EDIT: If you need to support more than the latest browser versions you need a shadowdom polyfill, as well ;)

@KillerCodeMonkey
Copy link
Owner

@cmyksvoll Seems like quilljs does not support shadow dom in the current stable version:

slab/quill#2021
slab/quill#2337
slab/quill#1805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants