mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🚨
This commit is contained in:
parent
81c1d785a7
commit
21f1f48a50
4 changed files with 12 additions and 12 deletions
|
|
@ -56,7 +56,7 @@ export const initToolbarMore = () => {
|
||||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
|
|
|
||||||
|
|
@ -78,14 +78,14 @@ export class Toolbar {
|
||||||
Array.from(range.cloneContents().childNodes).find(item => {
|
Array.from(range.cloneContents().childNodes).find(item => {
|
||||||
if (item.nodeType !== 1) {
|
if (item.nodeType !== 1) {
|
||||||
if (item.textContent.length > 0) {
|
if (item.textContent.length > 0) {
|
||||||
noText = false
|
noText = false;
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!(item as HTMLElement).classList.contains("img")) {
|
} else if (!(item as HTMLElement).classList.contains("img")) {
|
||||||
hasImg = false
|
hasImg = false;
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (hasImg && noText) {
|
if (hasImg && noText) {
|
||||||
this.element.classList.add("fn__none");
|
this.element.classList.add("fn__none");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -40,31 +40,31 @@ export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range)
|
||||||
range.setStart(firstChild, 0);
|
range.setStart(firstChild, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
firstChild = firstChild.nextSibling
|
firstChild = firstChild.nextSibling;
|
||||||
} else {
|
} else {
|
||||||
if ((firstChild as HTMLElement).classList.contains("render-node") ||
|
if ((firstChild as HTMLElement).classList.contains("render-node") ||
|
||||||
(firstChild as HTMLElement).classList.contains("img")) {
|
(firstChild as HTMLElement).classList.contains("img")) {
|
||||||
range.setStartBefore(firstChild);
|
range.setStartBefore(firstChild);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
firstChild = firstChild.firstChild
|
firstChild = firstChild.firstChild;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let lastChild = editElement.lastChild
|
let lastChild = editElement.lastChild;
|
||||||
while (lastChild) {
|
while (lastChild) {
|
||||||
if (lastChild.nodeType === 3) {
|
if (lastChild.nodeType === 3) {
|
||||||
if (lastChild.textContent !== "") {
|
if (lastChild.textContent !== "") {
|
||||||
range.setEnd(lastChild, lastChild.textContent.length);
|
range.setEnd(lastChild, lastChild.textContent.length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lastChild = lastChild.previousSibling
|
lastChild = lastChild.previousSibling;
|
||||||
} else {
|
} else {
|
||||||
if ((lastChild as HTMLElement).classList.contains("render-node") ||
|
if ((lastChild as HTMLElement).classList.contains("render-node") ||
|
||||||
(lastChild as HTMLElement).classList.contains("img")) {
|
(lastChild as HTMLElement).classList.contains("img")) {
|
||||||
range.setEndAfter(lastChild);
|
range.setEndAfter(lastChild);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lastChild = lastChild.lastChild
|
lastChild = lastChild.lastChild;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protyle.toolbar.render(protyle, range);
|
protyle.toolbar.render(protyle, range);
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ export const globalShortcut = () => {
|
||||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue