Stacks-Editor
Stacks-Editor copied to clipboard
fix(commonmark) nested sub tags getting lost when round-tripping
Closes #32
Thus far:
- Added failing test
- Fixed issue with
sanitizeInlineHtmlTokens
to ensure that it doesnt consider a second open tag to be the closing tag for the first matching open tag
@b-kelly from what I was able to determine, this is still failing however, since when it is converted into the prosemirror doc
, it becomes a node
with the text as the content and sub
as the attribute. And seems that it just cant figure out two open tags of the same type.
Looking for advice on where to go from here - assume that I need to add to the prosemirror the ability to recognize this. Does this mean a schema change, to allow a sub to have a child sub? Need to get it recognized both into PM and out of it back to markdown. If there is prior PRs that do this sort of thing that I can study, would appreciate it. Can talk about this in our scheduled time tomorrow.
Deploy Preview for nifty-lalande-39c157 ready!
Name | Link |
---|---|
Latest commit | 5a82d708bc00d0643c801beb8585808279f84e04 |
Latest deploy log | https://app.netlify.com/sites/nifty-lalande-39c157/deploys/62cdb87b99387100081f3cd4 |
Deploy Preview | https://deploy-preview-162--nifty-lalande-39c157.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
@b-kelly can you take a look at what I put up? I was going to submit an issue on the prosemirror-markdown project upstream from this, and then saw this case there where they were talking about the same general thing (one tag nested within the same type of tag), and one user recommended adding a nesting function to handle this. I tried to do the same, copying their code, but it didn't change anything. However, I don't totally get what is going on here, so - can you take a look at it and see: maybe we are really close on this (or maybe not)??
@yellis I've committed a partial fix along with a few other tests I wrote to help me debug the issue. There are really a few problems here:
- opening a mark inside another mark of the same type does not work unless their attributes are different
- fixed - I'm keeping track of the nesting and setting that value (might be a 50% fix though if there are more sibling marks of the same type at the same nesting level)
-
closeMark
is not taking attributes into account when closing a mark- upstream bug - the method is using
MarkType.removeFromSet
instead ofMark.removeFromSet
. The difference being that the former removes all marks of the same type while the latter checks the equality of the Marks before removing them
- upstream bug - the method is using
I'll submit a PR upstream explaining the rationale along with a fix.
@b-kelly sounds good. I'll move this into Beta 3, since the fix is going to be pending upstream fixes.
@b-kelly were you able to submit the upstream PR?
@b-kelly were you able to submit the upstream PR?
Sorry for the delay - this has really gotten away from me. I created an internal Jira ticket (STACKS-121) and tagged you on it so we can assess this during our next backlog grooming session.
I am closing this as there is now an internal Jira ticket to track it.