diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts
index f82b8cc92..ef6807104 100644
--- a/app/src/mobile/editor.ts
+++ b/app/src/mobile/editor.ts
@@ -3,7 +3,7 @@ import {setEditor} from "./util/setEmpty";
import {closePanel} from "./util/closePanel";
import {Constants} from "../constants";
import {fetchPost} from "../util/fetch";
-import {disabledProtyle, enableProtyle, onGet} from "../protyle/util/onGet";
+import {disabledProtyle, onGet} from "../protyle/util/onGet";
import {addLoading} from "../protyle/ui/initUI";
import {focusBlock} from "../protyle/util/selection";
import {scrollCenter} from "../util/highlightById";
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 544f7dbb6..628ea707e 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -8,14 +8,12 @@ import {clipboard} from "electron";
import {hasClosestBlock} from "./hasClosest";
import {focusByWbr, getEditorRange} from "./selection";
import {blockRender} from "../markdown/blockRender";
-import * as dayjs from "dayjs";
import {highlightRender} from "../markdown/highlightRender";
import {updateTransaction} from "../wysiwyg/transaction";
import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {isDynamicRef, isFileAnnotation} from "../../util/functions";
import {insertHTML} from "./insertHTML";
import {scrollCenter} from "../../util/highlightById";
-import {getContenteditableElement} from "../wysiwyg/getBlock";
import {hideElements} from "../ui/hideElements";
const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
@@ -169,7 +167,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
});
const code = processPasteCode(textHTML, textPlain);
const range = getEditorRange(protyle.wysiwyg.element);
- const id = nodeElement.getAttribute("data-node-id");
// process code
if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
// 粘贴在代码位置
diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.ts
index 8a0d28ac0..39a058ae1 100644
--- a/app/src/protyle/wysiwyg/list.ts
+++ b/app/src/protyle/wysiwyg/list.ts
@@ -328,17 +328,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
});
if (!window.siyuan.config.editor.listLogicalOutdent && !nextElement.classList.contains("protyle-attr")) {
// 传统缩进
- let newId
+ let newId;
if (lastBlockElement.getAttribute("data-subtype") !== nextElement.getAttribute("data-subtype")) {
- newId = Lute.NewNodeID()
- lastBlockElement = document.createElement("div")
- lastBlockElement.classList.add("list")
- lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"))
- lastBlockElement.setAttribute("data-node-id", newId)
- lastBlockElement.setAttribute("data-type", "NodeList")
- lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
- lastBlockElement.innerHTML = `
${Constants.ZWSP}
`
- previousElement.after(lastBlockElement)
+ newId = Lute.NewNodeID();
+ lastBlockElement = document.createElement("div");
+ lastBlockElement.classList.add("list");
+ lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"));
+ lastBlockElement.setAttribute("data-node-id", newId);
+ lastBlockElement.setAttribute("data-type", "NodeList");
+ lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
+ lastBlockElement.innerHTML = `${Constants.ZWSP}
`;
+ previousElement.after(lastBlockElement);
doOperations.push({
action: "insert",
id: newId,
@@ -357,16 +357,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
undoOperations.push({
action: "move",
id: nextElement.getAttribute("data-node-id"),
- previousID: previousID || nextElement.previousElementSibling.getAttribute("data-node-id"),
+ parentID: lastBlockElement.getAttribute("data-node-id"),
+ previousID: previousID || nextElement.previousElementSibling?.getAttribute("data-node-id"),
});
previousID = nextElement.getAttribute("data-node-id");
- const tempElement = nextElement
- nextElement = nextElement.nextElementSibling
+ const tempElement = nextElement;
+ nextElement = nextElement.nextElementSibling;
lastBlockElement.lastElementChild.before(tempElement);
}
if (lastBlockElement.getAttribute("data-subtype") === "o") {
Array.from(lastBlockElement.children).forEach(orderItem => {
- const id = orderItem.getAttribute("data-node-id")
+ const id = orderItem.getAttribute("data-node-id");
if (id) {
undoOperations.push({
action: "update",
@@ -377,7 +378,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
});
updateListOrder(lastBlockElement, 1);
Array.from(lastBlockElement.children).forEach(orderItem => {
- const id = orderItem.getAttribute("data-node-id")
+ const id = orderItem.getAttribute("data-node-id");
if (id) {
doOperations.push({
action: "update",
@@ -526,17 +527,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
});
if (!window.siyuan.config.editor.listLogicalOutdent && !nextElement.classList.contains("protyle-attr")) {
// 传统缩进
- let newId
+ let newId;
if (!lastBlockElement.classList.contains("list")) {
- newId = Lute.NewNodeID()
- lastBlockElement = document.createElement("div")
- lastBlockElement.classList.add("list")
- lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"))
- lastBlockElement.setAttribute("data-node-id", newId)
- lastBlockElement.setAttribute("data-type", "NodeList")
- lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
- lastBlockElement.innerHTML = `${Constants.ZWSP}
`
- parentLiItemElement.after(lastBlockElement)
+ newId = Lute.NewNodeID();
+ lastBlockElement = document.createElement("div");
+ lastBlockElement.classList.add("list");
+ lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"));
+ lastBlockElement.setAttribute("data-node-id", newId);
+ lastBlockElement.setAttribute("data-type", "NodeList");
+ lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
+ lastBlockElement.innerHTML = `${Constants.ZWSP}
`;
+ parentLiItemElement.after(lastBlockElement);
doOperations.push({
action: "insert",
id: newId,
@@ -546,7 +547,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
}
let previousID;
while (nextElement && !nextElement.classList.contains("protyle-attr")) {
- const nextId = nextElement.getAttribute("data-node-id")
+ const nextId = nextElement.getAttribute("data-node-id");
if (nextElement.getAttribute("data-subtype") !== lastBlockElement.getAttribute("data-subtype")) {
undoOperations.push({
action: "update",
@@ -571,16 +572,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
undoOperations.push({
action: "move",
id: nextId,
- previousID: previousID || nextElement.previousElementSibling.getAttribute("data-node-id"),
+ parentID: lastBlockElement.getAttribute("data-node-id"),
+ previousID: previousID || nextElement.previousElementSibling?.getAttribute("data-node-id"),
});
previousID = nextId;
- const tempElement = nextElement
- nextElement = nextElement.nextElementSibling
+ const tempElement = nextElement;
+ nextElement = nextElement.nextElementSibling;
lastBlockElement.lastElementChild.before(tempElement);
}
if (lastBlockElement.getAttribute("data-subtype") === "o") {
Array.from(lastBlockElement.children).forEach(orderItem => {
- const id = orderItem.getAttribute("data-node-id")
+ const id = orderItem.getAttribute("data-node-id");
if (id) {
undoOperations.push({
action: "update",
@@ -591,7 +593,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
});
updateListOrder(lastBlockElement, 1);
Array.from(lastBlockElement.children).forEach(orderItem => {
- const id = orderItem.getAttribute("data-node-id")
+ const id = orderItem.getAttribute("data-node-id");
if (id) {
doOperations.push({
action: "update",