Skip to content

Commit

Permalink
🎨 Protyle Improve the cursor when two images are connected siyuan-not…
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed May 12, 2024
1 parent 6c1f1ce commit ca7d919
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions render/protyle_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ func (r *ProtyleRenderer) renderKramdownBlockIAL(node *ast.Node, entering bool)
}

func (r *ProtyleRenderer) renderKramdownSpanIAL(node *ast.Node, entering bool) ast.WalkStatus {
if !entering {
if nil != node.Previous && ast.NodeImage == node.Previous.Type && nil != node.Next && ast.NodeImage == node.Next.Type {
r.WriteString(editor.Zwsp)
}
}
return ast.WalkContinue
}

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{

{"223", "<div data-node-id=\"20240512120339-0lzlky8\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240512123256\"><div contenteditable=\"true\" spellcheck=\"false\">​<span contenteditable=\"false\" data-type=\"img\" class=\"img\" style=\"width: 178px;\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" style=\"width: 168px;\"><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span><span contenteditable=\"false\" data-type=\"img\" class=\"img\" style=\"width: 157px;\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" style=\"width: 147px;\"><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>1<wbr>​</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240512120339-0lzlky8\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240512123256\"><div contenteditable=\"true\" spellcheck=\"false\">\u200b<span contenteditable=\"false\" data-type=\"img\" class=\"img\" style=\"width: 178px;\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" style=\"width: 168px;\" /><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>\u200b<span contenteditable=\"false\" data-type=\"img\" class=\"img\" style=\"width: 157px;\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" style=\"width: 147px;\" /><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>1<wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"222", "<div data-node-id=\"20240512120339-0lzlky8\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240512120512\"><div contenteditable=\"true\" spellcheck=\"false\">&ZeroWidthSpace;<span contenteditable=\"false\" data-type=\"img\" class=\"img\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\"><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span><span contenteditable=\"false\" data-type=\"img\" class=\"img\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\"><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>&ZeroWidthSpace;</div><div class=\"protyle-attr\" contenteditable=\"false\">&ZeroWidthSpace;</div></div>", "<div data-node-id=\"20240512120339-0lzlky8\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240512120512\"><div contenteditable=\"true\" spellcheck=\"false\">\u200b<span contenteditable=\"false\" data-type=\"img\" class=\"img\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" /><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>\u200b<span contenteditable=\"false\" data-type=\"img\" class=\"img\"><span> </span><span><span class=\"protyle-action protyle-icons\"><span class=\"protyle-icon protyle-icon--only\"><svg class=\"svg\"><use xlink:href=\"#iconMore\"></use></svg></span></span><img src=\"assets/image-20240512120345-t8xr06r.png\" data-src=\"assets/image-20240512120345-t8xr06r.png\" alt=\"image\" /><span class=\"protyle-action__drag\"></span><span class=\"protyle-action__title\"></span></span><span> </span></span>\u200b</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"221", "<div data-node-id=\"20240426212823-zc3bwdg\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240426213148\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"sup\">foo</span>1</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240426212823-zc3bwdg\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240426213148\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"sup\">foo</span>1</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"220", "<div data-node-id=\"20240406201950-ondcs0z\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240406203205\"><div contenteditable=\"true\" spellcheck=\"false\">**<wbr><span data-type=\"strong code\">​foo</span>​ bar**</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240406201950-ondcs0z\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240406203205\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"strong\"><wbr></span><span data-type=\"strong code\">\u200bfoo</span>\u200b<span data-type=\"strong\"> bar</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
Expand Down

0 comments on commit ca7d919

Please sign in to comment.