I am trying to use TipTap component in React for form editing. It receives Jira wikimarkup as an input, then I convert it to ProseMirror node and json:
If the text = "123\n\n" it only keeps "123" inside pmNode . If I encode it back with
const text2 = transformer.encode(pmNode)
text2 will have "123".
It creates problems for controlled component. User presses Enter at the end of the text but nothing happens because as it is typical for the controlled components after external onChange() call, new value "123\n\n" is passed as value parameter of the component but then, during transformation it to json, new lines are deleted, TipTap updates and ignores user’s Enter key press.
Is there a possibility to keep trailing and leading line breaks and in general after
‘{‘ and ‘}’ are simply removed. After that Jira doesn’t render styled text any more.
Before:
*Bold text* and partly{*}Bold{*}
_Italic text_ and partly{_}Italic{_}
+Underlined Text+ and partly{+}Underlined{+}
-Strikethrough text- and partly{-}Strikethrough{-}
+_*Bold Underlined Italic Text*_+ and partly{*}_+Mixed+_{*}
-*_+Bold Underlined Italic Strikethrough Text+_*- and partly{-}+_*Mixed*_+{-}
After:
*Bold text* and partly*Bold*
_Italic text_ and partly_Italic_
+Underlined Text+ and partly+Underlined+
-Strikethrough text- and partly-Strikethrough-
+*_Bold Underlined Italic Text_*+ and partly+*_Mixed_*+
+*-_Bold Underlined Italic Strikethrough Text_-*+ and partly+*-_Mixed_-*+
I expect that wiki text could change but it should not be corrupted after double conversion. Any ideas?
One more case is with subscript and superscript. In jira when I remove spaces before superscript, it has this wiki code: E = mc{^}2{^}. After parse() and encode() by WikiMarkupTransformer I see E = mc^2^ and Jira show it as is instead of superscript.