🎨 撤销后保持原有光标位置 https://github.com/siyuan-note/siyuan/issues/13027
This commit is contained in:
parent
99e2628a79
commit
908c2eae56
2 changed files with 14 additions and 0 deletions
|
@ -737,7 +737,14 @@ export const clearTableCell = (protyle: IProtyle, tableBlockElement: HTMLElement
|
|||
}
|
||||
});
|
||||
tableSelectElement.removeAttribute("style");
|
||||
if (getSelection().rangeCount>0) {
|
||||
const range = getSelection().getRangeAt(0)
|
||||
if (tableBlockElement.contains(range.startContainer)) {
|
||||
range.insertNode(document.createElement("wbr"))
|
||||
}
|
||||
}
|
||||
const oldHTML = tableBlockElement.outerHTML;
|
||||
tableBlockElement.querySelector("wbr")?.remove();
|
||||
tableBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
selectCellElements.forEach(item => {
|
||||
item.innerHTML = "";
|
||||
|
|
|
@ -1482,7 +1482,14 @@ export class WYSIWYG {
|
|||
}
|
||||
});
|
||||
tableSelectElement.removeAttribute("style");
|
||||
if (getSelection().rangeCount>0) {
|
||||
const range = getSelection().getRangeAt(0)
|
||||
if (nodeElement.contains(range.startContainer)) {
|
||||
range.insertNode(document.createElement("wbr"))
|
||||
}
|
||||
}
|
||||
const oldHTML = nodeElement.outerHTML;
|
||||
nodeElement.querySelector("wbr")?.remove();
|
||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
selectCellElements.forEach((item, index) => {
|
||||
if (index === 0 || !item.previousElementSibling ||
|
||||
|
|
Loading…
Add table
Reference in a new issue