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.0.1 to 3.1.0

21

dist/noting.js

@@ -256,4 +256,4 @@ 'use strict';

var sanitizeFragment = function sanitizeFragment(frag, markType) {
var getId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : v4;
var sanitizeFragmentInner = function sanitizeFragmentInner(frag, markType) {
var createId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : v4;
var idMap = {}; // the current id of the node according to the input document

@@ -264,3 +264,3 @@

var setNewId = function setNewId(prevId) {
var newId = !idMap[prevId] ? prevId : getId();
var newId = !idMap[prevId] ? prevId : createId();
idMap[prevId] = newId;

@@ -304,6 +304,17 @@ currentNoteId = prevId;

})(frag);
};
var wrap = function wrap(value) {
return Array.isArray(value) ? value : [value];
}; // markTypes can either be a MarkType or MarkType[]
var sanitizeFragment = function sanitizeFragment(frag, markTypes, createId) {
return wrap(markTypes).reduce(function (nextFrag, markType) {
return sanitizeFragmentInner(nextFrag, markType, createId);
}, frag);
}; // Similar to sanitizeFragment but allows a node to be passed instead
var sanitizeNode = function sanitizeNode(node, markType, getId) {
return node.copy(sanitizeFragment(node.content, markType, getId));
var sanitizeNode = function sanitizeNode(node, markTypes, createId) {
return node.copy(sanitizeFragment(node.content, markTypes, createId));
}; // Return an array of all of the new ranges in a document [[start, end], ...]

@@ -310,0 +321,0 @@

{
"name": "@guardian/prosemirror-noting",
"version": "3.0.1",
"version": "3.1.0",
"description": "A plugin to allow noting in prosemirror",

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

@@ -40,3 +40,3 @@ import { AllSelection } from "prosemirror-state";

// e.g. <note id="1">test</note> some <note id="2">stuff</note>
export const sanitizeFragment = (frag, markType, getId = v4) => {
const sanitizeFragmentInner = (frag, markType, createId = v4) => {
let idMap = {};

@@ -47,3 +47,3 @@ // the current id of the node according to the input document

const setNewId = prevId => {
const newId = !idMap[prevId] ? prevId : getId();
const newId = !idMap[prevId] ? prevId : createId();
idMap[prevId] = newId;

@@ -87,5 +87,14 @@ currentNoteId = prevId;

const wrap = value => (Array.isArray(value) ? value : [value]);
// markTypes can either be a MarkType or MarkType[]
export const sanitizeFragment = (frag, markTypes, createId) =>
wrap(markTypes).reduce(
(nextFrag, markType) => sanitizeFragmentInner(nextFrag, markType, createId),
frag
);
// Similar to sanitizeFragment but allows a node to be passed instead
export const sanitizeNode = (node, markType, getId) =>
node.copy(sanitizeFragment(node.content, markType, getId));
export const sanitizeNode = (node, markTypes, createId) =>
node.copy(sanitizeFragment(node.content, markTypes, createId));

@@ -92,0 +101,0 @@ // Return an array of all of the new ranges in a document [[start, end], ...]

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