aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/RichTextSchema.tsx
diff options
context:
space:
mode:
authorgeireann <60007097+geireann@users.noreply.github.com>2020-07-21 15:02:02 +0800
committergeireann <60007097+geireann@users.noreply.github.com>2020-07-21 15:02:02 +0800
commitf82682f6136ae61902b807c5e52a14c69bcc64ff (patch)
treed7466124d28e0551cd92643cf5cc9cf919bb01ff /src/client/views/nodes/formattedText/RichTextSchema.tsx
parentad6762c369fd0933326579707ecbc34fda42ab6c (diff)
parentd21ef189f2c160d3d80a5cf7d824c314262a59ac (diff)
merge with master
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);
}