Socket
Socket
Sign inDemoInstall

prosemirror-commands

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-commands - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

6

CHANGELOG.md

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

## 1.1.4 (2020-04-15)
### Bug fixes
`selectNodeForward` and `selectNodeBackward` will now also select nodes next to a gap cursor (or other custom empty selection type).
## 1.1.3 (2020-01-03)

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

30

dist/index.es.js

@@ -80,8 +80,12 @@ import { liftTarget, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';

var ref = state.selection;
var $cursor = ref.$cursor;
if (!$cursor || (view ? !view.endOfTextblock("backward", state)
: $cursor.parentOffset > 0))
{ return false }
var $head = ref.$head;
var empty = ref.empty;
var $cut = $head;
if (!empty) { return false }
var $cut = findCutBefore($cursor), node = $cut && $cut.nodeBefore;
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) { return false }
$cut = findCutBefore($head);
}
var node = $cut && $cut.nodeBefore;
if (!node || !NodeSelection.isSelectable(node)) { return false }

@@ -154,8 +158,12 @@ if (dispatch)

var ref = state.selection;
var $cursor = ref.$cursor;
if (!$cursor || (view ? !view.endOfTextblock("forward", state)
: $cursor.parentOffset < $cursor.parent.content.size))
{ return false }
var $cut = findCutAfter($cursor), node = $cut && $cut.nodeAfter;
var $head = ref.$head;
var empty = ref.empty;
var $cut = $head;
if (!empty) { return false }
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size)
{ return false }
$cut = findCutAfter($head);
}
var node = $cut && $cut.nodeAfter;
if (!node || !NodeSelection.isSelectable(node)) { return false }

@@ -162,0 +170,0 @@ if (dispatch)

@@ -84,8 +84,12 @@ 'use strict';

var ref = state.selection;
var $cursor = ref.$cursor;
if (!$cursor || (view ? !view.endOfTextblock("backward", state)
: $cursor.parentOffset > 0))
{ return false }
var $head = ref.$head;
var empty = ref.empty;
var $cut = $head;
if (!empty) { return false }
var $cut = findCutBefore($cursor), node = $cut && $cut.nodeBefore;
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) { return false }
$cut = findCutBefore($head);
}
var node = $cut && $cut.nodeBefore;
if (!node || !prosemirrorState.NodeSelection.isSelectable(node)) { return false }

@@ -158,8 +162,12 @@ if (dispatch)

var ref = state.selection;
var $cursor = ref.$cursor;
if (!$cursor || (view ? !view.endOfTextblock("forward", state)
: $cursor.parentOffset < $cursor.parent.content.size))
{ return false }
var $cut = findCutAfter($cursor), node = $cut && $cut.nodeAfter;
var $head = ref.$head;
var empty = ref.empty;
var $cut = $head;
if (!empty) { return false }
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size)
{ return false }
$cut = findCutAfter($head);
}
var node = $cut && $cut.nodeAfter;
if (!node || !prosemirrorState.NodeSelection.isSelectable(node)) { return false }

@@ -166,0 +174,0 @@ if (dispatch)

{
"name": "prosemirror-commands",
"version": "1.1.3",
"version": "1.1.4",
"description": "Editing commands for ProseMirror",

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

@@ -78,8 +78,10 @@ import {joinPoint, canJoin, findWrapping, liftTarget, canSplit, ReplaceAroundStep} from "prosemirror-transform"

export function selectNodeBackward(state, dispatch, view) {
let {$cursor} = state.selection
if (!$cursor || (view ? !view.endOfTextblock("backward", state)
: $cursor.parentOffset > 0))
return false
let {$head, empty} = state.selection, $cut = $head
if (!empty) return false
let $cut = findCutBefore($cursor), node = $cut && $cut.nodeBefore
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) return false
$cut = findCutBefore($head)
}
let node = $cut && $cut.nodeBefore
if (!node || !NodeSelection.isSelectable(node)) return false

@@ -150,8 +152,10 @@ if (dispatch)

export function selectNodeForward(state, dispatch, view) {
let {$cursor} = state.selection
if (!$cursor || (view ? !view.endOfTextblock("forward", state)
: $cursor.parentOffset < $cursor.parent.content.size))
return false
let $cut = findCutAfter($cursor), node = $cut && $cut.nodeAfter
let {$head, empty} = state.selection, $cut = $head
if (!empty) return false
if ($head.parent.isTextblock) {
if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size)
return false
$cut = findCutAfter($head)
}
let node = $cut && $cut.nodeAfter
if (!node || !NodeSelection.isSelectable(node)) return false

@@ -158,0 +162,0 @@ if (dispatch)

Sorry, the diff of this file is not supported yet

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