This commit is contained in:
Vanessa 2026-02-20 14:16:06 +08:00
parent 70b23c351f
commit e7b04229c5
4 changed files with 16 additions and 16 deletions

View file

@ -2302,7 +2302,7 @@ export class Gutter {
data: e.outerHTML
});
if (e.getAttribute("data-subtype") === "echarts") {
const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_"));
const chartInstance = window.echarts.getInstanceById(e.querySelector("[_echarts_instance_]").getAttribute("_echarts_instance_"));
if (chartInstance) {
chartInstance.resize();
}
@ -2346,7 +2346,7 @@ export class Gutter {
e.style.width = item;
e.style.flex = "none";
if (e.getAttribute("data-subtype") === "echarts") {
const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_"));
const chartInstance = window.echarts.getInstanceById(e.querySelector("[_echarts_instance_]").getAttribute("_echarts_instance_"));
if (chartInstance) {
chartInstance.resize();
}
@ -2392,7 +2392,7 @@ export class Gutter {
e.style.width = "";
e.style.flex = "";
if (e.getAttribute("data-subtype") === "echarts") {
const chartInstance = window.echarts.getInstanceById(e.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_"));
const chartInstance = window.echarts.getInstanceById(e.querySelector("[_echarts_instance_]").getAttribute("_echarts_instance_"));
if (chartInstance) {
chartInstance.resize();
}

View file

@ -1,6 +1,6 @@
import {setEditMode} from "../util/setEditMode";
import {scrollEvent} from "../scroll/event";
import {isMobile, isTouchDevice} from "../../util/functions";
import {isMobile} from "../../util/functions";
import {Constants} from "../../constants";
import {isMac} from "../util/compatibility";
import {setInlineStyle} from "../../util/assets";

View file

@ -67,7 +67,7 @@ export const resize = (protyle: IProtyle) => {
if (abs.width > MIN_ABS || isNaN(abs.width)) {
if (typeof window.echarts !== "undefined") {
protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => {
const chartInstance = window.echarts.getInstanceById(chartItem.querySelector('[_echarts_instance_]').getAttribute("_echarts_instance_"));
const chartInstance = window.echarts.getInstanceById(chartItem.querySelector("[_echarts_instance_]").getAttribute("_echarts_instance_"));
if (chartInstance) {
chartInstance.resize();
}

View file

@ -100,25 +100,25 @@ export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElem
for (let m = 0; m < cellElement.parentElement.childElementCount; m++) {
rowHTML += `<td align="${cellElement.parentElement.children[m].getAttribute("align") || ""}"></td>`;
}
let newRowElememt: HTMLTableRowElement;
let newRowElement: HTMLTableRowElement;
if (cellElement.tagName === "TH") {
const tbodyElement = nodeElement.querySelector("tbody");
if (tbodyElement) {
tbodyElement.insertAdjacentHTML("afterbegin", `<tr>${rowHTML}</tr>`);
newRowElememt = tbodyElement.firstElementChild as HTMLTableRowElement;
newRowElement = tbodyElement.firstElementChild as HTMLTableRowElement;
} else {
cellElement.parentElement.parentElement.insertAdjacentHTML("afterend", `<tbody><tr>${rowHTML}</tr></tbody>`);
newRowElememt = cellElement.parentElement.parentElement.nextElementSibling.firstElementChild as HTMLTableRowElement;
newRowElement = cellElement.parentElement.parentElement.nextElementSibling.firstElementChild as HTMLTableRowElement;
}
} else {
cellElement.parentElement.insertAdjacentHTML("afterend", `<tr>${rowHTML}</tr>`);
newRowElememt = cellElement.parentElement.nextElementSibling as HTMLTableRowElement;
newRowElement = cellElement.parentElement.nextElementSibling as HTMLTableRowElement;
}
range.selectNodeContents(newRowElememt.cells[getColIndex(cellElement)]);
range.selectNodeContents(newRowElement.cells[getColIndex(cellElement)]);
range.collapse(true);
focusByRange(range);
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
scrollToView(nodeElement, newRowElememt, protyle);
scrollToView(nodeElement, newRowElement, protyle);
};
export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element, count = 1) => {
@ -156,10 +156,10 @@ export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTM
previousTrElement = previousTrElement.previousElementSibling;
}
}
let newRowElememt: HTMLTableRowElement;
let newRowElement: HTMLTableRowElement;
if (cellElement.parentElement.parentElement.tagName === "THEAD" && !cellElement.parentElement.previousElementSibling) {
cellElement.parentElement.parentElement.insertAdjacentHTML("beforebegin", `<thead><tr>${rowHTML}</tr></thead>`);
newRowElememt = nodeElement.querySelector("thead tr");
newRowElement = nodeElement.querySelector("thead tr");
if (count > 1) {
cellElement.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin", `<tr>${rowHTML.replace(/<th/g, "<td").replace(/<\/th>/g, "</td>")}</tr>`.repeat(count - 1));
}
@ -167,13 +167,13 @@ export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTM
cellElement.parentElement.parentElement.remove();
} else {
cellElement.parentElement.insertAdjacentHTML("beforebegin", `<tr>${rowHTML}</tr>`.repeat(count));
newRowElememt = cellElement.parentElement.previousElementSibling as HTMLTableRowElement;
newRowElement = cellElement.parentElement.previousElementSibling as HTMLTableRowElement;
}
range.selectNodeContents(newRowElememt.cells[getColIndex(cellElement)]);
range.selectNodeContents(newRowElement.cells[getColIndex(cellElement)]);
range.collapse(true);
focusByRange(range);
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
scrollToView(nodeElement, newRowElememt, protyle);
scrollToView(nodeElement, newRowElement, protyle);
};
export const insertColumn = (protyle: IProtyle, nodeElement: Element, cellElement: HTMLElement, type: InsertPosition, range: Range) => {