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

fix bug in removing attachments #170

Merged
merged 8 commits into from
Apr 23, 2024

Conversation

KonnorRogers
Copy link
Owner

@KonnorRogers KonnorRogers commented Apr 23, 2024

@lylo this should fix the issues with figures. I forgot the logic was kind of relying on some undocumented behavior of the editor.

This is the "proper" way to remove a node in ProseMirror / TipTap.

Fixes #168

Copy link

changeset-bot bot commented Apr 23, 2024

🦋 Changeset detected

Latest commit: 0d27bea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
rhino-editor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
rhino-editor ✅ Ready (Inspect) Visit Preview Apr 23, 2024 9:01pm

@KonnorRogers KonnorRogers merged commit bb3f160 into main Apr 23, 2024
7 checks passed
@KonnorRogers KonnorRogers deleted the konnorrogers/fix-bug-in-removing-attachments branch April 23, 2024 21:22
@github-actions github-actions bot mentioned this pull request Apr 23, 2024
@lylo
Copy link

lylo commented Apr 23, 2024

Thanks @KonnorRogers! That's fab. I tried to verify but I couldn't figure out how to link my test project with this branch (yarn link didn't work 🤷‍♀️) so I'll wait until the release and confirm then.

@KonnorRogers
Copy link
Owner Author

@lylo release should be in a couple mins :)

@lylo
Copy link

lylo commented Apr 23, 2024

That does seem to fix the issue, thank you.

I am seeing some other odd behaviour on my app after upgrading though (not on the rhino-test app). I can no longer enter carriage returns. I see this error when hitting return. Nothing has changed in my app other than upgrading to 0.9.3 of Rhino.

application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:68673 Uncaught RangeError: Can not convert <> to a Fragment (looks like multiple versions of prosemirror-model were loaded)
    at _Fragment.from (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:68673:11)
    at _NodeType.create (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:70309:64)
    at split (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:66619:54)
    at Transaction.split (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:67370:5)
    at application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:79629:11
    at Object.splitBlock (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:77454:55)
    at Array.<anonymous> (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:80070:23)
    at application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:78719:18
    at Object.method2 [as first] (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:77384:43)
    at handleEnter (application-f79c2c5d09ed78668c34fbf48d69c19214e9e73b546ebb9757d52ee3da09c9f5.js:80066:52)

I'm also seeing some oddness in the rhino-test app with the placement of images when dragging them into the editor. If I drag to an empty line (so the horizontal line appears before I drop) it seems to work fine, but if I drop at the end of of a line of text, the image appears in the next blank line. I will have to produce a video to demonstrate but that'll have to wait as it's too late right now.

@KonnorRogers
Copy link
Owner Author

looks like multiple versions of prosemirror-model were loaded

Let me see if there's some dependencies to dedupe on my end

@KonnorRogers
Copy link
Owner Author

@lylo I upgraded the underlying prosemirror + tiptap libraries.

You could try either yarn upgrade prosemirror-model or you may have to add a resolutions key to your package.json that looks like this:

{
  "resolutions": {
     "prosemirror-model": "^1.2.0"
  }
}

and make sure to rm -rf node_modules and then re-run yarn install

if that doesn't fix it' I'd be happy to debug further

@lylo
Copy link

lylo commented Apr 24, 2024

@KonnorRogers I ran npm dedupe and this seems to have solved it 👌

$ npm ls prosemirror-model

app@ /Users/olly/dev/teamlight
├─┬ @tiptap/extension-code-block-lowlight@2.2.4
│ └─┬ @tiptap/pm@2.3.0
│   ├─┬ prosemirror-commands@1.5.2
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-gapcursor@1.3.2
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-markdown@1.12.0
│   │ └── prosemirror-model@1.20.0 deduped
│   ├── prosemirror-model@1.20.0
│   ├─┬ prosemirror-schema-basic@1.2.2
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-schema-list@1.3.0
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-state@1.4.3
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-tables@1.3.7
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-trailing-node@2.0.8
│   │ └── prosemirror-model@1.20.0 deduped
│   ├─┬ prosemirror-transform@1.8.0
│   │ └── prosemirror-model@1.20.0 deduped
│   └─┬ prosemirror-view@1.33.5
│     └── prosemirror-model@1.20.0 deduped
└─┬ rhino-editor@0.9.3
  ├─┬ prosemirror-utils@1.2.1-0
  │ └── prosemirror-model@1.20.0 deduped
  └─┬ prosemirror-view@1.28.2
    └── prosemirror-model@1.20.0 deduped

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 this pull request may close these issues.

Unable to delete image without caption
2 participants