yabwe / medium-editor

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.
https://yabwe.github.io/medium-editor/
Other
16.04k stars 1.86k forks source link

Problems with MediumEditor inside document-fragment (ShadowDom) #1480

Open zzal opened 5 years ago

zzal commented 5 years ago

Description

When a MediumEditor instance is created inside a document-fragment (ShadowDom), problems are encountered:

  1. Pasting text from keyboard doesn't work at all (Chrome & Safari): the focus is lost before paste occurs (however, the paste from right-click is working ok)
  2. The toolbar can't be positioned.
  3. Placeholder stays visible all the time, even with 'hideOnClick:true' is set.

Steps to reproduce

  1. Place cursor inside the editor, press crtl+v (cmd+v on mac)

The focus is lost before the paste can occur

You can try it on https://jsfiddle.net/zzal/xpvt214o/939654/

kolosovsky commented 5 years ago

Experiencing the same issue.

Possible solution: use .getSelection() of the shadow root during using inside Shadow Dom

arteconceito commented 4 years ago

Also facing the same issues (and many more actually) when used inside an element's Shadow DOM. In such situation the editor becomes pretty much unusable :thinking: Shame 'cause we were considering on using it on an WebApp our team is working on :disappointed:

Do you guys plan on supporting Shadow DOM in a near future?

ksorv commented 4 years ago

@arteconceito Woops!

We're so low on support that you can see even the builds dont pass. You guys can really work on it if you want to use it, I think that'd be a win win situation. But if you completely are relying on us, then, I dont think that it'd be possible for us to make it work soon enough.

😕

arteconceito commented 4 years ago

@sauravkhdoolia thank you for your fast and honest reply. That being said I will see what is possible on my side, being it either in the scope of our company's project or even privatly. Whenever I am able to contribute you will see some PRs being created :wink: In the meanwhile, let me know if I can help out with something else...

ksorv commented 4 years ago

@arteconceito Thanks buddy!

First thing you can help us with is tests.

Currently our build fails due to some unknown reason with the integration of Sauce Labs. We've got Browser Stack backing us for tests, and Sauce Labs too, just to ensure we're not bound by any one option.

I tried but haven't really worked with anything like this. So, couldn't get it to work.

So, If you can help with that, that'd be great cause Due to that CI build fails and we can't really move ahead with anything.

There you go buddy.👍