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.1.5 to 0.2.0

94

./dist/prosemirror-flat-list.js

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

// src/utils/auto-join-list.ts
// src/utils/auto-fix-list.ts
import { canJoin, canSplit } from "prosemirror-transform";

@@ -216,3 +216,3 @@

// src/utils/auto-join-list.ts
// src/utils/auto-fix-list.ts
function* getTransactionRanges(tr) {

@@ -269,3 +269,3 @@ const ranges = [];

}
function autoJoinList(tr) {
function fixList(tr) {
const ranges = getTransactionRanges(tr);

@@ -286,11 +286,11 @@ const joinable = findBoundaries(ranges.next().value, tr.doc, isListJoinable);

}
function withAutoJoinList(command) {
const commandWithAutoJoinList = (state, dispatch, view) => {
function withAutoFixList(command) {
const wrappedCommand = (state, dispatch, view) => {
return command(
state,
dispatch && ((tr) => dispatch(autoJoinList(tr))),
dispatch && ((tr) => dispatch(fixList(tr))),
view
);
};
return commandWithAutoJoinList;
return wrappedCommand;
}

@@ -403,3 +403,3 @@

};
return withAutoJoinList(dedentListCommand);
return withAutoFixList(dedentListCommand);
}

@@ -590,3 +590,3 @@ function dedentRange(range, tr, startBoundary, endBoundary) {

};
return withAutoJoinList(indentListCommand);
return withAutoFixList(indentListCommand);
}

@@ -825,3 +825,3 @@ function indentRange(range, tr, startBoundary, endBoundary) {

};
return withAutoJoinList(splitListCommand);
return withAutoFixList(splitListCommand);
}

@@ -902,3 +902,3 @@ function doSplitList(state, listNode, dispatch) {

const tr = state.tr;
if (doMoveList(state.tr, direction, true, !!dispatch)) {
if (doMoveList(tr, direction, true, !!dispatch)) {
dispatch == null ? void 0 : dispatch(tr);

@@ -909,3 +909,3 @@ return true;

};
return withAutoJoinList(moveList);
return withAutoFixList(moveList);
}

@@ -1262,15 +1262,5 @@ function doMoveList(tr, direction, canDedent, dispatch) {

// src/plugin.ts
// src/plugins/clipboard.ts
import { Plugin } from "prosemirror-state";
import { Decoration, DecorationSet } from "prosemirror-view";
// src/browser.ts
var nav = typeof navigator != "undefined" ? navigator : null;
var agent = nav && nav.userAgent || "";
var ie_edge = /Edge\/(\d+)/.exec(agent);
var ie_upto10 = /MSIE \d/.exec(agent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
var ie = !!(ie_upto10 || ie_11up || ie_edge);
var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
// src/utils/list-serializer.ts

@@ -1316,10 +1306,28 @@ import {

// src/plugin.ts
function createListPlugin(schema) {
// src/plugins/clipboard.ts
function createListClipboardPlugin(schema) {
return new Plugin({
props: {
clipboardSerializer: ListDOMSerializer.fromSchema(schema)
}
});
}
// src/plugins/event.ts
import { Plugin as Plugin2 } from "prosemirror-state";
function createListEventPlugin() {
return new Plugin2({
props: {
handleDOMEvents: {
mousedown: (view, event) => handleListMarkerMouseDown({ view, event })
},
clipboardSerializer: ListDOMSerializer.fromSchema(schema),
}
}
});
}
// src/plugins/rendering.ts
import { Plugin as Plugin3 } from "prosemirror-state";
function createListRenderingPlugin() {
return new Plugin3({
props: {
nodeViews: {

@@ -1331,2 +1339,17 @@ list: createListNodeView

}
// src/plugins/safari-workaround.ts
import { Plugin as Plugin4 } from "prosemirror-state";
import { Decoration, DecorationSet } from "prosemirror-view";
// src/utils/browser.ts
var nav = typeof navigator != "undefined" ? navigator : null;
var agent = nav && nav.userAgent || "";
var ie_edge = /Edge\/(\d+)/.exec(agent);
var ie_upto10 = /MSIE \d/.exec(agent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
var ie = !!(ie_upto10 || ie_11up || ie_edge);
var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
// src/plugins/safari-workaround.ts
function createSafariInputMethodWorkaroundPlugin() {

@@ -1353,3 +1376,3 @@ let view = null;

};
return new Plugin({
return new Plugin4({
props: {

@@ -1365,2 +1388,12 @@ decorations: safari ? createDecorations : void 0

// src/plugins/index.ts
function createListPlugins({ schema }) {
return [
createListEventPlugin(),
createListRenderingPlugin(),
createListClipboardPlugin(schema),
createSafariInputMethodWorkaroundPlugin()
];
}
// src/utils/always-true.ts

@@ -1385,5 +1418,8 @@ function alwaysTrue(func) {

createIndentListCommand,
createListClipboardPlugin,
createListEventPlugin,
createListInputRules,
createListNodeView,
createListPlugin,
createListPlugins,
createListRenderingPlugin,
createListSpec,

@@ -1390,0 +1426,0 @@ createMoveListCommand,

@@ -58,2 +58,17 @@ import { Command } from 'prosemirror-state';

/**
* Serialize list nodes into native HTML list elements (i.e. `<ul>`, `<ol>`) to
* clipboard. See {@link ListDOMSerializer}.
*
* @public
*/
export declare function createListClipboardPlugin(schema: Schema): Plugin_2;
/**
* Handle DOM events for list.
*
* @public
*/
export declare function createListEventPlugin(): Plugin_2;
/**
* Return all input rules for lists.

@@ -74,17 +89,24 @@ *

/**
* Return a ProseMirror plugin for list.
* This function returns an array of plugins that are required for list to work.
*
* @remarks
* The plugins are shown below. You can pick and choose which plugins you want
* to use if you want to customize some behavior.
*
* This plugin is responsible for the following:
* - {@link createListEventPlugin}
* - {@link createListRenderingPlugin}
* - {@link createListClipboardPlugin}
* - {@link createSafariInputMethodWorkaroundPlugin}
*
* 1. Handling DOM events for clicking on list markers.
* 2. Serialize list nodes into native HTML list elements (i.e. `<ul>`, `<ol>`)
* to clipboard. See {@link ListDOMSerializer}.
* 3. Create a custom node view for list nodes. See {@link createListNodeView}.
* @public
*/
export declare function createListPlugins({ schema }: {
schema: Schema;
}): Plugin_2[];
/**
* Handle the list node rendering.
*
*
* @public
*/
export declare function createListPlugin(schema: Schema): Plugin_2;
export declare function createListRenderingPlugin(): Plugin_2;

@@ -91,0 +113,0 @@ /**

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

// src/utils/auto-join-list.ts
// src/utils/auto-fix-list.ts
import { canJoin, canSplit } from "prosemirror-transform";

@@ -216,3 +216,3 @@

// src/utils/auto-join-list.ts
// src/utils/auto-fix-list.ts
function* getTransactionRanges(tr) {

@@ -269,3 +269,3 @@ const ranges = [];

}
function autoJoinList(tr) {
function fixList(tr) {
const ranges = getTransactionRanges(tr);

@@ -286,11 +286,11 @@ const joinable = findBoundaries(ranges.next().value, tr.doc, isListJoinable);

}
function withAutoJoinList(command) {
const commandWithAutoJoinList = (state, dispatch, view) => {
function withAutoFixList(command) {
const wrappedCommand = (state, dispatch, view) => {
return command(
state,
dispatch && ((tr) => dispatch(autoJoinList(tr))),
dispatch && ((tr) => dispatch(fixList(tr))),
view
);
};
return commandWithAutoJoinList;
return wrappedCommand;
}

@@ -403,3 +403,3 @@

};
return withAutoJoinList(dedentListCommand);
return withAutoFixList(dedentListCommand);
}

@@ -590,3 +590,3 @@ function dedentRange(range, tr, startBoundary, endBoundary) {

};
return withAutoJoinList(indentListCommand);
return withAutoFixList(indentListCommand);
}

@@ -825,3 +825,3 @@ function indentRange(range, tr, startBoundary, endBoundary) {

};
return withAutoJoinList(splitListCommand);
return withAutoFixList(splitListCommand);
}

@@ -902,3 +902,3 @@ function doSplitList(state, listNode, dispatch) {

const tr = state.tr;
if (doMoveList(state.tr, direction, true, !!dispatch)) {
if (doMoveList(tr, direction, true, !!dispatch)) {
dispatch == null ? void 0 : dispatch(tr);

@@ -909,3 +909,3 @@ return true;

};
return withAutoJoinList(moveList);
return withAutoFixList(moveList);
}

@@ -1262,15 +1262,5 @@ function doMoveList(tr, direction, canDedent, dispatch) {

// src/plugin.ts
// src/plugins/clipboard.ts
import { Plugin } from "prosemirror-state";
import { Decoration, DecorationSet } from "prosemirror-view";
// src/browser.ts
var nav = typeof navigator != "undefined" ? navigator : null;
var agent = nav && nav.userAgent || "";
var ie_edge = /Edge\/(\d+)/.exec(agent);
var ie_upto10 = /MSIE \d/.exec(agent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
var ie = !!(ie_upto10 || ie_11up || ie_edge);
var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
// src/utils/list-serializer.ts

@@ -1316,10 +1306,28 @@ import {

// src/plugin.ts
function createListPlugin(schema) {
// src/plugins/clipboard.ts
function createListClipboardPlugin(schema) {
return new Plugin({
props: {
clipboardSerializer: ListDOMSerializer.fromSchema(schema)
}
});
}
// src/plugins/event.ts
import { Plugin as Plugin2 } from "prosemirror-state";
function createListEventPlugin() {
return new Plugin2({
props: {
handleDOMEvents: {
mousedown: (view, event) => handleListMarkerMouseDown({ view, event })
},
clipboardSerializer: ListDOMSerializer.fromSchema(schema),
}
}
});
}
// src/plugins/rendering.ts
import { Plugin as Plugin3 } from "prosemirror-state";
function createListRenderingPlugin() {
return new Plugin3({
props: {
nodeViews: {

@@ -1331,2 +1339,17 @@ list: createListNodeView

}
// src/plugins/safari-workaround.ts
import { Plugin as Plugin4 } from "prosemirror-state";
import { Decoration, DecorationSet } from "prosemirror-view";
// src/utils/browser.ts
var nav = typeof navigator != "undefined" ? navigator : null;
var agent = nav && nav.userAgent || "";
var ie_edge = /Edge\/(\d+)/.exec(agent);
var ie_upto10 = /MSIE \d/.exec(agent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
var ie = !!(ie_upto10 || ie_11up || ie_edge);
var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
// src/plugins/safari-workaround.ts
function createSafariInputMethodWorkaroundPlugin() {

@@ -1353,3 +1376,3 @@ let view = null;

};
return new Plugin({
return new Plugin4({
props: {

@@ -1365,2 +1388,12 @@ decorations: safari ? createDecorations : void 0

// src/plugins/index.ts
function createListPlugins({ schema }) {
return [
createListEventPlugin(),
createListRenderingPlugin(),
createListClipboardPlugin(schema),
createSafariInputMethodWorkaroundPlugin()
];
}
// src/utils/always-true.ts

@@ -1385,5 +1418,8 @@ function alwaysTrue(func) {

createIndentListCommand,
createListClipboardPlugin,
createListEventPlugin,
createListInputRules,
createListNodeView,
createListPlugin,
createListPlugins,
createListRenderingPlugin,
createListSpec,

@@ -1390,0 +1426,0 @@ createMoveListCommand,

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

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

@@ -15,4 +15,4 @@ # prosemirror-flat-list

## API docs
## [API Documentation](https://github.com/ocavue/prosemirror-flat-list/blob/master/docs/modules/prosemirror_flat_list.md)
For all public API, please see the [API docs](https://github.com/ocavue/prosemirror-flat-list/blob/master/docs/modules/prosemirror_flat_list.md)
## [Changelog](https://github.com/ocavue/prosemirror-flat-list/blob/master/packages/core/CHANGELOG.md)

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