stable

Clone or download

Read-only

fix: do not add a cross ref mark when the cross ref text is in a link

fixes request #41098 Ignore references when its parent node has a link mark Our detection of cross-references inside editors works a bit too well. When a link in an editor has its text matching the Tuleap reference format, then an async-cross-reference mark will be added to its content when: - The editor is initialized - The cursor is placed after the link and the user presses the [Space] key - The cursor is placed after the link and the user presses the [Enter] key. We should make sure that the target text nodes do not contain a link mark before adding an async-cross-reference-mark. How to test: - In an artidoc, create a new section but let the description empty - Save it - Go to the artifact view of the section - Edit the description from there and add a link whose text is a cross-reference (e.g: `<a href="...">art #123</a>`) - Go back to the artidoc and refresh it - Inspect the section's DOM --> No async-cross-reference has been added to the link content. - On a new line, open the "insert link" menu in the toolbar and create a link with an url and a cross ref as its text - Save - Position the cursor right after the link then press [Space] --> No async-cross-reference has been added to the link content - On a new line, open the "insert link" menu in the toolbar and create a link with an url and a cross ref as its text - Save - Position the cursor right after the link then press [Enter] --> No async-cross-reference has been added to the link content Change-Id: I7ec43dc8e5630e6c14dd4c9074bf5fb36c7a71d2

Modified Files

Name
M lib/frontend/prose-mirror-editor/src/plugins/add-mark-after-enter/README.md +1 −1 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/add-mark-after-enter/add-mark-after-enter.test.ts +53 −20 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/add-mark-after-enter/add-mark-after-enter.ts +10 −2 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/add-mark-after-enter/build-regexp-to-mark-builder-map.ts +16 −9 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/cross-references/detect-cross-reference-as-you-type-input-rule.test.ts +51 −23 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/cross-references/detect-cross-reference-as-you-type-input-rule.ts +19 −11 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/cross-references/first-loading/AllCrossReferencesLoader.test.ts +3 −1 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/cross-references/first-loading/AllCrossReferencesLoader.ts +5 −1 Go to diff View file