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.0.17 to 0.0.18

45

./dist/prosemirror-flat-list.js

@@ -1017,14 +1017,18 @@ // src/commands/dedent-list.ts

const content = [];
let updated = false;
for (const node of nodes) {
if (node.type === "bullet_list" || node.type === "bulletList") {
updated = true;
for (const child of (_a = node.content) != null ? _a : []) {
content.push(migrateNode(child, { type: "bullet" }));
content.push(migrateNode(child, { type: "bullet" })[0]);
}
} else if (node.type === "ordered_list" || node.type === "orderedList") {
updated = true;
for (const child of (_b = node.content) != null ? _b : []) {
content.push(migrateNode(child, { type: "ordered" }));
content.push(migrateNode(child, { type: "ordered" })[0]);
}
} else if (node.type === "task_list" || node.type === "taskList") {
updated = true;
for (const child of (_c = node.content) != null ? _c : []) {
content.push(migrateNode(child, { type: "task" }));
content.push(migrateNode(child, { type: "task" })[0]);
}

@@ -1035,3 +1039,3 @@ } else {

}
return content;
return [content, updated];
}

@@ -1041,20 +1045,25 @@ function migrateNode(node, { type } = {}) {

if (node.type === "list_item" || node.type === "listItem" || node.type === "taskListItem") {
return {
...node,
type: "list",
attrs: {
collapsed: (_a = node.attrs) == null ? void 0 : _a.closed,
...node.attrs,
type: type != null ? type : "bullet"
return [
{
...node,
type: "list",
attrs: {
collapsed: (_a = node.attrs) == null ? void 0 : _a.closed,
...node.attrs,
type: type != null ? type : "bullet"
},
content: node.content ? migrateNodes(node.content)[0] : void 0
},
content: node.content ? migrateNodes(node.content) : void 0
};
true
];
} else if (node.content) {
const [content, updated] = migrateNodes(node.content);
return [{ ...node, content }, updated];
} else {
return [node, false];
}
return {
...node,
content: node.content ? migrateNodes(node.content) : void 0
};
}
function migrateDocJSON(docJSON) {
return migrateNode(docJSON);
const [migrated, updated] = migrateNode(docJSON);
return updated ? migrated : null;
}

@@ -1061,0 +1070,0 @@

@@ -184,4 +184,10 @@ import { Attrs } from 'prosemirror-model';

/** @public */
export declare function migrateDocJSON(docJSON: ProsemirrorNodeJSON): ProsemirrorNodeJSON;
/**
* Migrate a ProseMirror document JSON object from the old list structure to the
* new. A new document JSON object is returned if the document is updated,
* otherwise `null` is returned.
*
* @public
*/
export declare function migrateDocJSON(docJSON: ProsemirrorNodeJSON): ProsemirrorNodeJSON | null;

@@ -188,0 +194,0 @@ /**

@@ -1017,14 +1017,18 @@ // src/commands/dedent-list.ts

const content = [];
let updated = false;
for (const node of nodes) {
if (node.type === "bullet_list" || node.type === "bulletList") {
updated = true;
for (const child of (_a = node.content) != null ? _a : []) {
content.push(migrateNode(child, { type: "bullet" }));
content.push(migrateNode(child, { type: "bullet" })[0]);
}
} else if (node.type === "ordered_list" || node.type === "orderedList") {
updated = true;
for (const child of (_b = node.content) != null ? _b : []) {
content.push(migrateNode(child, { type: "ordered" }));
content.push(migrateNode(child, { type: "ordered" })[0]);
}
} else if (node.type === "task_list" || node.type === "taskList") {
updated = true;
for (const child of (_c = node.content) != null ? _c : []) {
content.push(migrateNode(child, { type: "task" }));
content.push(migrateNode(child, { type: "task" })[0]);
}

@@ -1035,3 +1039,3 @@ } else {

}
return content;
return [content, updated];
}

@@ -1041,20 +1045,25 @@ function migrateNode(node, { type } = {}) {

if (node.type === "list_item" || node.type === "listItem" || node.type === "taskListItem") {
return {
...node,
type: "list",
attrs: {
collapsed: (_a = node.attrs) == null ? void 0 : _a.closed,
...node.attrs,
type: type != null ? type : "bullet"
return [
{
...node,
type: "list",
attrs: {
collapsed: (_a = node.attrs) == null ? void 0 : _a.closed,
...node.attrs,
type: type != null ? type : "bullet"
},
content: node.content ? migrateNodes(node.content)[0] : void 0
},
content: node.content ? migrateNodes(node.content) : void 0
};
true
];
} else if (node.content) {
const [content, updated] = migrateNodes(node.content);
return [{ ...node, content }, updated];
} else {
return [node, false];
}
return {
...node,
content: node.content ? migrateNodes(node.content) : void 0
};
}
function migrateDocJSON(docJSON) {
return migrateNode(docJSON);
const [migrated, updated] = migrateNode(docJSON);
return updated ? migrated : null;
}

@@ -1061,0 +1070,0 @@

3

package.json
{
"name": "prosemirror-flat-list",
"type": "module",
"version": "0.0.17",
"version": "0.0.18",
"description": "",

@@ -51,2 +51,3 @@ "author": "ocavue <ocavue@gmail.com>",

"dedent": "^0.7.0",
"execa": "^7.0.0",
"jest-prosemirror": "^2.1.1",

@@ -53,0 +54,0 @@ "jest-remirror": "^2.1.3",

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