This commit is contained in:
Vanessa 2023-10-11 11:25:21 +08:00
parent 0db516e4b9
commit 2eb89f0673
5 changed files with 16 additions and 16 deletions

View file

@ -35,12 +35,12 @@ export const openBacklink = async (options: {
const newWnd = wnd.split("lr"); const newWnd = wnd.split("lr");
if (!options.rootId) { if (!options.rootId) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
options.rootId = response.data.rootID options.rootId = response.data.rootID;
options.useBlockId = response.data.rootID !== response.data.id options.useBlockId = response.data.rootID !== response.data.id;
options.title = response.data.name || "Untitled" options.title = response.data.name || "Untitled";
} else if (!options.title) { } else if (!options.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
options.title = response.data.name || "Untitled" options.title = response.data.name || "Untitled";
} }
newWnd.addTab(new Tab({ newWnd.addTab(new Tab({
icon: "iconLink", icon: "iconLink",
@ -85,12 +85,12 @@ export const openGraph = async (options: {
const newWnd = wnd.split("lr"); const newWnd = wnd.split("lr");
if (!options.rootId) { if (!options.rootId) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
options.rootId = response.data.rootID options.rootId = response.data.rootID;
options.useBlockId = response.data.rootID !== response.data.id options.useBlockId = response.data.rootID !== response.data.id;
options.title = response.data.name || "Untitled" options.title = response.data.name || "Untitled";
} else if (!options.title) { } else if (!options.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
options.title = response.data.name || "Untitled" options.title = response.data.name || "Untitled";
} }
newWnd.addTab(new Tab({ newWnd.addTab(new Tab({
icon: "iconGraph", icon: "iconGraph",
@ -126,12 +126,12 @@ export const openOutline = async (protyle: IProtyle) => {
wnd = getWndByLayout(window.siyuan.layout.centerLayout); wnd = getWndByLayout(window.siyuan.layout.centerLayout);
} }
const newWnd = wnd.split("lr"); const newWnd = wnd.split("lr");
let title = "" let title = "";
if (!protyle.title) { if (!protyle.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID}); const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID});
title = response.data.name || "Untitled" title = response.data.name || "Untitled";
} else { } else {
title = protyle.title.editElement.textContent || "Untitled" title = protyle.title.editElement.textContent || "Untitled";
} }
newWnd.addTab(new Tab({ newWnd.addTab(new Tab({
icon: "iconAlignCenter", icon: "iconAlignCenter",

View file

@ -246,7 +246,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
dialog.element.addEventListener("click", (event) => { dialog.element.addEventListener("click", (event) => {
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
if (typeof event.detail === "string") { if (typeof event.detail === "string") {
target = dialog.element.querySelector('.item--full[data-type="NodeAttributeView"]') target = dialog.element.querySelector('.item--full[data-type="NodeAttributeView"]');
} }
while (!target.isSameNode(dialog.element)) { while (!target.isSameNode(dialog.element)) {
const type = target.dataset.action; const type = target.dataset.action;

View file

@ -1160,7 +1160,7 @@ export class Toolbar {
<div class="b3-list fn__flex-1 b3-list--background" style="position: relative">${html}</div> <div class="b3-list fn__flex-1 b3-list--background" style="position: relative">${html}</div>
</div>`; </div>`;
const listElement = this.subElement.lastElementChild.lastElementChild as HTMLElement const listElement = this.subElement.lastElementChild.lastElementChild as HTMLElement;
const inputElement = this.subElement.querySelector("input"); const inputElement = this.subElement.querySelector("input");
inputElement.addEventListener("keydown", (event: KeyboardEvent) => { inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
event.stopPropagation(); event.stopPropagation();
@ -1463,7 +1463,7 @@ export class Toolbar {
<input style="margin: 0 8px 4px 8px" class="b3-text-field"/> <input style="margin: 0 8px 4px 8px" class="b3-text-field"/>
<div class="b3-list fn__flex-1 b3-list--background" style="position: relative"><img style="margin: 0 auto;display: block;width: 64px;height:64px" src="/stage/loading-pure.svg"></div> <div class="b3-list fn__flex-1 b3-list--background" style="position: relative"><img style="margin: 0 auto;display: block;width: 64px;height:64px" src="/stage/loading-pure.svg"></div>
</div>`; </div>`;
const listElement = this.subElement.lastElementChild.lastElementChild as HTMLElement const listElement = this.subElement.lastElementChild.lastElementChild as HTMLElement;
const inputElement = this.subElement.querySelector("input"); const inputElement = this.subElement.querySelector("input");
inputElement.addEventListener("keydown", (event: KeyboardEvent) => { inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
event.stopPropagation(); event.stopPropagation();

View file

@ -483,7 +483,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
} else if (key === "memo") { } else if (key === "memo") {
memoHTML = `<div class="protyle-attr--memo b3-tooltips b3-tooltips__sw" aria-label="${escapeHTML}"><svg><use xlink:href="#iconM"></use></svg></div>`; memoHTML = `<div class="protyle-attr--memo b3-tooltips b3-tooltips__sw" aria-label="${escapeHTML}"><svg><use xlink:href="#iconM"></use></svg></div>`;
} else if (key === "custom-avs") { } else if (key === "custom-avs") {
memoHTML = `<div class="protyle-attr--av"><svg><use xlink:href="#iconDatabase"></use></svg></div>`; memoHTML = "<div class=\"protyle-attr--av\"><svg><use xlink:href=\"#iconDatabase\"></use></svg></div>";
} }
}); });
let nodeAttrHTML = bookmarkHTML + nameHTML + aliasHTML + memoHTML; let nodeAttrHTML = bookmarkHTML + nameHTML + aliasHTML + memoHTML;

View file

@ -35,7 +35,7 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent, classActi
} }
} }
currentHintElement = listElement.querySelector("." + classActiveName); currentHintElement = listElement.querySelector("." + classActiveName);
const overTop = listElement.scrollTop > currentHintElement.offsetTop - (currentHintElement.previousElementSibling?.clientHeight || 0) const overTop = listElement.scrollTop > currentHintElement.offsetTop - (currentHintElement.previousElementSibling?.clientHeight || 0);
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight || overTop) { if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight || overTop) {
currentHintElement.scrollIntoView(overTop); currentHintElement.scrollIntoView(overTop);
} }