This commit is contained in:
Vanessa 2024-12-12 10:48:57 +08:00
parent 99e2628a79
commit 908c2eae56
2 changed files with 14 additions and 0 deletions

View file

@ -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 = "";

View file

@ -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 ||