Comments (24)
Hey, yeah it's doable. Just kinda messy. I'll try to get the next version deployed and live soon, so you can triage
from prosemirror-dev-toolkit.
Hmm I see the hack :) Not easy to get prosemirror view.
from prosemirror-dev-toolkit.
Hey, thanks! I'll look into it
from prosemirror-dev-toolkit.
Unfortunately #48 still fails to detect it.
document.querySelectorAll('iframe')[0].contentDocument.querySelector('.ProseMirror')
returns the body in the screenshot, though.
from prosemirror-dev-toolkit.
Well that's a bummer. Is the site public so I can check it myself? Otherwise, I'll test it again and try to fix it but can't ensure the results
from prosemirror-dev-toolkit.
I'll try to setup a demo
from prosemirror-dev-toolkit.
I don't understand how to debug the code in inject.js
from prosemirror-dev-toolkit.
Inject.js? Well, it's quite complicated. If there's no error shown, the bundle is loaded but still nothing shows the injection has probably flaked. Typing into the editor might help but other than that, it's pretty hard. Can you use the unpacked extension instead?
from prosemirror-dev-toolkit.
Or well not sure how you're making the demo. Simple github.io site with iframe would probably be the best, if possible. No need to add dev-tools by hand, I can test it with the extension
from prosemirror-dev-toolkit.
Yes, that's what i do. I suppose I need to add a debugger; statement somewhere in inject.js ?
from prosemirror-dev-toolkit.
You can add a debugger inside the new Promise to see whether it's actually being called. Do note thought that using inject.js to inject the dev-tools into an iframe wont work since it uses the local document object. You have to edit the querySelector logic a bit to do that.
from prosemirror-dev-toolkit.
getEditorView
receives the body.ProseMirror node, however I suppose the detection is somehow assuming something that isn't there. el.pmViewDesc
is not null, though.
from prosemirror-dev-toolkit.
Hard to say without being able to debug it myself. If the promise is never called and thus the whole function is left pending, even with user input to ProseMirror to flush the DOM, the EditorView instance just contains something unexpected. In some cases where I've had problems with it the schema was somewhat weird or there was some quirky props, like editable: false being passed.
from prosemirror-dev-toolkit.
@kapouer is this still a problem with the latest version?
from prosemirror-dev-toolkit.
The last published version is 1.0.9, and that one is still failing to find body.ProseMirror in an iframe.
from prosemirror-dev-toolkit.
I am trying from source 1.1.5
from prosemirror-dev-toolkit.
Failing too, though it seems there is an issue when building from source.
from prosemirror-dev-toolkit.
Really? It works for TipTap iframes https://tiptap.dev/editor so there definitely is something different in the way you use them. If you can pinpoint the reason I can try out a solution but without that there isn't much I can do for now
from prosemirror-dev-toolkit.
This condition still retries even when document is complete:
from prosemirror-dev-toolkit.
Can you log this error:
} catch (err) {
// Probably "Blocked a frame with origin from accessing a cross-origin frame." error
return []
}
if that's the one that keeps throwing
from prosemirror-dev-toolkit.
Actually it works ! It detects correctly the iframe.
However it fails a bit after with this rejection:
setTimeout(() => {
rej("Unable to trigger childWithSelectNode.pmViewDesc.selectNode");
}, 1e3);
from prosemirror-dev-toolkit.
Oh that one. Well, it's a tricky heuristic to adjust. In most cases increasing the timeout doesn't help. Try increasing it to say 5 or 10 seconds if it helps. It has something to do with the editor being active as I recall cases where the original 1ms kept failing and why I increased it to 1s.
from prosemirror-dev-toolkit.
It actually works, not right away, but several seconds after interacting with the editor.
Considering it to be nice enough :)
from prosemirror-dev-toolkit.
Hey that's good to hear! Yeah wish it worked a little smoother but glad this was resolved
from prosemirror-dev-toolkit.
Related Issues (13)
- Devtools yield "URI Malformed" error when unicode emoji present HOT 1
- inject.js not working, bundle.umd.min.js not found HOT 1
- When using HMR with TipTap, throws error on module reload. HOT 5
- 'svelte-kit' is not recognized as an internal or external command
- 'svelte-kit' is not recognized as an internal or external command HOT 3
- Disabled state not persisted HOT 2
- Issue with injected Svelte styles HOT 1
- please document how to rebuild the extension and how to try from git clone HOT 1
- [ UI Enhance ] Choose a more suitable font for the view HOT 2
- Breaking google docs/sheets HOT 1
- multiple editors HOT 4
- Error thrown if page itself loads prosemirror-dev-toolkit HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prosemirror-dev-toolkit.