diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts
index 108062f0b..b6b029d5a 100644
--- a/app/src/layout/dock/Outline.ts
+++ b/app/src/layout/dock/Outline.ts
@@ -272,28 +272,48 @@ export class Outline extends Model {
documentSelf.onselect = null;
ghostElement.remove();
item.style.opacity = "";
+
+ if (selectItem) {
+ getAllModels().editor.find(editItem => {
+ if (editItem.editor.protyle.block.rootID === this.blockId) {
+ let previousID
+ let parentID
+ const undoPreviousID = item.previousElementSibling?.getAttribute("data-node-id")
+ const undoParentID = item.parentElement.previousElementSibling?.getAttribute("data-node-id")
+ if (selectItem.classList.contains("dragover")) {
+ parentID = selectItem.getAttribute("data-node-id");
+ if (selectItem.nextElementSibling && selectItem.nextElementSibling.tagName === "UL") {
+ selectItem.nextElementSibling.insertAdjacentElement("afterbegin", item);
+ } else {
+ selectItem.insertAdjacentHTML("afterend", `
`);
+ item.remove();
+ }
+ } else if (selectItem.classList.contains("dragover__top")) {
+ parentID = selectItem.parentElement.previousElementSibling?.getAttribute("data-node-id");
+ previousID = selectItem.previousElementSibling?.getAttribute("data-node-id");
+ selectItem.before(item);
+ } else if (selectItem.classList.contains("dragover__bottom")) {
+ previousID = selectItem.getAttribute("data-node-id");
+ selectItem.after(item);
+ }
+ transaction(editItem.editor.protyle, [{
+ action: "moveOutlineHeading",
+ id: item.dataset.nodeId,
+ previousID,
+ parentID,
+ }], [{
+ action: "moveOutlineHeading",
+ id: item.dataset.nodeId,
+ previousID: undoPreviousID,
+ parentID: undoParentID,
+ }]);
+ return true;
+ }
+ });
+ }
this.element.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach(item => {
item.classList.remove("dragover__top", "dragover__bottom", "dragover");
});
- if (!selectItem) {
- return;
- }
- getAllModels().editor.find(editItem => {
- if (editItem.editor.protyle.block.rootID === this.blockId) {
- transaction(editItem.editor.protyle, [{
- action: "moveOutlineHeading",
- id: item.dataset.nodeId,
- previousID: selectItem.previousElementSibling?.getAttribute("data-node-id"),
- parentID: selectItem.parentElement.previousElementSibling?.getAttribute("data-node-id"),
- }], [{
- action: "moveOutlineHeading",
- id: item.dataset.nodeId,
- previousID: item.previousElementSibling?.getAttribute("data-node-id"),
- parentID: item.parentElement.previousElementSibling?.getAttribute("data-node-id"),
- }]);
- return true;
- }
- });
};
});
}
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index a875a059b..424d82122 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -728,9 +728,13 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
});
// 更新 ws 引用块
updateRef(protyle, operation.id);
- } else if (operation.action === "append") {
+ return;
+ }
+ if (operation.action === "append") {
reloadProtyle(protyle, false);
- } else if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewColOptions",
+ return;
+ }
+ if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewColOptions",
"updateAttrViewColOption", "updateAttrViewCell", "sortAttrViewRow", "sortAttrViewCol", "setAttrViewColHidden",
"setAttrViewColWrap", "setAttrViewColWidth", "removeAttrViewColOption", "setAttrViewName", "setAttrViewFilters",
"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "removeAttrViewBlock",
@@ -738,10 +742,13 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup"].includes(operation.action)) {
refreshAV(protyle, operation);
- } else if (operation.action === "doUpdateUpdated") {
+ return;
+ }
+ if (operation.action === "doUpdateUpdated") {
updateElements.forEach(item => {
item.setAttribute("updated", operation.data);
});
+ return;
}
};