mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
bbbdda7ef0
commit
6109e8a3c3
3 changed files with 12 additions and 8 deletions
|
|
@ -82,7 +82,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
avID,
|
||||
}]);
|
||||
insertAttrViewBlockAnimation(blockElement, 1, previousID, avID);
|
||||
popTextCell(protyle, [rowElement[event.altKey ? "previousElementSibling" : "nextElementSibling"].querySelector('[data-detached="true"]')], "block");
|
||||
} else {
|
||||
const gutterRect = gutterElement.getBoundingClientRect();
|
||||
avContextmenu(protyle, rowElement, {
|
||||
|
|
@ -238,7 +237,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
avID,
|
||||
}]);
|
||||
insertAttrViewBlockAnimation(blockElement, 1, previousID, avID);
|
||||
popTextCell(protyle, [addRowElement.previousElementSibling.querySelector('[data-detached="true"]')], "block");
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {fetchPost} from "../../../util/fetch";
|
||||
import {getColIconByType} from "./col";
|
||||
import {Constants} from "../../../constants";
|
||||
import {getCalcValue} from "./cell";
|
||||
import {getCalcValue, popTextCell} from "./cell";
|
||||
import * as dayjs from "dayjs";
|
||||
import {unicode2Emoji} from "../../../emoji";
|
||||
import {focusBlock} from "../../util/selection";
|
||||
|
|
@ -236,7 +236,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
|
||||
let lastParentID: string;
|
||||
let lastElement: HTMLElement;
|
||||
export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||
export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {
|
||||
if (operation.action === "setAttrViewName") {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => {
|
||||
const titleElement = item.querySelector(".av__title") as HTMLElement;
|
||||
|
|
@ -267,9 +267,15 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
} else {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
||||
item.removeAttribute("data-render");
|
||||
avRender(item, protyle);
|
||||
avRender(item, protyle, () => {
|
||||
// https://github.com/siyuan-note/siyuan/issues/9599
|
||||
if (!isUndo && operation.action === "insertAttrViewBlock" && operation.isDetached) {
|
||||
popTextCell(protyle, [item.querySelector(`.av__row[data-id="${operation.srcIDs[0]}"] > .av__cell[data-detached="true"]`)], "block");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
lastParentID = null;
|
||||
}, Constants.TIMEOUT_TRANSITION);
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
|||
"setAttrViewColWrap", "setAttrViewColWidth", "removeAttrViewColOption", "setAttrViewName", "setAttrViewFilters",
|
||||
"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "removeAttrViewBlock",
|
||||
"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColIcon"].includes(operation.action)) {
|
||||
refreshAV(protyle, operation);
|
||||
refreshAV(protyle, operation, isUndo);
|
||||
} else if (operation.action === "doUpdateUpdated") {
|
||||
updateElements.forEach(item => {
|
||||
item.setAttribute("updated", operation.data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue