Socket
Socket
Sign inDemoInstall

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.13.0 to 0.14.0

2

dist/selection.js

@@ -30,3 +30,3 @@ // ::- Superclass for editor selections.

Selection.prototype.action = function action (options) {
var action = {type: "selection", selection: this}
var action = {type: "selection", selection: this, time: Date.now()}
if (options) { for (var prop in options) { action[prop] = options[prop] } }

@@ -33,0 +33,0 @@ return action

@@ -106,3 +106,3 @@ var ref = require("prosemirror-model");

// but rather a new state value is computed from an old one with the
// [`applyAction`](state.EditorState.applyAction) method.
// [`applyAction`](#state.EditorState.applyAction) method.
//

@@ -285,5 +285,13 @@ // In addition to the built-in state fields, plugins can define

//
// origin:: ?string
// An optional string giving more information about the source of
// the action. The [view](##view) will set this to `"mouse"` for
// selection actions originating from mouse events.
//
// scrollIntoView:: ?bool
// When true, the next display update will scroll the cursor into
// view.
//
// time:: number
// The timestamp at which the action was created.

@@ -290,0 +298,0 @@ // AddStoredMarkAction:: interface

var ref = require("prosemirror-transform");
var Transform = ref.Transform;
var ref$1 = require("prosemirror-model");
var Node = ref$1.Node;
var ref$2 = require("./selection");
var Selection = ref$2.Selection;
var ref$1 = require("./selection");
var Selection = ref$1.Selection;
var warnedAboutReplaceSelection = false
// ::- A selection-aware extension of `Transform`. Use

@@ -52,10 +48,2 @@ // [`EditorState.tr`](#state.EditorState.tr) to create an instance.

EditorTransform.prototype.replaceSelection = function replaceSelection (slice) {
if (slice instanceof Node) { // FIXME backwards compat hack, drop in next release
if (!warnedAboutReplaceSelection) {
if (typeof console != "undefined" && console.warn)
{ console.warn("Calling EditorTransform.replaceSelection with a node is deprecated. Use replaceSelectionWith") }
warnedAboutReplaceSelection = true
}
return this.replaceSelectionWith(slice)
}
var ref = this.selection;

@@ -69,5 +57,8 @@ var from = ref.from;

// position after that node. If not, search forward.
var lastNode = slice.content.lastChild
for (var i = 0; i < slice.openRight; i++) { lastNode = lastNode.lastChild }
selectionToInsertionEnd(this, startLen, lastNode && lastNode.isInline ? -1 : 1)
var lastNode = slice.content.lastChild, lastParent = null
for (var i = 0; i < slice.openRight; i++) {
lastParent = lastNode
lastNode = lastNode.lastChild
}
selectionToInsertionEnd(this, startLen, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1)
return this

@@ -74,0 +65,0 @@ };

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

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

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

@@ -23,0 +23,0 @@ "devDependencies": {

@@ -31,3 +31,3 @@ // ::- Superclass for editor selections.

action(options) {
let action = {type: "selection", selection: this}
let action = {type: "selection", selection: this, time: Date.now()}
if (options) for (let prop in options) action[prop] = options[prop]

@@ -34,0 +34,0 @@ return action

@@ -105,3 +105,3 @@ const {Mark, Node} = require("prosemirror-model")

// but rather a new state value is computed from an old one with the
// [`applyAction`](state.EditorState.applyAction) method.
// [`applyAction`](#state.EditorState.applyAction) method.
//

@@ -276,5 +276,13 @@ // In addition to the built-in state fields, plugins can define

//
// origin:: ?string
// An optional string giving more information about the source of
// the action. The [view](##view) will set this to `"mouse"` for
// selection actions originating from mouse events.
//
// scrollIntoView:: ?bool
// When true, the next display update will scroll the cursor into
// view.
//
// time:: number
// The timestamp at which the action was created.

@@ -281,0 +289,0 @@ // AddStoredMarkAction:: interface

const {Transform} = require("prosemirror-transform")
const {Node} = require("prosemirror-model")
const {Selection} = require("./selection")
let warnedAboutReplaceSelection = false
// ::- A selection-aware extension of `Transform`. Use

@@ -43,10 +40,2 @@ // [`EditorState.tr`](#state.EditorState.tr) to create an instance.

replaceSelection(slice) {
if (slice instanceof Node) { // FIXME backwards compat hack, drop in next release
if (!warnedAboutReplaceSelection) {
if (typeof console != "undefined" && console.warn)
console.warn("Calling EditorTransform.replaceSelection with a node is deprecated. Use replaceSelectionWith")
warnedAboutReplaceSelection = true
}
return this.replaceSelectionWith(slice)
}
let {from, to} = this.selection, startLen = this.steps.length

@@ -57,5 +46,8 @@ this.replaceRange(from, to, slice)

// position after that node. If not, search forward.
let lastNode = slice.content.lastChild
for (let i = 0; i < slice.openRight; i++) lastNode = lastNode.lastChild
selectionToInsertionEnd(this, startLen, lastNode && lastNode.isInline ? -1 : 1)
let lastNode = slice.content.lastChild, lastParent = null
for (let i = 0; i < slice.openRight; i++) {
lastParent = lastNode
lastNode = lastNode.lastChild
}
selectionToInsertionEnd(this, startLen, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1)
return this

@@ -62,0 +54,0 @@ }

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