aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/RichTextSchema.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/RichTextSchema.tsx')
-rw-r--r--src/client/views/nodes/formattedText/RichTextSchema.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/nodes/formattedText/RichTextSchema.tsx b/src/client/views/nodes/formattedText/RichTextSchema.tsx
index a989abd6a..7a50ec3af 100644
--- a/src/client/views/nodes/formattedText/RichTextSchema.tsx
+++ b/src/client/views/nodes/formattedText/RichTextSchema.tsx
@@ -54,6 +54,8 @@ export class DashDocView {
this._dashSpan.style.height = node.attrs.height;
this._dashSpan.style.position = "absolute";
this._dashSpan.style.display = "inline-block";
+ this._dashSpan.style.left = "0";
+ this._dashSpan.style.top = "0";
this._dashSpan.style.whiteSpace = "normal";
this._dashSpan.onpointerleave = () => {
@@ -160,7 +162,13 @@ export class DashDocView {
if (node.attrs.width !== dashDoc._width + "px" || node.attrs.height !== dashDoc._height + "px") {
try { // bcz: an exception will be thrown if two aliases are open at the same time when a doc view comment is made
- view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, { ...node.attrs, width: dashDoc._width + "px", height: dashDoc._height + "px" }));
+ if (getPos() !== undefined) {
+ const node = view.state.tr.doc.nodeAt(getPos());
+ if (node.attrs.width !== dashDoc._width + "px" ||
+ node.attrs.height !== dashDoc._height + "px") {
+ view.dispatch(view.state.tr.setNodeMarkup(getPos(), null, { ...node.attrs, width: dashDoc._width + "px", height: dashDoc._height + "px" }));
+ }
+ }
} catch (e) {
console.log(e);
}