This commit is contained in:
parent
26db301a12
commit
725bc6c413
2 changed files with 13 additions and 4 deletions
|
@ -217,7 +217,8 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
srcIDs,
|
srcIDs,
|
||||||
avID,
|
avID,
|
||||||
}]);
|
}]);
|
||||||
insertAttrViewBlockAnimation(blockElement, 1, previousID);
|
insertAttrViewBlockAnimation(blockElement, 1, previousID, avID);
|
||||||
|
popTextCell(protyle, [addRowElement.previousElementSibling.querySelector('[data-detached="true"]')], "block");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
|
@ -359,16 +360,16 @@ export const removeAttrViewColAnimation = (blockElement: Element, id: string) =>
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const insertAttrViewBlockAnimation = (blockElement: Element, size: number, previousId: string) => {
|
export const insertAttrViewBlockAnimation = (blockElement: Element, size: number, previousId: string, avId?:string) => {
|
||||||
const previousElement = blockElement.querySelector(`.av__row[data-id="${previousId}"]`) || blockElement.querySelector(".av__row--header");
|
const previousElement = blockElement.querySelector(`.av__row[data-id="${previousId}"]`) || blockElement.querySelector(".av__row--header");
|
||||||
let colHTML = "";
|
let colHTML = "";
|
||||||
previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement) => {
|
previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement) => {
|
||||||
colHTML += `<div class="av__cell" style="width: ${item.style.width}"><span class="av__pulse"></span></div>`;
|
colHTML += `<div class="av__cell" style="width: ${item.style.width}" ${item.getAttribute("data-block-id") ? ' data-detached="true"' : ""}><span class="av__pulse"></span></div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
let html = "";
|
let html = "";
|
||||||
new Array(size).fill(1).forEach(() => {
|
new Array(size).fill(1).forEach(() => {
|
||||||
html += `<div class="av__row">
|
html += `<div class="av__row" data-avid="${avId}">
|
||||||
<div style="width: 24px"></div>
|
<div style="width: 24px"></div>
|
||||||
${colHTML}
|
${colHTML}
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
|
@ -395,6 +395,14 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElement[]) => {
|
const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElement[]) => {
|
||||||
|
if (!document.contains(cellElements[0]) && cellElements.length === 1 && cellElements[0].dataset.detached === "true") {
|
||||||
|
// 新增行后弹出的输入框进行修改后,原始 cell 已被更新
|
||||||
|
const avid = cellElements[0].parentElement.dataset.avid;
|
||||||
|
cellElements[0] = protyle.wysiwyg.element.querySelector(`[data-av-id="${avid}"] .av__row--add`).previousElementSibling.querySelector('[data-detached="true"]')
|
||||||
|
}
|
||||||
|
if ( cellElements.length === 1 && cellElements[0].dataset.detached === "true" && !cellElements[0].parentElement.dataset.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const blockElement = hasClosestBlock(cellElements[0]);
|
const blockElement = hasClosestBlock(cellElements[0]);
|
||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue