fix: Incorrect translation of != null

This commit is contained in:
Tom Moor
2023-09-21 10:24:18 -04:00
parent 89537aabc3
commit 8c661345f0
2 changed files with 4 additions and 4 deletions

View File

@@ -91,7 +91,7 @@ export class RecreateTransform {
// collect operations until we receive a valid document:
// apply ops-patches until a valid prosemirror document is retrieved,
// then try to create a transformation step or retry with next operation
while (toDoc === null) {
while (!toDoc) {
applyPatch(afterStepJSON, [op]);
try {
@@ -125,7 +125,7 @@ export class RecreateTransform {
// Text is being replaced, we apply text diffing to find the smallest possible diffs.
this.addReplaceTextSteps(op, afterStepJSON);
ops = [];
} else if (toDoc && this.addReplaceStep(toDoc, afterStepJSON)) {
} else if (this.addReplaceStep(toDoc, afterStepJSON)) {
// operations have been applied
ops = [];
}
@@ -144,7 +144,7 @@ export class RecreateTransform {
const fromNode = fromDoc.nodeAt(start) as Node;
const toNode = toDoc.nodeAt(start) as Node;
if (start !== null) {
if (!start) {
// @note this completly updates all attributes in one step, by completely replacing node
const nodeType = fromNode.type === toNode.type ? null : toNode.type;
try {

View File

@@ -3,7 +3,7 @@ import { Decoration, DecorationSet } from "prosemirror-view";
import * as React from "react";
import ReactDOM from "react-dom";
import FileExtension from "../components/FileExtension";
import { recreateTransform } from "../lib/prosemirror-recreate-transform";
import { recreateTransform } from "./prosemirror-recreate-transform";
// based on the example at: https://prosemirror.net/examples/upload/
const uploadPlaceholder = new Plugin({