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

prosemirror-schema-list

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-schema-list - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

6

CHANGELOG.md

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

## 1.3.0 (2023-06-01)
### New features
`splitListItem` now takes an optional second argument to set the attributes of the new list item node. Rename parameter
## 1.2.3 (2023-05-17)

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

2

dist/index.d.ts

@@ -46,3 +46,3 @@ import { NodeSpec, NodeType, Attrs } from 'prosemirror-model';

*/
declare function splitListItem(itemType: NodeType): Command;
declare function splitListItem(itemType: NodeType, itemAttrs?: Attrs): Command;
/**

@@ -49,0 +49,0 @@ Create a command to lift the list item around the selection up into

@@ -120,3 +120,3 @@ import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';

*/
function splitListItem(itemType) {
function splitListItem(itemType, itemAttrs) {
return function (state, dispatch) {

@@ -164,3 +164,3 @@ let { $from, $to, node } = state.selection;

let tr = state.tr.delete($from.pos, $to.pos);
let types = nextType ? [null, { type: nextType }] : undefined;
let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;
if (!canSplit(tr.doc, $from.pos, 2, types))

@@ -167,0 +167,0 @@ return false;

{
"name": "prosemirror-schema-list",
"version": "1.2.3",
"version": "1.3.0",
"description": "List-related schema elements and commands for ProseMirror",

@@ -28,3 +28,3 @@ "type": "module",

"prosemirror-model": "^1.0.0",
"prosemirror-transform": "^1.0.0",
"prosemirror-transform": "^1.7.3",
"prosemirror-state": "^1.0.0"

@@ -31,0 +31,0 @@ },

@@ -114,3 +114,3 @@ import {findWrapping, liftTarget, canSplit, ReplaceAroundStep, canJoin} from "prosemirror-transform"

/// of a list item by also splitting that list item.
export function splitListItem(itemType: NodeType): Command {
export function splitListItem(itemType: NodeType, itemAttrs?: Attrs): Command {
return function(state: EditorState, dispatch?: (tr: Transaction) => void) {

@@ -152,3 +152,3 @@ let {$from, $to, node} = state.selection as NodeSelection

let tr = state.tr.delete($from.pos, $to.pos)
let types = nextType ? [null, {type: nextType}] : undefined
let types = nextType ? [itemAttrs ? {type: itemType, attrs: itemAttrs} : null, {type: nextType}] : undefined
if (!canSplit(tr.doc, $from.pos, 2, types)) return false

@@ -155,0 +155,0 @@ if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView())

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