diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 1dcb8a734..5f884ab05 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -63,7 +63,7 @@ export const avRender = (element: Element, cb?: () => void) => { } else if (cell.valueType === "date") { text = cell.value?.date.content || ""; } - tableHTML += `
${text}
`; + tableHTML += `
${text}
`; }); tableHTML += "
"; }); diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index f9bd1399c..34d1a7afc 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -753,13 +753,14 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { event.stopPropagation(); return; } - const targetElement = hasClosestByClassName(event.target, "av__row") || hasClosestBlock(event.target); let gutterType = ""; for (const item of event.dataTransfer.items) { if (item.type.startsWith(Constants.SIYUAN_DROP_GUTTER)) { gutterType = item.type; } } + const targetElement = (gutterType.startsWith(`application/siyuan-gutternodeattributeview${Constants.ZWSP}col`) ? hasClosestByClassName(event.target, "av__cell") : hasClosestByClassName(event.target, "av__row")) || + hasClosestBlock(event.target); if (gutterType) { // gutter 或反链面板拖拽 const sourceElements: Element[] = []; @@ -817,7 +818,25 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { }); hideElements(["gutter"], protyle); - const targetClass = targetElement.className.split(" "); + if (targetElement.classList.contains("av__cell")) { + const blockElement = hasClosestBlock(targetElement); + if (!blockElement) { + return; + } + const avId = blockElement.getAttribute("data-av-id") + transaction(protyle, [{ + action: "sortAttrViewCol", + parentID: avId, + previousID: (targetElement.classList.contains("dragover__left") ? targetElement.previousElementSibling?.getAttribute("data-id") : targetElement.getAttribute("data-id")) || "", + id: gutterTypes[2], + }], [{ + action: "sortAttrViewCol", + parentID: avId, + previousID: targetElement.parentElement.querySelector(`[data-id="${gutterTypes[2]}"`).previousElementSibling?.getAttribute("data-id") || "", + id: gutterTypes[2], + }]); + return; + } if (targetElement.classList.contains("av__row")) { // 拖拽到属性视图内 const blockElement = hasClosestBlock(targetElement); @@ -865,6 +884,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { } return; } + const targetClass = targetElement.className.split(" "); targetElement.classList.remove("dragover__bottom", "dragover__top", "dragover__left", "dragover__right", "protyle-wysiwyg--select"); if (targetElement.parentElement.getAttribute("data-type") === "NodeSuperBlock" && targetElement.parentElement.getAttribute("data-sb-layout") === "col") { diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 8d5f16f3d..8e1071ee9 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -651,7 +651,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b updateRef(protyle, operation.id); } else if (operation.action === "append") { reloadProtyle(protyle, false); - } else if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewCell", "sortAttrViewRow"].includes(operation.action)) { + } else if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewCell", "sortAttrViewRow", "sortAttrViewCol"].includes(operation.action)) { refreshAV(protyle, operation); } }; diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 97d4cceb5..7fd692838 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -25,6 +25,7 @@ type TOperation = | "updateAttrViewCell" | "updateAttrViewCol" | "sortAttrViewRow" + | "sortAttrViewCol" type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins" type TCardType = "doc" | "notebook" | "all" type TEventBus = "ws-main" |