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

Set Editor into Iframe - Format and other functions not working #2633

Closed
DPOLocalAaronO opened this issue May 30, 2019 · 6 comments · May be fixed by #2953
Closed

Set Editor into Iframe - Format and other functions not working #2633

DPOLocalAaronO opened this issue May 30, 2019 · 6 comments · May be fixed by #2953

Comments

@DPOLocalAaronO
Copy link

I'm building a site builder, and I want to use quill as my text editor. The site builder uses an iframe to hold the site being edited. I would like to include the quill script in my main document and initialize it on elements within the iframe. It seems to set up on the element within the iframe fine, but when I attempt to run a function on the Quill instance, i'm getting issues.

I've only tested getSelection() and format()

Neither seem to be functioning properly. getSelection(true) always returns null, and a simple format('bold', true) does nothing.

Steps for Reproduction

Initialize quill on an element within an iframe.

Expected behavior:
Work normally

Actual behavior:
Various functions don't work

Platforms:
Chrome, Windows 10

Version:
1.3.6

@greyepoxy
Copy link

greyepoxy commented Feb 27, 2020

I am seeing this as well, in my case I am trying to write cypress unit tests (the content under test is hosted in a separate iframe from the spec code).

Most of the quill methods actually seem to work just fine its only the methods/events dealing with or requiring focus/selection that seem broken. My guess is that the source code is looking at its window/document object and not the window/document object for the component.

@greyepoxy
Copy link

so I was able to fix the problem (at least the problems I saw) by getting the ownerDocument from the root element here https://github.com/quilljs/quill/blob/develop/core/selection.js#L22, and then updating all of the uses of document in this file with the document I got from the root.ownerDocument

Will try and get a PR open in the next few days (unless someone beats me to it)

@fedekau
Copy link

fedekau commented Nov 17, 2020

Hi 👋 @greyepoxy I am experiencing the exact same issue but I would not like to fork the library, did you find any workaround without changing the source code? I have been trying but seems impossible 😞 and since the PR has not activity I am not sure if you or someone else is working on it

@greyepoxy
Copy link

Hi @fedekau no I did not figure out a workaround... 😞 As far as I can tell the PRs are good to go (well they were back in February, haven't looked recently) but have not seen any of the repository owners take a look at them yet. Back in February, I didn't see much activity in this repository (although looks like there is a little activity now) so ultimately decided to use a different rich text editor. Currently using prosemirror, maybe that will work for your use case as well?

@dvkvarma
Copy link

+1

Still seeing the same issue in the latest release. Any plans to resolve this one ?

@quill-bot
Copy link

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏

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

Successfully merging a pull request may close this issue.

5 participants