ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Early PoC of CKEditor5 inside a Shadow DOM.

Open niegowski opened this issue 1 year ago • 5 comments

Suggested merge commit message (convention)

Type: Message. Closes TODO.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

niegowski avatar Aug 26 '24 16:08 niegowski

Error on opening shadow.html manual test

Steps

  1. Open http://fake.ckeditor.com:8125/ckeditor5/tests/manual/shadow.html
  2. Check the console

Result

The following error is present

Uncaught (in promise) Error: Orphaned iframed
    at rr (web-client-content-script.js:2:301067)
    at or (web-client-content-script.js:2:301152)
    at web-client-content-script.js:2:398792
    at c (web-client-content-script.js:2:204307)
    at web-client-content-script.js:2:206762
    at f (web-client-content-script.js:2:196974)
    at Generator.<anonymous> (web-client-content-script.js:2:198311)
    at Generator.next (web-client-content-script.js:2:197337)
    at u (web-client-content-script.js:2:203989)
    at a (web-client-content-script.js:2:204192)

charlttsie avatar Oct 15 '24 10:10 charlttsie

As @niegowski pointed out, the issue described above is not related to the editor - it stems from the LastPass extension when the editor is placed inside a Shadow DOM.

charlttsie avatar Oct 15 '24 11:10 charlttsie

What's the right way to set styles for the styles dropdown when the editor is inside the shadow root? I've tried to do it in the based on the example from the comment, so e.g.

#editor-component, .ck.ck-content p.info-box {
	--background-size: 30px;
	--background-color: #e91e63;
	padding: 1.2em 2em;
	border: 1px solid var(--background-color);
	background: linear-gradient(135deg, var(--background-color) 0%, var(--background-color) var(--background-size), transparent var(--background-size)), linear-gradient(135deg, transparent calc(100% - var(--background-size)), var(--background-color) calc(100% - var(--background-size)), var(--background-color));
	border-radius: 10px;
	margin: 1.5em 2em;
	box-shadow: 5px 5px 0 #ffe6ef;
}

yet it doesn't work the way it does for other styles and the style is applied to the whole #editor-component.

charlttsie avatar Oct 16 '24 09:10 charlttsie

@niegowski We've finished testing the PR draft with @marcelmroz and @Acrophost. We checked it on different desktop and mobile browsers and haven't found any issues coming from the editor itself 🎉 However, the styles for the Styles dropdown were not set in the manual test and it wasn't clear to us how to add them, so please take a look at the question I posted above 🙂

charlttsie avatar Oct 16 '24 12:10 charlttsie

@charlttsie setting styles in Shadow DOMs is tricky, as one of their main aspects is not to allow styles leakage in and out. Check the programmatic method to do it: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM#applying_styles_inside_the_shadow_dom

Witoso avatar Oct 16 '24 12:10 Witoso

There has been no activity on this PR for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the contribution, leave a comment or reaction under this PR.

CKEditorBot avatar Oct 16 '25 23:10 CKEditorBot

.

niegowski avatar Oct 17 '25 08:10 niegowski