Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@guardian/prosemirror-noting

Package Overview
Dependencies
Maintainers
16
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guardian/prosemirror-noting - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

31

dist/noting.js

@@ -579,4 +579,23 @@ 'use strict';

}, {
key: "rebuildRange",
value: function rebuildRange(state) {
key: "diffRange",
value: function diffRange(state, oldState) {
var start = oldState.doc.content.findDiffStart(state.doc.content);
if (start) {
var end = oldState.doc.content.findDiffEnd(state.doc.content).b;
if (start < end) {
return this.mergeableRange(start, end);
} else if (oldState.doc.nodeSize < state.doc.nodeSize) {
// make sure we're over-zealous with our rebuild size
var diff = state.doc.nodeSize - oldState.doc.nodeSize;
return this.mergeableRange(start, start + diff);
}
}
return false;
}
}, {
key: "insertedRange",
value: function insertedRange(state) {
var ranges = getInsertedRanges(state);

@@ -648,3 +667,3 @@

} else if (tr.getMeta("paste") || tr.getMeta(this.historyPlugin)) {
this.handlePaste();
this.handleChange(!!tr.getMeta(this.historyPlugin), oldState);
} else {

@@ -878,8 +897,8 @@ this.handleInput(oldState);

}, {
key: "handlePaste",
value: function handlePaste() {
key: "handleChange",
value: function handleChange(undo, oldState) {
var noteTracker = this.noteTracker,
tr = this.tr,
markType = this.markType;
var rebuildRange = noteTracker.rebuildRange(tr);
var rebuildRange = undo ? noteTracker.diffRange(tr, oldState) : noteTracker.insertedRange(tr);

@@ -886,0 +905,0 @@ if (rebuildRange) {

2

package.json
{
"name": "@guardian/prosemirror-noting",
"version": "3.1.0",
"version": "3.1.1",
"description": "A plugin to allow noting in prosemirror",

@@ -5,0 +5,0 @@ "main": "dist/noting.js",

@@ -158,3 +158,18 @@ import Note from "./Note";

rebuildRange(state) {
diffRange(state, oldState) {
const start = oldState.doc.content.findDiffStart(state.doc.content);
if (start) {
const end = oldState.doc.content.findDiffEnd(state.doc.content).b;
if (start < end) {
return this.mergeableRange(start, end);
} else if (oldState.doc.nodeSize < state.doc.nodeSize) {
// make sure we're over-zealous with our rebuild size
const diff = state.doc.nodeSize - oldState.doc.nodeSize;
return this.mergeableRange(start, start + diff);
}
}
return false;
}
insertedRange(state) {
let ranges = getInsertedRanges(state);

@@ -161,0 +176,0 @@

@@ -34,3 +34,3 @@ import { Selection } from "prosemirror-state";

} else if (tr.getMeta("paste") || tr.getMeta(this.historyPlugin)) {
this.handlePaste();
this.handleChange(!!tr.getMeta(this.historyPlugin), oldState);
} else {

@@ -249,5 +249,7 @@ this.handleInput(oldState);

*/
handlePaste() {
handleChange(undo, oldState) {
const { noteTracker, tr, markType } = this;
const rebuildRange = noteTracker.rebuildRange(tr);
const rebuildRange = undo
? noteTracker.diffRange(tr, oldState)
: noteTracker.insertedRange(tr);

@@ -254,0 +256,0 @@ if (rebuildRange) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc