mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 19:56:10 +01:00
🚨
This commit is contained in:
parent
bc3ab68a9d
commit
be3ac44ce7
12 changed files with 80 additions and 85 deletions
|
|
@ -22,7 +22,6 @@ import {updatePanelByEditor} from "../editor/util";
|
|||
import {setPanelFocus} from "../layout/util";
|
||||
/// #endif
|
||||
import {Background} from "./header/Background";
|
||||
import {getDisplayName} from "../util/pathName";
|
||||
import {onGet} from "./util/onGet";
|
||||
import {reloadProtyle} from "./util/reload";
|
||||
import {renderBacklink} from "./wysiwyg/renderBacklink";
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
&& targetElement && !protyle.options.backlinkData) {
|
||||
// 文件树拖拽
|
||||
const scrollTop = protyle.contentElement.scrollTop;
|
||||
const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",")
|
||||
const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",");
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
if (ids[i]) {
|
||||
const response = await fetchSyncPost("/api/filetree/doc2Heading", {
|
||||
|
|
|
|||
|
|
@ -184,48 +184,48 @@ export const hasPreviousSibling = (element: Node) => {
|
|||
};
|
||||
|
||||
export const getNextFileLi = (current: Element) => {
|
||||
let nextElement = current.nextElementSibling
|
||||
let nextElement = current.nextElementSibling;
|
||||
if (nextElement) {
|
||||
if (nextElement.tagName === "LI") {
|
||||
return nextElement
|
||||
return nextElement;
|
||||
} else if (nextElement.tagName === "UL") {
|
||||
return nextElement.firstElementChild
|
||||
return nextElement.firstElementChild;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
nextElement = current.parentElement
|
||||
nextElement = current.parentElement;
|
||||
while (nextElement.tagName === "UL") {
|
||||
if (!nextElement.nextElementSibling) {
|
||||
nextElement = nextElement.parentElement
|
||||
nextElement = nextElement.parentElement;
|
||||
} else if (nextElement.nextElementSibling.tagName === "LI") {
|
||||
return nextElement.nextElementSibling
|
||||
return nextElement.nextElementSibling;
|
||||
} else if (nextElement.nextElementSibling.tagName === "UL") {
|
||||
return nextElement.nextElementSibling.firstElementChild;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const getPreviousFileLi = (current: Element) => {
|
||||
let previousElement = current.previousElementSibling
|
||||
let previousElement = current.previousElementSibling;
|
||||
if (previousElement) {
|
||||
if (previousElement.tagName === "LI") {
|
||||
return previousElement
|
||||
return previousElement;
|
||||
} else if (previousElement.tagName === "UL") {
|
||||
return previousElement.lastElementChild
|
||||
return previousElement.lastElementChild;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
previousElement = current.parentElement
|
||||
previousElement = current.parentElement;
|
||||
while (previousElement.tagName === "UL") {
|
||||
if (!previousElement.previousElementSibling) {
|
||||
previousElement = previousElement.parentElement
|
||||
previousElement = previousElement.parentElement;
|
||||
} else if (previousElement.previousElementSibling.tagName === "LI") {
|
||||
return previousElement.previousElementSibling;
|
||||
} else if (previousElement.previousElementSibling.tagName === "UL") {
|
||||
const liElements = previousElement.previousElementSibling.querySelectorAll(".b3-list-item")
|
||||
const liElements = previousElement.previousElementSibling.querySelectorAll(".b3-list-item");
|
||||
return liElements[liElements.length - 1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue