mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-21 22:44:06 +01:00
🚨
This commit is contained in:
parent
09b4304df2
commit
ab69eb5732
9 changed files with 45 additions and 73 deletions
|
|
@ -317,13 +317,13 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
${window.siyuan.languages.insertRowBefore.replace("${x}", '<span class="fn__space"></span><input style="width:64px" type="number" step="1" min="1" placeholder="Enter" class="b3-text-field"><span class="fn__space"></span>')}
|
||||
</div>`,
|
||||
bind(element) {
|
||||
const inputElement = element.querySelector("input")
|
||||
const inputElement = element.querySelector("input");
|
||||
inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
|
||||
if (!event.isComposing && event.key === "Enter") {
|
||||
insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].previousElementSibling.getAttribute("data-id"));
|
||||
menu.close();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
menu.addItem({
|
||||
|
|
@ -333,13 +333,13 @@ ${window.siyuan.languages.insertRowBefore.replace("${x}", '<span class="fn__spac
|
|||
${window.siyuan.languages.insertRowAfter.replace("${x}", '<span class="fn__space"></span><input style="width:64px" type="number" step="1" min="1" placeholder="Enter" class="b3-text-field"><span class="fn__space"></span>')}
|
||||
</div>`,
|
||||
bind(element) {
|
||||
const inputElement = element.querySelector("input")
|
||||
const inputElement = element.querySelector("input");
|
||||
inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
|
||||
if (!event.isComposing && event.key === "Enter") {
|
||||
insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].getAttribute("data-id"));
|
||||
menu.close();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
|
|
|
|||
|
|
@ -829,4 +829,4 @@ export const addDragFill = (cellElement: Element) => {
|
|||
}
|
||||
cellElement.classList.add("av__cell--active");
|
||||
cellElement.insertAdjacentHTML("beforeend", `<div aria-label="${window.siyuan.languages.dragFill}" class="av__drag-fill ariaLabel"></div>`);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
|
|||
if (selectCellElement) {
|
||||
selectCellId = (hasClosestByClassName(selectCellElement, "av__row") as HTMLElement).dataset.id + Constants.ZWSP + selectCellElement.getAttribute("data-col-id");
|
||||
}
|
||||
let dragFillId = ""
|
||||
let dragFillId = "";
|
||||
const dragFillElement = e.querySelector(".av__drag-fill") as HTMLElement;
|
||||
if (dragFillElement) {
|
||||
dragFillId = (hasClosestByClassName(dragFillElement, "av__row") as HTMLElement).dataset.id + Constants.ZWSP + dragFillElement.parentElement.getAttribute("data-col-id");
|
||||
|
|
@ -58,7 +58,7 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
|
|||
const activeIds: string[] = [];
|
||||
e.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => {
|
||||
activeIds.push((hasClosestByClassName(item, "av__row") as HTMLElement).dataset.id + Constants.ZWSP + item.getAttribute("data-col-id"));
|
||||
})
|
||||
});
|
||||
const created = protyle.options.history?.created;
|
||||
const snapshot = protyle.options.history?.snapshot;
|
||||
let newViewID = e.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "";
|
||||
|
|
@ -288,11 +288,11 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value)}</div>`;
|
|||
}
|
||||
}
|
||||
if (dragFillId) {
|
||||
addDragFill(e.querySelector(`.av__row[data-id="${dragFillId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${dragFillId.split(Constants.ZWSP)[1]}"]`))
|
||||
addDragFill(e.querySelector(`.av__row[data-id="${dragFillId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${dragFillId.split(Constants.ZWSP)[1]}"]`));
|
||||
}
|
||||
activeIds.forEach(activeId => {
|
||||
e.querySelector(`.av__row[data-id="${activeId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${activeId.split(Constants.ZWSP)[1]}"]`)?.classList.add("av__cell--active")
|
||||
})
|
||||
e.querySelector(`.av__row[data-id="${activeId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${activeId.split(Constants.ZWSP)[1]}"]`)?.classList.add("av__cell--active");
|
||||
});
|
||||
if (getSelection().rangeCount > 0) {
|
||||
// 修改表头后光标重新定位
|
||||
const range = getSelection().getRangeAt(0);
|
||||
|
|
|
|||
|
|
@ -380,4 +380,4 @@ export const insertRows = (blockElement: HTMLElement, protyle: IProtyle, count:
|
|||
}]);
|
||||
insertAttrViewBlockAnimation(protyle, blockElement, srcIDs, previousID, avID);
|
||||
blockElement.setAttribute("updated", newUpdated);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue