mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
76d3fa3895
commit
5d50582a0f
5 changed files with 6 additions and 12 deletions
|
|
@ -782,7 +782,6 @@ export const openMenuPanel = (options: {
|
||||||
id,
|
id,
|
||||||
blockID
|
blockID
|
||||||
}]);
|
}]);
|
||||||
options.blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
|
|
||||||
avPanelElement.remove();
|
avPanelElement.remove();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||||
if (operation.action === "setAttrViewColWidth") {
|
if (operation.action === "setAttrViewColWidth") {
|
||||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
||||||
const cellElement = item.querySelector(`.av__cell[data-col-id="${operation.id}"]`) as HTMLElement;
|
const cellElement = item.querySelector(`.av__cell[data-col-id="${operation.id}"]`) as HTMLElement;
|
||||||
if (!cellElement || cellElement.style.width === operation.data || item.getAttribute("custom-sy-av-view") !== operation.keyID) {
|
if (!cellElement || cellElement.style.width === operation.data || item.getAttribute(Constants.CUSTOM_SY_AV_VIEW) !== operation.keyID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
item.querySelectorAll(".av__row").forEach(rowItem => {
|
item.querySelectorAll(".av__row").forEach(rowItem => {
|
||||||
|
|
@ -475,13 +475,10 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||||
});
|
});
|
||||||
addDragFill(item.querySelector(".av__cell--select"));
|
addDragFill(item.querySelector(".av__cell--select"));
|
||||||
}
|
}
|
||||||
if (operation.action === "removeAttrViewView") {
|
if (operation.action === "setAttrViewBlockView") {
|
||||||
item.setAttribute("data-av-type", operation.retData);
|
|
||||||
} else if (operation.action === "setAttrViewBlockView") {
|
|
||||||
const viewTabElement = item.querySelector(`.av__views > .layout-tab-bar > .item[data-id="${operation.id}"]`) as HTMLElement;
|
const viewTabElement = item.querySelector(`.av__views > .layout-tab-bar > .item[data-id="${operation.id}"]`) as HTMLElement;
|
||||||
if (viewTabElement) {
|
if (viewTabElement) {
|
||||||
item.dataset.pageSize = viewTabElement.dataset.page;
|
item.dataset.pageSize = viewTabElement.dataset.page;
|
||||||
item.setAttribute("data-av-type", viewTabElement.dataset.avType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
avRender(item, protyle, () => {
|
avRender(item, protyle, () => {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle
|
||||||
id,
|
id,
|
||||||
blockID: options.blockElement.dataset.nodeId
|
blockID: options.blockElement.dataset.nodeId
|
||||||
}]);
|
}]);
|
||||||
options.blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (options.blockElement.querySelectorAll(".layout-tab-bar .item").length > 1) {
|
if (options.blockElement.querySelectorAll(".layout-tab-bar .item").length > 1) {
|
||||||
|
|
@ -337,8 +336,6 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
|
||||||
id,
|
id,
|
||||||
blockID: blockElement.getAttribute("data-node-id")
|
blockID: blockElement.getAttribute("data-node-id")
|
||||||
}]);
|
}]);
|
||||||
blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
|
|
||||||
blockElement.setAttribute("data-av-type", "table");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addMenu.addItem({
|
addMenu.addItem({
|
||||||
|
|
@ -358,8 +355,6 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
|
||||||
id,
|
id,
|
||||||
blockID: blockElement.getAttribute("data-node-id")
|
blockID: blockElement.getAttribute("data-node-id")
|
||||||
}]);
|
}]);
|
||||||
blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
|
|
||||||
blockElement.setAttribute("data-av-type", "gallery");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
viewElement.classList.add("av__views--show");
|
viewElement.classList.add("av__views--show");
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ export class WYSIWYG {
|
||||||
if (!newWidth || newWidth === oldWidth) {
|
if (!newWidth || newWidth === oldWidth) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const viewId = nodeElement.getAttribute("custom-sy-av-view");
|
const viewId = nodeElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW);
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "setAttrViewColWidth",
|
action: "setAttrViewColWidth",
|
||||||
id: dragColId,
|
id: dragColId,
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,9 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
||||||
}, 450);
|
}, 450);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (data["data-av-type"]) {
|
||||||
|
item.setAttribute("data-av-type", data["data-av-type"]);
|
||||||
|
}
|
||||||
const attrElements = item.querySelectorAll(".protyle-attr");
|
const attrElements = item.querySelectorAll(".protyle-attr");
|
||||||
const attrElement = attrElements[attrElements.length - 1];
|
const attrElement = attrElements[attrElements.length - 1];
|
||||||
if (data.new["custom-avs"] && !data.new["av-names"]) {
|
if (data.new["custom-avs"] && !data.new["av-names"]) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue