test that makes regexp replacement fail in footnote (non-leaf atom) #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
(This is not really a PR, at least not in this form, but it seemed the best way to show you my code)
I made a test that shows a failure of replaceCurrent in a footnote (non-leaf inline atom node).
I made also a counter-test that shows that the same search does not fail in a normal paragraph node.
I observed it first in my code, where I'm using an adapted version of prosemirror-search, because I use prosemirror through tiptap, and there's no prosemirror-search in tiptap yet.
So I had to understand whether it was my code's fault.
BTW, I had to make a builder for the footnote node, because prosemirror-test-builder is based on schema-basic.
If you plan to include it in prosemirror-test-builder, I can contribute a code stub as a PR, leaving the refinements to you.
Thanks for the test case! Attached patch should help.
Thank you @marijnh.
Unfortunately my use case is nastier, because my footnotes don't contain text, but blocks (in Pandoc's internal model, a
NotecontainsBlocks). So the footnote spec should be:I'm playing a bit with the code to see if I can make it work.
I saw your patch goes up one level of depth if the
$from.nodeis an inline.In my case I have a paragraph, that contains a footnote (inline atom with content), that contains a block (say a paragraph), that contains inlines, where the text to be replaced lives.
The case you patched is:
My nastier case is:
Looks like I found a solution. PR is arriving...