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

prosemirror-flat-list

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-flat-list - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

44

./dist/prosemirror-flat-list.js

@@ -49,3 +49,3 @@ // src/commands/dedent-list.ts

kind: "task",
checked: element.hasAttribute("data-checked")
checked: element.hasAttribute("data-list-checked")
};

@@ -838,2 +838,12 @@ }

// src/utils/create-and-fill.ts
function createAndFill(type, attrs, content, marks) {
const node = type.createAndFill(attrs, content, marks);
if (!node) {
throw new RangeError(`Failed to create '${type.name}' node`);
}
node.check();
return node;
}
// src/utils/is-block-node-selection.ts

@@ -896,17 +906,24 @@ function isBlockNodeSelection(selection) {

const tr = state.tr;
const listType = listNode.type;
const attrs = listNode.attrs;
const newAttrs = { kind: attrs.kind };
tr.delete(tr.selection.from, tr.selection.to);
const { $from, $to } = tr.selection;
const atEnd = $to.parentOffset == $to.parent.content.size;
const { parentOffset } = $to;
const atStart = parentOffset == 0;
const atEnd = parentOffset == $to.parent.content.size;
if (atStart) {
if (dispatch) {
const pos = $from.before(-1);
tr.insert(pos, createAndFill(listType, newAttrs));
dispatch(tr.scrollIntoView());
}
return true;
}
if (atEnd && attrs.collapsed) {
if (dispatch) {
const pos = $from.after(-1);
tr.insert(
pos,
listNode.type.createAndFill({
kind: attrs.kind
})
);
tr.insert(pos, createAndFill(listType, newAttrs));
tr.setSelection(Selection.near(tr.doc.resolve(pos)));
dispatch(tr);
dispatch(tr.scrollIntoView());
}

@@ -917,10 +934,3 @@ return true;

const typesAfter = [
{
type: getListType(state.schema),
attrs: {
// We don't want to inherit all list attributes (e.g. checked) except
// for the list kind
kind: attrs.kind
}
},
{ type: listType, attrs: newAttrs },
nextType ? { type: nextType } : null

@@ -927,0 +937,0 @@ ];

@@ -49,3 +49,3 @@ // src/commands/dedent-list.ts

kind: "task",
checked: element.hasAttribute("data-checked")
checked: element.hasAttribute("data-list-checked")
};

@@ -838,2 +838,12 @@ }

// src/utils/create-and-fill.ts
function createAndFill(type, attrs, content, marks) {
const node = type.createAndFill(attrs, content, marks);
if (!node) {
throw new RangeError(`Failed to create '${type.name}' node`);
}
node.check();
return node;
}
// src/utils/is-block-node-selection.ts

@@ -896,17 +906,24 @@ function isBlockNodeSelection(selection) {

const tr = state.tr;
const listType = listNode.type;
const attrs = listNode.attrs;
const newAttrs = { kind: attrs.kind };
tr.delete(tr.selection.from, tr.selection.to);
const { $from, $to } = tr.selection;
const atEnd = $to.parentOffset == $to.parent.content.size;
const { parentOffset } = $to;
const atStart = parentOffset == 0;
const atEnd = parentOffset == $to.parent.content.size;
if (atStart) {
if (dispatch) {
const pos = $from.before(-1);
tr.insert(pos, createAndFill(listType, newAttrs));
dispatch(tr.scrollIntoView());
}
return true;
}
if (atEnd && attrs.collapsed) {
if (dispatch) {
const pos = $from.after(-1);
tr.insert(
pos,
listNode.type.createAndFill({
kind: attrs.kind
})
);
tr.insert(pos, createAndFill(listType, newAttrs));
tr.setSelection(Selection.near(tr.doc.resolve(pos)));
dispatch(tr);
dispatch(tr.scrollIntoView());
}

@@ -917,10 +934,3 @@ return true;

const typesAfter = [
{
type: getListType(state.schema),
attrs: {
// We don't want to inherit all list attributes (e.g. checked) except
// for the list kind
kind: attrs.kind
}
},
{ type: listType, attrs: newAttrs },
nextType ? { type: nextType } : null

@@ -927,0 +937,0 @@ ];

{
"name": "prosemirror-flat-list",
"type": "module",
"version": "0.3.1",
"version": "0.3.2",
"description": "Powerful list support for ProseMirror",

@@ -6,0 +6,0 @@ "author": "ocavue <ocavue@gmail.com>",

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