fix: Incorrect translation of != null
This commit is contained in:
@@ -91,7 +91,7 @@ export class RecreateTransform {
|
|||||||
// collect operations until we receive a valid document:
|
// collect operations until we receive a valid document:
|
||||||
// apply ops-patches until a valid prosemirror document is retrieved,
|
// apply ops-patches until a valid prosemirror document is retrieved,
|
||||||
// then try to create a transformation step or retry with next operation
|
// then try to create a transformation step or retry with next operation
|
||||||
while (toDoc === null) {
|
while (!toDoc) {
|
||||||
applyPatch(afterStepJSON, [op]);
|
applyPatch(afterStepJSON, [op]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -125,7 +125,7 @@ export class RecreateTransform {
|
|||||||
// Text is being replaced, we apply text diffing to find the smallest possible diffs.
|
// Text is being replaced, we apply text diffing to find the smallest possible diffs.
|
||||||
this.addReplaceTextSteps(op, afterStepJSON);
|
this.addReplaceTextSteps(op, afterStepJSON);
|
||||||
ops = [];
|
ops = [];
|
||||||
} else if (toDoc && this.addReplaceStep(toDoc, afterStepJSON)) {
|
} else if (this.addReplaceStep(toDoc, afterStepJSON)) {
|
||||||
// operations have been applied
|
// operations have been applied
|
||||||
ops = [];
|
ops = [];
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ export class RecreateTransform {
|
|||||||
const fromNode = fromDoc.nodeAt(start) as Node;
|
const fromNode = fromDoc.nodeAt(start) as Node;
|
||||||
const toNode = toDoc.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
|
// @note this completly updates all attributes in one step, by completely replacing node
|
||||||
const nodeType = fromNode.type === toNode.type ? null : toNode.type;
|
const nodeType = fromNode.type === toNode.type ? null : toNode.type;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Decoration, DecorationSet } from "prosemirror-view";
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import FileExtension from "../components/FileExtension";
|
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/
|
// based on the example at: https://prosemirror.net/examples/upload/
|
||||||
const uploadPlaceholder = new Plugin({
|
const uploadPlaceholder = new Plugin({
|
||||||
|
|||||||
Reference in New Issue
Block a user