Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/11552

Vanessaf1993e13e330
diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts
index ccc6dc7fdb..7ec1bd0d9e 100644
--- a/app/src/protyle/render/av/col.ts
+++ b/app/src/protyle/render/av/col.ts
@@ -34,69 +34,24 @@ export const duplicateCol = (options: {
newColData.id = Lute.NewNodeID();
const newUpdated = dayjs().format("YYYYMMDDHHmmss");
const blockId = options.blockElement.getAttribute("data-node-id");
- if (["select", "mSelect", "rollup"].includes(newColData.type)) {
- fetchPost("/api/av/renderAttributeView", {
- id: options.data.id,
- viewID: options.viewID
- }, (response) => {
- const data = response.data as IAV;
- let colOptions;
- data.view.columns.find((item) => {
- if (item.id === options.colId) {
- colOptions = item.options;
- return true;
- }
- });
- transaction(options.protyle, [{
- action: "addAttrViewCol",
- name: newColData.name,
- avID: options.data.id,
- type: newColData.type,
- data: newColData.icon,
- previousID: options.colId,
- id: newColData.id
- }, {
- action: "updateAttrViewColOptions",
- id: newColData.id,
- avID: options.data.id,
- data: colOptions
- }, {
- action: "doUpdateUpdated",
- id: blockId,
- data: newUpdated,
- }], [{
- action: "removeAttrViewCol",
- id: newColData.id,
- avID: options.data.id,
- }, {
- action: "doUpdateUpdated",
- id: blockId,
- data: options.blockElement.getAttribute("updated")
- }]);
- });
- } else {
- transaction(options.protyle, [{
- action: "addAttrViewCol",
- name: newColData.name,
- avID: options.data.id,
- type: newColData.type,
- data: newColData.icon,
- id: newColData.id,
- previousID: options.colId,
- }, {
- action: "doUpdateUpdated",
- id: blockId,
- data: newUpdated,
- }], [{
- action: "removeAttrViewCol",
- id: newColData.id,
- avID: options.data.id,
- }, {
- action: "doUpdateUpdated",
- id: blockId,
- data: options.blockElement.getAttribute("updated")
- }]);
- }
+ transaction(options.protyle, [{
+ action: "duplicateAttrViewKey",
+ keyID:newColData.id,
+ nextID:options.colId,
+ avID: options.data.id,
+ }, {
+ action: "doUpdateUpdated",
+ id: blockId,
+ data: newUpdated,
+ }], [{
+ action: "removeAttrViewCol",
+ id: newColData.id,
+ avID: options.data.id,
+ }, {
+ action: "doUpdateUpdated",
+ id: blockId,
+ data: options.blockElement.getAttribute("updated")
+ }]);
addAttrViewColAnimation({
blockElement: options.blockElement,
protyle: options.protyle,
diff --git a/app/src/protyle/render/util.ts b/app/src/protyle/render/util.ts
index dee0bac8c3..29fccb951a 100644
--- a/app/src/protyle/render/util.ts
+++ b/app/src/protyle/render/util.ts
@@ -20,4 +20,4 @@ export const processClonePHElement = (item:Element) => {
phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(phElement.getAttribute("data-content")));
}
return item;
-}
+};
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 474c071c26..5529795a93 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -767,7 +767,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "removeAttrViewBlock",
"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColPin", "addAttrViewView", "setAttrViewColIcon",
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
- "updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup", "sortAttrViewKey"].includes(operation.action)) {
+ "updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup", "sortAttrViewKey", "duplicateAttrViewKey"].includes(operation.action)) {
refreshAV(protyle, operation);
return;
}
diff --git a/app/src/search/spread.ts b/app/src/search/spread.ts
index 43481fd8c1..75a0c8cd0b 100644
--- a/app/src/search/spread.ts
+++ b/app/src/search/spread.ts
@@ -54,7 +54,7 @@ export const openSearch = async (options: {
const exitDialog = window.siyuan.dialogs.find((item) => {
// 再次打开
if (item.element.querySelector("#searchList")) {
- const searchElement = item.element.querySelector(".b3-dialog__body")
+ const searchElement = item.element.querySelector(".b3-dialog__body");
const cloneData = JSON.parse(JSON.stringify(item.data)) as Config.IUILayoutTabSearchConfig;
const selectText = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0).toString() : undefined;
if (selectText) {
@@ -71,12 +71,12 @@ export const openSearch = async (options: {
updateConfig(searchElement, cloneData, item.data, item.editors.edit);
} else if (options.hotkey === Constants.DIALOG_SEARCH) {
cloneData.hasReplace = false;
- const toPath = item.editors.edit.protyle.path
+ const toPath = item.editors.edit.protyle.path;
fetchPost("/api/filetree/getHPathsByPaths", {paths: [toPath]}, (response) => {
cloneData.idPath = [pathPosix().join(item.editors.edit.protyle.notebookId, toPath)];
cloneData.hPath = response.data[0];
- item.data.idPath = cloneData.idPath
- item.data.hPath = cloneData.hPath
+ item.data.idPath = cloneData.idPath;
+ item.data.hPath = cloneData.hPath;
updateConfig(searchElement, cloneData, item.data, item.editors.edit);
});
}
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 48fffda606..a580a29415 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -33,6 +33,7 @@ type TOperation =
| "updateAttrViewColOption"
| "setAttrViewName"
| "doUpdateUpdated"
+ | "duplicateAttrViewKey"
| "setAttrViewColIcon"
| "setAttrViewFilters"
| "setAttrViewSorts"