stable

Clone or download

Read-only

fix: patch dropcursor above the title

part of story #38627: Choice of a new Rich Text Editor To disable the drop-cursor, prose-mirror checks if a node has the property `disableDropCursor: true`. To retrieve this node, it uses the position via `posAtCords`, which returns the position `pos` and the level `inside`, and `inside` returns -1 when the cursor is above the title. To retrieve the node it takes the node at position `inside`, but as it returns -1 it doesn't retrieve the `artidoc-section` node and can't check the `disableDropCursor` property. The only way to correct this is to patch the `prosemirror-dropcursor` dependency. I have added a condition that checks if a node exists at position `pos` when `inside` returns -1. This way, the node at position 0, which is the `artidoc-section`, is retrieved and the `disableDropCursor` property is checked, so the cursor is disabled. I patched `dist` directly instead of `src` to avoid the need to rebuild. When I patched on `src` and added "/src/dropcursor" to the dependency import I got this error when building the lib : ``` [commonjs--resolver] Missing "./src/dropcursor" specifier in "prosemirror-dropcursor" package at ...  ELIFECYCLE  Command failed with exit code 1. ``` How to test: -- Try to drop something above the title -> It should not display the dropcursor Change-Id: I967258afd74490760716f15d5258edd418d807fa

Modified Files

Name
M lib/frontend/prose-mirror-editor/package.json +5 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/patches/prosemirror-dropcursor@1.8.1.patch +29 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/pnpm-lock.yaml +8 −2 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/description/artidoc-editor-schema.ts +1 −0 Go to diff View file