quill icon indicating copy to clipboard operation
quill copied to clipboard

Shadow DOM support and tests

Open web-padawan opened this issue 7 years ago • 11 comments

Rebased the work from #1805 on top of the 1.3.6 Submitting this PR to check if the tests pass

web-padawan avatar Oct 02 '18 14:10 web-padawan

Tests are failing in Safari because not implemented getSelection() API. Potential fix would be using https://github.com/GoogleChromeLabs/shadow-selection-polyfill

web-padawan avatar Oct 02 '18 14:10 web-padawan

Shadow selection polyfill does not work properly because of this line: https://github.com/quilljs/quill/blob/96e38e92637b75b907579d0cc1b201920aebe38c/core/selection.js#L32

See the listener in the polyfill where setTimeout is also used and the timeout is 0: https://github.com/GoogleChromeLabs/shadow-selection-polyfill/blob/9eff233c765a685bbf488b2f8eba0d3d75f44cbd/shadow.js#L74

web-padawan avatar Oct 04 '18 10:10 web-padawan

What's the progress on this issue? I tried using quill on a polymer project a couple of months ago and unfortunately I was not able to get it to work. :(

Is there anything I can do to help? I really look forward to using quill in my projects!

EDIT: I just noticed #1805, I'll take a look and hopefully take a shot at helping out.

kr05 avatar Mar 02 '19 18:03 kr05

Is this support for Shadow DOM still actively worked on? I see #1805 has also been open for a while.

alisaono avatar May 05 '19 12:05 alisaono

Note, the polyfill for Safari added in this PR mostly works but is not quite stable (as we have observed various issues with Quill which it introduces).

Furthermore, the selection API has to be changed so that there will be getComposedRange() method in future (at least there seems to be a consensus): https://github.com/w3c/selection-api/issues/98

web-padawan avatar May 15 '19 07:05 web-padawan

@web-padawan -- I need to get this working yesterday. And I'd like to spend some time on it.

  • What issues do you see in Safari?
  • What are the state of the tests in here failing?
  • Do you have any sense of the roadmap for getting this PR to work?

Thanks

DeadWisdom avatar Aug 30 '19 04:08 DeadWisdom

@DeadWisdom the problem is described here https://github.com/webcomponents/polyfills/issues/66#issuecomment-427066346

In our project, we ended up using a fork with custom build, source is here: https://github.com/web-padawan/quill/commits/vaadin-quill

That branch is derived from 1.3.6 Quill version, so porting it to master might be untrivial. Also, it contains some tweaks which we only need for our project.

The commits below are especially targeting the issue in Safari, so you should be able to apply these patches on top of 1.3.6 branch yourself, in the following order:

web-padawan/quill@21868969cd00434d02eeedb1fae3f0b2a3af0366

web-padawan/quill@31253d6a7fab84a429490c27315abadfbc256ca9

web-padawan/quill@5331cb2ff58c37490e9d8ffe068266653cc03871

web-padawan/quill@56a960efe59068c17aff25f3ad7f2b55177213c8

web-padawan/quill@95b8374ff45c7200e8d1d2f5e1ca8e5d6c94431d

Note, the polyfill used by our project is not official, neither 100% tested. We consider it "good enough" to make Quill work in Shadow DOM in Safari but some edge cases will occur.

web-padawan avatar Aug 30 '19 06:08 web-padawan

Thank you very much @web-padawan for your work on this. I've been given a small sandbox of time to get this done. So we'll see what I can do.

DeadWisdom avatar Aug 30 '19 08:08 DeadWisdom

@DeadWisdom updates?

frankcliu avatar Jan 30 '20 18:01 frankcliu

Ping? Anything we can do to get this merged?

robrez avatar Oct 07 '20 17:10 robrez

I ended up working on this problem elsewhere, one thing missing from this PR is properly handling the document.activeElement reference in the bubble theme.

gfodor avatar Aug 15 '22 17:08 gfodor

It's almost 2023? any updates on support or a forked latest npm package etc?

evanjmg avatar Dec 06 '22 18:12 evanjmg