Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Higher versions [prosemirror-] packages with the [transform] dependency will make the pattern of the new line to override the row above it. #427

Open
NagiaME opened this issue Apr 2, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@NagiaME
Copy link

NagiaME commented Apr 2, 2021

To Reproduce
Steps to reproduce the behavior:

  1. Add the editor into a new project.
  2. Or delete the yarn lock file.
  3. Or upgrade the packages.
  4. Then using the '/' to create a new row, the new row's pattern will override the row above the new one. If the patterns are the same of these two row, the old one's pattern will be removed as a normal world line.

Expected behavior
The cause of this exception may is the newer [prosemirror-] packages are using the newer [prosemirror-transform] (upper than 1.2.5). The way I could only find to solve it is to change the lines about the inner dependencies in the yarn.lock file of the project which is using the editor manually, like:

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.2.1:
  version "1.2.12"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.2.12.tgz#4398b568faf75a1540fbf5c659ca436a8657ed6f"
  integrity sha512-S73syqLcGBq6QiPaF7vriB8kpvK/aIFsnErrriKaFLSiE/GxMgBc62TPhNQAeGQr7/9GCDApIReTsJFcMt4o2w==
  dependencies:
    prosemirror-model "^1.0.0"

to

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.2.1:
  version "1.2.5"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.2.5.tgz#7a3e2c61fcdbaf1d0844a2a3bc34fc3524e9809c"
  integrity sha512-eqeIaxWtUfOnpA1ERrXCuSIMzqIJtL9Qrs5uJMCjY5RMSaH5o4pc390SAjn/IDPeIlw6auh0hCCXs3wRvGnQug==
  dependencies:
    prosemirror-model "^1.0.0"

Version
<=11.6.2

Screenshots

image

image

(Don't care about the styles)

@NagiaME NagiaME added the bug Something isn't working label Apr 2, 2021
@tommoor
Copy link
Member

tommoor commented Apr 2, 2021

This has been brought up several times, and is the reason that the package.json explicitly specificies 1.2.5 as the required dependency :(

https://github.com/outline/rich-markdown-editor/blob/main/package.json#L43

@mzalevski
Copy link

Same problem here. I am getting prosemirror-transform: 1.3.2 in a fresh install.

The below changes in the yarn.lock file helped. Thanks @NagiaME !

I've changed this:

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.2.1:
  version "1.3.2"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.3.2.tgz#5620ebe7379e6fae4f34ecc881886cb22ce96579"
  integrity sha512-/G6d/u9Mf6Bv3H1XR8VxhpjmUO75LYmnvj+s3ZfZpakU1hnQbsvCEybml1B3f2IWUAAQRFkbO1PnsbFhLZsYsw==
  dependencies:
    prosemirror-model "^1.0.0"

to this:

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.2.1:
  version "1.2.5"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.2.5.tgz#7a3e2c61fcdbaf1d0844a2a3bc34fc3524e9809c"
  integrity sha512-eqeIaxWtUfOnpA1ERrXCuSIMzqIJtL9Qrs5uJMCjY5RMSaH5o4pc390SAjn/IDPeIlw6auh0hCCXs3wRvGnQug==
  dependencies:
    prosemirror-model "^1.0.0"

@amazingmarvin
Copy link

@mzalevski Since yarn.lock is auto-generated and changes can be easily overwritten, you might want to add to resolutions in your package.json

  ...
  "resolutions": {
    "prosemirror-transform": "1.2.5"
  },

@uptonking
Copy link

uptonking commented Jun 23, 2021

I came into this problem when I delete node_modules and reinstall.
when using npm v7, u can also use the yarn "resolutions": { "prosemirror-transform": "1.2.5" }, with https://github.com/rogeriochaves/npm-force-resolutions.

@tommoor
Copy link
Member

tommoor commented Jun 23, 2021

As mentioned before the package json explicitly specifics 1.2.5 as the required dependency, I don't know why package managers keep ignoring it 🤷

@amazingmarvin
Copy link

@tommoor 1.2.5 gets correctly installed, but some of the other packages are requesting other versions of it. prosemirror-commands, prosemirror-history, prosemirror-inputrules, etc. ask for ^1.0.0, prosemirror-dropcursor asks for ^1.1.0, prosemirror-tables asks for ^1.2.1.

So a fresh project that just does yarn add rich-markdown-editor gets two versions installed:

prosemirror-transform@1.2.5:
  version "1.2.5"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.2.5.tgz#7a3e2c61fcdbaf1d0844a2a3bc34fc3524e9809c"
  integrity sha512-eqeIaxWtUfOnpA1ERrXCuSIMzqIJtL9Qrs5uJMCjY5RMSaH5o4pc390SAjn/IDPeIlw6auh0hCCXs3wRvGnQug==
  dependencies:
    prosemirror-model "^1.0.0"

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.2.1:
  version "1.3.2"
  resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.3.2.tgz#5620ebe7379e6fae4f34ecc881886cb22ce96579"
  integrity sha512-/G6d/u9Mf6Bv3H1XR8VxhpjmUO75LYmnvj+s3ZfZpakU1hnQbsvCEybml1B3f2IWUAAQRFkbO1PnsbFhLZsYsw==
  dependencies:
    prosemirror-model "^1.0.0"

I'm not sure what the best way to handle this is! But for an end-user, using "resolutions" in package.json seems to work. Unfortunately it doesn't work if you install rich-markdown-editor locally from the file system which makes hacking more difficult.

@tommoor
Copy link
Member

tommoor commented Jun 24, 2021

Yea, I still feel like this is a problem in the package manager though - it should optimize for least installed duplicate packages IMO. There's not much that can be done about it though other than what you've described.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants