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.2.1 to 0.3.0

69

./dist/prosemirror-flat-list.js

@@ -448,4 +448,6 @@ // src/commands/dedent-list.ts

return safeLift(tr, range);
} else if (isListsRange(range)) {
return dedentOutOfList(tr, range);
} else {
return dedentOutOfList(tr, range);
return safeLift(tr, range);
}

@@ -791,3 +793,2 @@ }

}
var joinListBackward = joinListUp;

@@ -1217,32 +1218,26 @@ // src/commands/keymap.ts

}
function createListInputRules() {
const bulletRegexp = /^\s?([*-])\s$/;
const orderedRegexp = /^\s?(\d+)\.\s$/;
const taskRegexp = /^\s?\[([\sXx]?)]\s$/;
const toggleRegexp = /^\s?>>\s$/;
return [
wrappingListInputRule(bulletRegexp, {
kind: "bullet",
var listInputRules = [
wrappingListInputRule(/^\s?([*-])\s$/, {
kind: "bullet",
collapsed: false
}),
wrappingListInputRule(/^\s?(\d+)\.\s$/, (match) => {
const order = parseInteger(match[1]);
return {
kind: "ordered",
collapsed: false,
order: order != null && order >= 2 ? order : null
};
}),
wrappingListInputRule(/^\s?\[([\sXx]?)]\s$/, (match) => {
return {
kind: "task",
checked: ["x", "X"].includes(match[1]),
collapsed: false
}),
wrappingListInputRule(orderedRegexp, (match) => {
const order = parseInteger(match[1]);
return {
kind: "ordered",
collapsed: false,
order: order != null && order >= 2 ? order : null
};
}),
wrappingListInputRule(taskRegexp, (match) => {
return {
kind: "task",
checked: ["x", "X"].includes(match[1]),
collapsed: false
};
}),
wrappingListInputRule(toggleRegexp, {
kind: "toggle"
})
];
}
};
}),
wrappingListInputRule(/^\s?>>\s$/, {
kind: "toggle"
})
];

@@ -1459,10 +1454,2 @@ // src/migrate.ts

// src/utils/always-true.ts
function alwaysTrue(func) {
return (...args) => {
func(...args);
return true;
};
}
// src/utils/range-to-string.ts

@@ -1475,3 +1462,2 @@ function rangeToString(range) {

ListDOMSerializer,
alwaysTrue,
backspaceCommand,

@@ -1482,3 +1468,2 @@ createDedentListCommand,

createListEventPlugin,
createListInputRules,
createListNodeView,

@@ -1510,5 +1495,5 @@ createListPlugins,

joinCollapsedListBackward,
joinListBackward,
joinListElements,
joinListUp,
listInputRules,
listKeymap,

@@ -1515,0 +1500,0 @@ listToDOM,

@@ -0,1 +1,2 @@

import type { Attrs } from 'prosemirror-model';
import { Command } from 'prosemirror-state';

@@ -21,11 +22,2 @@ import { DOMOutputSpec } from 'prosemirror-model';

/**
* Wrap the giving command function so that it always returns `true`. This is
* useful when we want pressing `Tab` and `Shift-Tab` won't blur the editor even
* if the keybinding command returns `false`
*
* @public
*/
export declare function alwaysTrue<T extends (...args: any[]) => boolean>(func: T): T;
/**
* Keybinding for `Backspace`. It's chained with following commands:

@@ -40,3 +32,4 @@ *

*
* @public
* @public @group Commands
*
*/

@@ -48,3 +41,3 @@ export declare const backspaceCommand: Command;

*
* @public
* @public @group Commands
*/

@@ -57,3 +50,3 @@ export declare function createDedentListCommand(options?: DedentListOptions): Command;

*
* @public
* @public @group Commands
*/

@@ -66,3 +59,3 @@ export declare function createIndentListCommand(options?: IndentListOptions): Command;

*
* @public
* @public @group Plugins
*/

@@ -74,3 +67,3 @@ export declare function createListClipboardPlugin(schema: Schema): Plugin_2;

*
* @public
* @public @group Plugins
*/

@@ -80,13 +73,6 @@ export declare function createListEventPlugin(): Plugin_2;

/**
* Return all input rules for lists.
*
* @public
*/
export declare function createListInputRules(): InputRule[];
/**
* A simple node view that is used to render the list node. It ensures that the
* list node get updated when its marker styling should changes.
*
* @public
* @public @group Plugins
*/

@@ -106,3 +92,3 @@ export declare const createListNodeView: NodeViewConstructor;

*
* @public
* @public @group Plugins
*/

@@ -116,3 +102,3 @@ export declare function createListPlugins({ schema }: {

*
* @public
* @public @group Plugins
*/

@@ -124,3 +110,3 @@ export declare function createListRenderingPlugin(): Plugin_2;

*
* @public
* @public @group Schema
*/

@@ -132,3 +118,4 @@ export declare function createListSpec(): NodeSpec;

*
* @public
* @public @group Commands
*
*/

@@ -140,3 +127,3 @@ export declare function createMoveListCommand(direction: 'up' | 'down'): Command;

*
* @public
* @public @group Schema
*/

@@ -151,3 +138,3 @@ export declare function createParseDomRules(): readonly ParseRule[];

*
* @public
* @public @group Plugins
*/

@@ -159,3 +146,4 @@ export declare function createSafariInputMethodWorkaroundPlugin(): Plugin_2;

*
* @public
* @public @group Commands
*
*/

@@ -165,5 +153,5 @@ export declare function createSplitListCommand(): Command;

/**
* @public
* Return a command function that toggle the `collapsed` attribute of the list node.
*
* Return a command function that toggle the `collapsed` attribute of the list node.
* @public @group Commands
*/

@@ -176,3 +164,3 @@ export declare function createToggleCollapsedCommand({ collapsed, isToggleable, }?: ToggleCollapsedOptions): Command;

*
* @public
* @public @group Commands
*/

@@ -231,3 +219,4 @@ export declare function createWrapInListCommand<T extends ListAttributes = ListAttributes>(

*
* @public
* @public @group Commands
*
*/

@@ -247,3 +236,3 @@ export declare const deleteCommand: Command;

*
* @public
* @public @group Commands
*/

@@ -271,3 +260,3 @@ export declare const enterCommand: Command;

*
* @public
* @public @group Schema
*/

@@ -323,3 +312,3 @@ export declare const flatListGroup = "flatList";

*
* @public
* @public @group Commands
*/

@@ -329,11 +318,2 @@ export declare const joinCollapsedListBackward: Command;

/**
* An alias to {@link joinListUp}
*
* @deprecated use joinListUp instead
*
* @public
*/
export declare const joinListBackward: Command;
/**
* Merge adjacent <ul> elements or adjacent <ol> elements into a single list element.

@@ -350,3 +330,3 @@ *

*
* @public
* @public @group Commands
*/

@@ -370,3 +350,3 @@ export declare const joinListUp: Command;

*
* @public
* @public @group Plugins
*/

@@ -384,2 +364,9 @@ export declare class ListDOMSerializer extends DOMSerializer {

/**
* All input rules for lists.
*
* @public @group Input Rules
*/
export declare const listInputRules: InputRule[];
/**
* Returns an object containing the keymap for the list commands.

@@ -393,3 +380,3 @@ *

*
* @public
* @public @group Commands
*/

@@ -407,3 +394,3 @@ export declare const listKeymap: {

*
* @public
* @public @group Schema
*/

@@ -415,3 +402,4 @@ export declare type ListKind = 'bullet' | 'ordered' | 'task' | 'toggle';

*
* @public */
* @public @group Schema
*/
export declare function listToDOM({ node, nativeList, getMarkers, getAttributes, }: ListToDOMOptions): DOMOutputSpec;

@@ -445,9 +433,2 @@

/**
* All the literal types
*
* @public
*/
export declare type Literal = string | number | boolean | undefined | null | void | object;
/**
* Migrate a ProseMirror document JSON object from the old list structure to the

@@ -461,12 +442,2 @@ * new. A new document JSON object is returned if the document is updated,

/**
* A JSON representation of a prosemirror Mark.
*
* @public
*/
export declare interface ObjectMark {
type: string;
attrs?: Record<string, Literal>;
}
/** @internal */

@@ -478,6 +449,9 @@ export declare function parseInteger(attr: string | null | undefined): number | null;

type: string;
marks?: Array<ObjectMark | string>;
marks?: Array<{
type: string;
attrs?: Attrs;
} | string>;
text?: string;
content?: ProsemirrorNodeJSON[];
attrs?: Record<string, Literal>;
attrs?: Attrs;
}

@@ -496,3 +470,4 @@

*
* @public
* @public @group Commands
*
*/

@@ -535,3 +510,3 @@ export declare const protectCollapsed: Command;

*
* @public
* @public @group Input Rules
*/

@@ -538,0 +513,0 @@ export declare function wrappingListInputRule<T extends ListAttributes = ListAttributes>(regexp: RegExp, getAttrs: T | ((matches: RegExpMatchArray) => T)): InputRule;

@@ -448,4 +448,6 @@ // src/commands/dedent-list.ts

return safeLift(tr, range);
} else if (isListsRange(range)) {
return dedentOutOfList(tr, range);
} else {
return dedentOutOfList(tr, range);
return safeLift(tr, range);
}

@@ -791,3 +793,2 @@ }

}
var joinListBackward = joinListUp;

@@ -1217,32 +1218,26 @@ // src/commands/keymap.ts

}
function createListInputRules() {
const bulletRegexp = /^\s?([*-])\s$/;
const orderedRegexp = /^\s?(\d+)\.\s$/;
const taskRegexp = /^\s?\[([\sXx]?)]\s$/;
const toggleRegexp = /^\s?>>\s$/;
return [
wrappingListInputRule(bulletRegexp, {
kind: "bullet",
var listInputRules = [
wrappingListInputRule(/^\s?([*-])\s$/, {
kind: "bullet",
collapsed: false
}),
wrappingListInputRule(/^\s?(\d+)\.\s$/, (match) => {
const order = parseInteger(match[1]);
return {
kind: "ordered",
collapsed: false,
order: order != null && order >= 2 ? order : null
};
}),
wrappingListInputRule(/^\s?\[([\sXx]?)]\s$/, (match) => {
return {
kind: "task",
checked: ["x", "X"].includes(match[1]),
collapsed: false
}),
wrappingListInputRule(orderedRegexp, (match) => {
const order = parseInteger(match[1]);
return {
kind: "ordered",
collapsed: false,
order: order != null && order >= 2 ? order : null
};
}),
wrappingListInputRule(taskRegexp, (match) => {
return {
kind: "task",
checked: ["x", "X"].includes(match[1]),
collapsed: false
};
}),
wrappingListInputRule(toggleRegexp, {
kind: "toggle"
})
];
}
};
}),
wrappingListInputRule(/^\s?>>\s$/, {
kind: "toggle"
})
];

@@ -1459,10 +1454,2 @@ // src/migrate.ts

// src/utils/always-true.ts
function alwaysTrue(func) {
return (...args) => {
func(...args);
return true;
};
}
// src/utils/range-to-string.ts

@@ -1475,3 +1462,2 @@ function rangeToString(range) {

ListDOMSerializer,
alwaysTrue,
backspaceCommand,

@@ -1482,3 +1468,2 @@ createDedentListCommand,

createListEventPlugin,
createListInputRules,
createListNodeView,

@@ -1510,5 +1495,5 @@ createListPlugins,

joinCollapsedListBackward,
joinListBackward,
joinListElements,
joinListUp,
listInputRules,
listKeymap,

@@ -1515,0 +1500,0 @@ listToDOM,

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

@@ -52,4 +52,4 @@ "author": "ocavue <ocavue@gmail.com>",

"@types/dedent": "^0.7.0",
"@types/node": "^18.14.2",
"@vitest/coverage-c8": "^0.29.1",
"@types/node": "^18.14.6",
"@vitest/coverage-c8": "^0.29.2",
"dedent": "^0.7.0",

@@ -74,3 +74,3 @@ "execa": "^7.0.0",

"vite": "^4.1.4",
"vitest": "^0.29.1"
"vitest": "^0.29.2"
},

@@ -77,0 +77,0 @@ "typedoc": {

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