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

prosemirror-state

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-state - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## 1.2.0 (2018-04-05)
### New features
[`EditorState.create`](https://prosemirror.net/docs/ref/#state.EditorState^create) now accepts a `storedMark` option to set the state's stored marks.
[`EditorState.toJSON`](https://prosemirror.net/docs/ref/#state.EditorState.toJSON) and [`fromJSON`](https://prosemirror.net/docs/ref/#state.EditorState^fromJSON) persist the set of stored marks, when available.
## 1.1.1 (2018-03-15)

@@ -2,0 +10,0 @@

8

dist/index.js

@@ -732,3 +732,3 @@ 'use strict';

new FieldDesc("storedMarks", {
init: function init() { return null },
init: function init(config) { return config.storedMarks || null },
apply: function apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null }

@@ -889,2 +889,5 @@ }),

//
// storedMarks:: ?[Mark]
// The initial set of [stored marks](#state.EditorState.storedMarks).
//
// plugins:: ?[Plugin]

@@ -937,2 +940,3 @@ // The plugins that should be active in this state.

var result = {doc: this.doc.toJSON(), selection: this.selection.toJSON()};
if (this.storedMarks) { result.storedMarks = this.storedMarks.map(function (m) { return m.toJSON(); }); }
if (pluginFields && typeof pluginFields == 'object') { for (var prop in pluginFields) {

@@ -971,2 +975,4 @@ if (prop == "doc" || prop == "selection")

instance.selection = Selection.fromJSON(instance.doc, json.selection);
} else if (field.name == "storedMarks") {
if (json.storedMarks) { instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON); }
} else {

@@ -973,0 +979,0 @@ if (pluginFields) { for (var prop in pluginFields) {

2

package.json
{
"name": "prosemirror-state",
"version": "1.1.1",
"version": "1.2.0",
"description": "ProseMirror editor state",

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

@@ -30,3 +30,3 @@ import {Node} from "prosemirror-model"

new FieldDesc("storedMarks", {
init() { return null },
init(config) { return config.storedMarks || null },
apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null }

@@ -179,2 +179,5 @@ }),

//
// storedMarks:: ?[Mark]
// The initial set of [stored marks](#state.EditorState.storedMarks).
//
// plugins:: ?[Plugin]

@@ -223,2 +226,3 @@ // The plugins that should be active in this state.

let result = {doc: this.doc.toJSON(), selection: this.selection.toJSON()}
if (this.storedMarks) result.storedMarks = this.storedMarks.map(m => m.toJSON())
if (pluginFields && typeof pluginFields == 'object') for (let prop in pluginFields) {

@@ -257,2 +261,4 @@ if (prop == "doc" || prop == "selection")

instance.selection = Selection.fromJSON(instance.doc, json.selection)
} else if (field.name == "storedMarks") {
if (json.storedMarks) instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON)
} else {

@@ -259,0 +265,0 @@ if (pluginFields) for (let prop in pluginFields) {

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