Skip to content

Commit

Permalink
🎨 Protyle Improve inline editing siyuan-note/siyuan#12033
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Sep 29, 2024
1 parent 4aefefe commit 3e8e6c2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion protyle.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func (lute *Lute) MergeSameTextMark(n *ast.Node) {
} else {
if ast.NodeText == n.Previous.Type &&
!strings.Contains(n.Previous.TokensStr(), " ") && !strings.Contains(n.Previous.TokensStr(), "\n") &&
"" == strings.TrimSpace(strings.ReplaceAll(n.Previous.TokensStr(), editor.Zwsp, "")) &&
"" == strings.TrimSpace(strings.ReplaceAll(strings.ReplaceAll(n.Previous.TokensStr(), editor.Zwsp, ""), editor.Caret, "")) &&
nil != n.Previous.Previous && n.IsSameTextMarkType(n.Previous.Previous) {
mergeWithZwsp = true
} else {
Expand Down
1 change: 1 addition & 0 deletions test/spin_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var spinBlockDOMTests = []*parseTest{

{"230", "<div data-node-id=\"20240929215806-kilt4j6\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240929215857\"><div contenteditable=\"true\" spellcheck=\"false\">​<span data-type=\"tag\">​Android</span>​<wbr><span data-type=\"tag\">​Linux</span>​</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240929215806-kilt4j6\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240929215857\"><div contenteditable=\"true\" spellcheck=\"false\">\u200b<span data-type=\"tag\">\u200bAndroidLinux</span>\u200b</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"229", "<div data-node-id=\"20240911224355-fpf8ug5\" data-node-index=\"2\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240912103926\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"strong em\">foo</span><span data-type=\"em\">\n\tbar</span></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240911224355-fpf8ug5\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240912103926\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"strong em\">foo</span>\n\t<span data-type=\"em\">bar</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"228", "<div data-node-id=\"20240812173920-h0oe4mx\" data-node-index=\"0\" data-type=\"NodeCodeBlock\" class=\"code-block\" linenumber=\"true\" style=\"line-height: 22px;\" updated=\"20240815112455\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\" aria-label=\"复制\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\" aria-label=\"更多\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs protyle-linenumber\" spellcheck=\"false\" data-render=\"true\" style=\"white-space: pre-wrap; word-break: break-word; font-variant-ligatures: normal;\"><div class=\"protyle-linenumber__rows\"><span style=\"height:22px;\"></span></div><div style=\"flex: 1\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">&ZeroWidthSpace;</div></div>", "<div data-node-id=\"20240812173920-h0oe4mx\" data-node-index=\"1\" data-type=\"NodeCodeBlock\" class=\"code-block\" style=\"line-height: 22px;\" updated=\"20240815112455\" linenumber=\"true\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs\"><div></div><div contenteditable=\"true\" style=\"flex: 1\" spellcheck=\"false\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"227", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeCodeBlock\" class=\"code-block\" updated=\"20060102150405\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs\" spellcheck=\"false\"><div></div><div contenteditable=\"true\" style=\"flex: 1\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>", "<div data-node-id=\"20060102150405-1a2b3c4\" data-node-index=\"1\" data-type=\"NodeCodeBlock\" class=\"code-block\" updated=\"20060102150405\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs\"><div></div><div contenteditable=\"true\" style=\"flex: 1\" spellcheck=\"false\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
Expand Down

0 comments on commit 3e8e6c2

Please sign in to comment.