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 0.14.0 to 0.15.0

7

dist/selection.js

@@ -35,2 +35,9 @@ // ::- Superclass for editor selections.

// :: () → SelectionAction
// Create an action that updates the selection to this one and
// scrolls it into view.
Selection.prototype.scrollAction = function scrollAction () {
return this.action({scrollIntoView: true})
};
// eq:: (other: Selection) → bool

@@ -37,0 +44,0 @@ // Test whether the selection is the same as another selection.

50

dist/state.js
var ref = require("prosemirror-model");
var Mark = ref.Mark;
var Node = ref.Node;
var ref$1 = require("prosemirror-transform");
var Mapping = ref$1.Mapping;
var ref$2 = require("./selection");
var Selection = ref$2.Selection;
var ref$3 = require("./transform");
var EditorTransform = ref$3.EditorTransform;
var ref$1 = require("./selection");
var Selection = ref$1.Selection;
var ref$2 = require("./transform");
var EditorTransform = ref$2.EditorTransform;
var ViewState = function ViewState(inDOMChange, domChangeMapping, scrollToSelection) {
this.inDOMChange = inDOMChange
this.domChangeMapping = domChangeMapping
this.scrollToSelection = scrollToSelection
};
ViewState.initial = new ViewState(null, null, false)
exports.ViewState = ViewState
function bind(f, self) {

@@ -62,16 +52,7 @@ return !self || !f ? f : f.bind(self)

new FieldDesc("view", {
init: function init$3() { return ViewState.initial },
applyAction: function applyAction$3(action, view) {
if (action.type == "transform")
{ return new ViewState(view.inDOMChange,
view.domChangeMapping && view.domChangeMapping.copy().appendMapping(action.transform.mapping),
action.scrollIntoView ? true : action.selection ? false : view.scrollToSelection) }
if (action.type == "selection")
{ return new ViewState(view.inDOMChange, view.domChangeMapping, action.scrollIntoView) }
if (action.type == "startDOMChange")
{ return new ViewState(action.id, new Mapping, view.scrollToSelection) }
if (action.type == "endDOMChange")
{ return new ViewState(null, null, view.scrollToSelection) }
return view
new FieldDesc("scrollToSelection", {
init: function init$3() { return 0 },
applyAction: function applyAction$3(action, prev) {
return (action.type == "transform" || action.type == "selection") && action.scrollIntoView
? prev + 1 : prev
}

@@ -149,2 +130,3 @@ })

}
for (var i$1 = 0; i$1 < applyListeners.length; i$1++) { applyListeners[i$1](this$1, action, newInstance) }
return newInstance

@@ -240,5 +222,17 @@ };

// Kludge to allow the view to track mappings between different
// instances of a state.
EditorState.addApplyListener = function addApplyListener (f) {
applyListeners.push(f)
};
EditorState.removeApplyListener = function removeApplyListener (f) {
var found = applyListeners.indexOf(f)
if (found > -1) { applyListeners.splice(found, 1) }
};
Object.defineProperties( EditorState.prototype, prototypeAccessors );
exports.EditorState = EditorState
var applyListeners = []
// Action:: interface

@@ -245,0 +239,0 @@ // State updates are performed through actions, which are objects that

{
"name": "prosemirror-state",
"version": "0.14.0",
"version": "0.15.0",
"description": "ProseMirror editor state",

@@ -19,4 +19,4 @@ "main": "dist/index.js",

"dependencies": {
"prosemirror-model": "^0.14.0",
"prosemirror-transform": "^0.14.0"
"prosemirror-model": "^0.15.0",
"prosemirror-transform": "^0.15.0"
},

@@ -32,5 +32,4 @@ "devDependencies": {

"build": "rimraf dist && buble -i src -o dist",
"link-src": "rimraf dist && ln -s src dist",
"prepublish": "npm run build"
}
}

@@ -36,2 +36,9 @@ // ::- Superclass for editor selections.

// :: () → SelectionAction
// Create an action that updates the selection to this one and
// scrolls it into view.
scrollAction() {
return this.action({scrollIntoView: true})
}
// eq:: (other: Selection) → bool

@@ -38,0 +45,0 @@ // Test whether the selection is the same as another selection.

const {Mark, Node} = require("prosemirror-model")
const {Mapping} = require("prosemirror-transform")

@@ -7,12 +6,2 @@ const {Selection} = require("./selection")

class ViewState {
constructor(inDOMChange, domChangeMapping, scrollToSelection) {
this.inDOMChange = inDOMChange
this.domChangeMapping = domChangeMapping
this.scrollToSelection = scrollToSelection
}
}
ViewState.initial = new ViewState(null, null, false)
exports.ViewState = ViewState
function bind(f, self) {

@@ -62,16 +51,7 @@ return !self || !f ? f : f.bind(self)

new FieldDesc("view", {
init() { return ViewState.initial },
applyAction(action, view) {
if (action.type == "transform")
return new ViewState(view.inDOMChange,
view.domChangeMapping && view.domChangeMapping.copy().appendMapping(action.transform.mapping),
action.scrollIntoView ? true : action.selection ? false : view.scrollToSelection)
if (action.type == "selection")
return new ViewState(view.inDOMChange, view.domChangeMapping, action.scrollIntoView)
if (action.type == "startDOMChange")
return new ViewState(action.id, new Mapping, view.scrollToSelection)
if (action.type == "endDOMChange")
return new ViewState(null, null, view.scrollToSelection)
return view
new FieldDesc("scrollToSelection", {
init() { return 0 },
applyAction(action, prev) {
return (action.type == "transform" || action.type == "selection") && action.scrollIntoView
? prev + 1 : prev
}

@@ -146,2 +126,3 @@ })

}
for (let i = 0; i < applyListeners.length; i++) applyListeners[i](this, action, newInstance)
return newInstance

@@ -232,5 +213,17 @@ }

}
// Kludge to allow the view to track mappings between different
// instances of a state.
static addApplyListener(f) {
applyListeners.push(f)
}
static removeApplyListener(f) {
let found = applyListeners.indexOf(f)
if (found > -1) applyListeners.splice(found, 1)
}
}
exports.EditorState = EditorState
const applyListeners = []
// Action:: interface

@@ -237,0 +230,0 @@ // State updates are performed through actions, which are objects that

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