Compare commits

...

5 commits

4 changed files with 17 additions and 11 deletions

View file

@ -750,7 +750,7 @@ export const newModelByInitData = (app: App, tab: Tab, json: any) => {
rootId: json.rootId, rootId: json.rootId,
blockId: json.blockId, blockId: json.blockId,
mode: json.mode, mode: json.mode,
action: typeof json.action === "string" ? [json.action] : json.action, action: typeof json.action === "string" ? [json.action, Constants.CB_GET_FOCUS] : json.action.concat(Constants.CB_GET_FOCUS),
}); });
} }
return model; return model;

View file

@ -402,6 +402,12 @@ export class MobileFiles extends Model {
} else { } else {
sourceElement.remove(); sourceElement.remove();
} }
} else {
const parentElement = this.element.querySelector(`ul[data-url="${data.fromNotebook}"] li[data-path="${pathPosix().dirname(data.fromPath)}.sy"]`) as HTMLElement;
if (parentElement && parentElement.getAttribute("data-count") === "1") {
parentElement.querySelector(".b3-list-item__toggle").classList.add("fn__hidden");
parentElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");
}
} }
const newElement = this.element.querySelector(`[data-url="${data.toNotebook}"] li[data-path="${data.toPath}"]`) as HTMLElement; const newElement = this.element.querySelector(`[data-url="${data.toNotebook}"] li[data-path="${data.toPath}"]`) as HTMLElement;
// 重新展开移动到的新文件夹 // 重新展开移动到的新文件夹

View file

@ -1741,7 +1741,7 @@ export class WYSIWYG {
} }
const range = getSelection().getRangeAt(0); const range = getSelection().getRangeAt(0);
if (this.element === range.startContainer || this.element.contains(range.startContainer)) { if (this.element === range.startContainer || this.element.contains(range.startContainer)) {
protyle.toolbar.range = range; protyle.toolbar.range = range.cloneRange();
} }
}); });

View file

@ -2271,11 +2271,11 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
switch blockRefMode { switch blockRefMode {
case 2: // 锚文本块链 case 2: // 锚文本块链
blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: "a", TextMarkTextContent: linkText, TextMarkAHref: "siyuan://blocks/" + defID} blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkTextContent: linkText, TextMarkAHref: "siyuan://blocks/" + defID}
blockRefLink.KramdownIAL = n.KramdownIAL blockRefLink.KramdownIAL = n.KramdownIAL
if n.IsTextMarkType("inline-memo") { if "block-ref" != n.TextMarkType { // 除了块引还有其他元素 https://github.com/siyuan-note/siyuan/issues/15698
blockRefLink.TextMarkType = strings.TrimSpace(strings.ReplaceAll(n.TextMarkType, "block-ref", "a"))
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
blockRefLink.TextMarkType = "a inline-memo"
} }
n.InsertBefore(blockRefLink) n.InsertBefore(blockRefLink)
unlinks = append(unlinks, n) unlinks = append(unlinks, n)
@ -2291,11 +2291,11 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
} }
} else { } else {
blockRefLink = &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)} blockRefLink = &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)}
if n.IsTextMarkType("inline-memo") { if "block-ref" != n.TextMarkType {
blockRefLink.Type = ast.NodeTextMark blockRefLink.Type = ast.NodeTextMark
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent blockRefLink.TextMarkType = strings.TrimSpace(strings.ReplaceAll(n.TextMarkType, "block-ref", ""))
blockRefLink.TextMarkType = "inline-memo"
blockRefLink.TextMarkTextContent = linkText blockRefLink.TextMarkTextContent = linkText
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
} }
} }
n.InsertBefore(blockRefLink) n.InsertBefore(blockRefLink)
@ -2315,13 +2315,13 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
} }
text := &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)} text := &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)}
n.InsertBefore(text) if "block-ref" != n.TextMarkType {
if n.IsTextMarkType("inline-memo") {
text.Type = ast.NodeTextMark text.Type = ast.NodeTextMark
text.TextMarkType = "inline-memo" text.TextMarkType = strings.TrimSpace(strings.ReplaceAll(n.TextMarkType, "block-ref", ""))
text.TextMarkTextContent = linkText text.TextMarkTextContent = linkText
text.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent text.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
} }
n.InsertBefore(text)
n.InsertBefore(&ast.Node{Type: ast.NodeFootnotesRef, Tokens: []byte("^" + refFoot.refNum), FootnotesRefId: refFoot.refNum, FootnotesRefLabel: []byte("^" + refFoot.refNum)}) n.InsertBefore(&ast.Node{Type: ast.NodeFootnotesRef, Tokens: []byte("^" + refFoot.refNum), FootnotesRefId: refFoot.refNum, FootnotesRefLabel: []byte("^" + refFoot.refNum)})
unlinks = append(unlinks, n) unlinks = append(unlinks, n)
} }