support image resize undo

This commit is contained in:
Philipinho
2026-02-24 09:38:05 +00:00
parent 8c380db8c3
commit a1b6e7dbbd
4 changed files with 28 additions and 1 deletions
+9
View File
@@ -262,6 +262,15 @@ export const Drawio = Node.create<DrawioOptions>({
el.src = updatedNode.attrs.src || ""; el.src = updatedNode.attrs.src || "";
} }
const w = updatedNode.attrs.width;
const h = updatedNode.attrs.height;
if (w != null) {
el.style.width = `${w}px`;
}
if (h != null) {
el.style.height = `${h}px`;
}
const align = updatedNode.attrs.align || "center"; const align = updatedNode.attrs.align || "center";
const container = nodeView.dom as HTMLElement; const container = nodeView.dom as HTMLElement;
applyAlignment(container, align); applyAlignment(container, align);
@@ -262,6 +262,15 @@ export const Excalidraw = Node.create<ExcalidrawOptions>({
el.src = updatedNode.attrs.src || ""; el.src = updatedNode.attrs.src || "";
} }
const w = updatedNode.attrs.width;
const h = updatedNode.attrs.height;
if (w != null) {
el.style.width = `${w}px`;
}
if (h != null) {
el.style.height = `${h}px`;
}
const align = updatedNode.attrs.align || "center"; const align = updatedNode.attrs.align || "center";
const container = nodeView.dom as HTMLElement; const container = nodeView.dom as HTMLElement;
applyAlignment(container, align); applyAlignment(container, align);
@@ -294,6 +294,15 @@ export const TiptapImage = Image.extend<ImageOptions>({
el.alt = updatedNode.attrs.alt || ""; el.alt = updatedNode.attrs.alt || "";
} }
const w = updatedNode.attrs.width;
const h = updatedNode.attrs.height;
if (w != null) {
el.style.width = `${w}px`;
}
if (h != null) {
el.style.height = `${h}px`;
}
// Update alignment on container // Update alignment on container
const align = updatedNode.attrs.align || "center"; const align = updatedNode.attrs.align || "center";
const container = nodeView.dom as HTMLElement; const container = nodeView.dom as HTMLElement;