Giter VIP home page Giter VIP logo

Comments (24)

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024 1

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.

kapouer avatar kapouer commented on May 30, 2024 1

Hmm I see the hack :) Not easy to get prosemirror view.

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

Hey, thanks! I'll look into it

from prosemirror-dev-toolkit.

kapouer avatar kapouer commented on May 30, 2024

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.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

I'll try to setup a demo

from prosemirror-dev-toolkit.

kapouer avatar kapouer commented on May 30, 2024

I don't understand how to debug the code in inject.js

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

Yes, that's what i do. I suppose I need to add a debugger; statement somewhere in inject.js ?

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

i'm seeing this
Capture d’écran du 2023-02-21 23-33-56

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.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

@kapouer is this still a problem with the latest version?

from prosemirror-dev-toolkit.

kapouer avatar kapouer commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

I am trying from source 1.1.5

from prosemirror-dev-toolkit.

kapouer avatar kapouer commented on May 30, 2024

Failing too, though it seems there is an issue when building from source.

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

This condition still retries even when document is complete:

while (doc?.readyState === 'loading' || tries < 5) {

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

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.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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.

kapouer avatar kapouer commented on May 30, 2024

It actually works, not right away, but several seconds after interacting with the editor.
Considering it to be nice enough :)

from prosemirror-dev-toolkit.

TeemuKoivisto avatar TeemuKoivisto commented on May 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.