Socket
Socket
Sign inDemoInstall

prosemirror-transform

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-transform - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 1.0.6 (2018-03-15)
### Bug fixes
Throw errors, rather than constructing invalid objects, when deserializing from invalid JSON data.
## 1.0.5 (2018-03-14)

@@ -2,0 +8,0 @@

2

package.json
{
"name": "prosemirror-transform",
"version": "1.0.5",
"version": "1.0.6",
"description": "ProseMirror document transformations",

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

@@ -59,2 +59,4 @@ import {Fragment, Slice} from "prosemirror-model"

static fromJSON(schema, json) {
if (typeof json.from != "number" || typeof json.to != "number")
throw new RangeError("Invalid input for AddMarkStep.fromJSON")
return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark))

@@ -108,2 +110,4 @@ }

static fromJSON(schema, json) {
if (typeof json.from != "number" || typeof json.to != "number")
throw new RangeError("Invalid input for RemoveMarkStep.fromJSON")
return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark))

@@ -110,0 +114,0 @@ }

@@ -68,2 +68,4 @@ import {Slice} from "prosemirror-model"

static fromJSON(schema, json) {
if (typeof json.from != "number" || typeof json.to != "number")
throw new RangeError("Invalid input for ReplaceStep.fromJSON")
return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure)

@@ -137,2 +139,5 @@ }

static fromJSON(schema, json) {
if (typeof json.from != "number" || typeof json.to != "number" ||
typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON")
return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo,

@@ -139,0 +144,0 @@ Slice.fromJSON(schema, json.slice), json.insert, !!json.structure)

@@ -60,3 +60,6 @@ import {ReplaceError} from "prosemirror-model"

static fromJSON(schema, json) {
return stepsByID[json.stepType].fromJSON(schema, json)
if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON")
let type = stepsByID[json.stepType]
if (!type) throw new RangeError(`No step type ${json.stepType} defined`)
return type.fromJSON(schema, json)
}

@@ -63,0 +66,0 @@

Sorry, the diff of this file is too big to display

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