mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
ae823547b4
commit
3e33811194
3 changed files with 25 additions and 15 deletions
|
|
@ -131,13 +131,6 @@ export const bindLayoutEvent = (options: {
|
|||
blockID,
|
||||
data: !checked
|
||||
}]);
|
||||
options.blockElement.querySelectorAll('.av__cell[data-dtype="block"] .b3-menu__avemoji,.av__cell[data-dtype="relation"] .b3-menu__avemoji').forEach(item => {
|
||||
if (checked) {
|
||||
item.classList.remove("fn__none");
|
||||
} else {
|
||||
item.classList.add("fn__none");
|
||||
}
|
||||
});
|
||||
});
|
||||
const toggleWrapElement = options.menuElement.querySelector('.b3-switch[data-type="toggle-gallery-wrap"]') as HTMLInputElement;
|
||||
toggleWrapElement.addEventListener("change", () => {
|
||||
|
|
@ -155,13 +148,6 @@ export const bindLayoutEvent = (options: {
|
|||
blockID,
|
||||
data: !checked
|
||||
}]);
|
||||
options.blockElement.querySelectorAll(".av__gallery-fields").forEach(item => {
|
||||
if (checked) {
|
||||
item.classList.add("av__gallery-fields--wrap");
|
||||
} else {
|
||||
item.classList.remove("av__gallery-fields--wrap");
|
||||
}
|
||||
});
|
||||
});
|
||||
if (options.data.viewType !== "gallery") {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -506,6 +506,29 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
} else if (operation.action === "setAttrViewWrapField") {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
||||
item.querySelectorAll(".av__gallery-fields").forEach(fieldItem => {
|
||||
if (operation.data) {
|
||||
fieldItem.classList.add("av__gallery-fields--wrap");
|
||||
} else {
|
||||
fieldItem.classList.remove("av__gallery-fields--wrap");
|
||||
}
|
||||
});
|
||||
item.querySelectorAll(".av__cell").forEach(fieldItem => {
|
||||
fieldItem.setAttribute("data-wrap", operation.data.toString());
|
||||
});
|
||||
});
|
||||
} else if (operation.action === "setAttrViewShowIcon") {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
||||
item.querySelectorAll('.av__cell[data-dtype="block"] .b3-menu__avemoji, .av__cell[data-dtype="relation"] .b3-menu__avemoji').forEach(item => {
|
||||
if (operation.data) {
|
||||
item.classList.remove("fn__none");
|
||||
} else {
|
||||
item.classList.add("fn__none");
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// 修改表格名 avID 传入到 id 上了 https://github.com/siyuan-note/siyuan/issues/12724
|
||||
const avID = operation.action === "setAttrViewName" ? operation.id : operation.avID;
|
||||
|
|
|
|||
|
|
@ -862,7 +862,8 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
|||
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
|
||||
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup", "sortAttrViewKey", "setAttrViewColDesc",
|
||||
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID",
|
||||
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName"].includes(operation.action)) {
|
||||
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon",
|
||||
"setAttrViewWrapField"].includes(operation.action)) {
|
||||
if (!isUndo) {
|
||||
// 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607
|
||||
refreshAV(protyle, operation);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue