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.12 to 0.0.13

10

dist/index.d.ts

@@ -1,4 +0,4 @@

import { Command, Plugin } from 'prosemirror-state';
import { Command, EditorState, Transaction, Plugin } from 'prosemirror-state';
import { ProsemirrorNode } from '@remirror/core';
import { Attrs, NodeRange, Schema, ParseRule, NodeSpec, Node, DOMOutputSpec, NodeType, DOMSerializer, Fragment } from 'prosemirror-model';
import { ProsemirrorNode } from '@remirror/core';
import { EditorView, NodeViewConstructor } from 'prosemirror-view';

@@ -14,2 +14,6 @@ import { InputRule } from 'prosemirror-inputrules';

declare function createSplitListCommand(): Command;
/**
* @internal
*/
declare function doSplitList(state: EditorState, listNode: ProsemirrorNode, dispatch?: (tr: Transaction) => void): boolean;

@@ -92,2 +96,2 @@ type ListType = 'bullet' | 'ordered' | 'task' | 'toggle';

export { ListAttributes, ListClickHandler, ListDOMSerializer, ListType, MarkerToDOM, alwaysTrue, createDedentListCommand, createIndentListCommand, createListInputRules, createListNodeView, createListPlugin, createListSpec, createMoveListCommand, createParseDomRules, createSplitListCommand, createWrapInListCommand, defaultListClickHandler, defaultMarkerToDOM, flatListGroup, getListType, handleListMarkerMouseDown, isListNode, isListType, listToDOM, migrateDocJSON, wrappingListInputRule };
export { ListAttributes, ListClickHandler, ListDOMSerializer, ListType, MarkerToDOM, alwaysTrue, createDedentListCommand, createIndentListCommand, createListInputRules, createListNodeView, createListPlugin, createListSpec, createMoveListCommand, createParseDomRules, createSplitListCommand, createWrapInListCommand, defaultListClickHandler, defaultMarkerToDOM, doSplitList, flatListGroup, getListType, handleListMarkerMouseDown, isListNode, isListType, listToDOM, migrateDocJSON, wrappingListInputRule };

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

// src/commands/enter-without-lift.ts
import {
chainCommands,
createParagraphNear,
newlineInCode,
splitBlock
} from "prosemirror-commands";
var enterWithoutLift = chainCommands(
newlineInCode,
createParagraphNear,
splitBlock
);
// src/commands/split-list.ts
function createSplitListCommand() {
const splitListCommand = (state, dispatch, view) => {
const splitListCommand = (state, dispatch) => {
const { selection } = state;

@@ -684,28 +671,41 @@ const { $from, $to } = selection;

}
if ($from.index(-1) !== 0) {
return enterWithoutLift(state, dispatch, view);
const parent = $from.parent;
const indexInList = $from.index(-1);
const parentEmpty = parent.content.size === 0;
if (indexInList === 0) {
if (parentEmpty) {
return false;
} else {
return doSplitList(state, listNode, dispatch);
}
} else {
if (parentEmpty) {
return doSplitList(state, listNode, dispatch);
} else {
return false;
}
}
if ($from.parent.content.size === 0) {
return false;
}
const tr = state.tr;
tr.delete($from.pos, $to.pos);
const nextType = $to.pos === $from.end() ? listNode.contentMatchAt(0).defaultType : void 0;
const typesAfter = [
{
type: getListType(state.schema),
attrs: {
type: listNode.attrs.type
}
},
nextType ? { type: nextType } : null
];
if (!canSplit(tr.doc, $from.pos, 2, typesAfter)) {
return false;
}
dispatch == null ? void 0 : dispatch(tr.split($from.pos, 2, typesAfter).scrollIntoView());
return true;
};
return splitListCommand;
}
function doSplitList(state, listNode, dispatch) {
const tr = state.tr;
const { $from, $to } = tr.selection;
tr.delete($from.pos, $to.pos);
const nextType = $to.pos === $from.end() ? listNode.contentMatchAt(0).defaultType : void 0;
const typesAfter = [
{
type: getListType(state.schema),
attrs: {
type: listNode.attrs.type
}
},
nextType ? { type: nextType } : null
];
if (!canSplit(tr.doc, $from.pos, 2, typesAfter)) {
return false;
}
dispatch == null ? void 0 : dispatch(tr.split($from.pos, 2, typesAfter).scrollIntoView());
return true;
}

@@ -893,3 +893,4 @@ // src/commands/wrap-in-list.ts

}
function migrateNode(node, attrs) {
function migrateNode(node, { type } = {}) {
var _a;
if (node.type === "list_item" || node.type === "listItem" || node.type === "taskListItem") {

@@ -900,5 +901,5 @@ return {

attrs: {
collapsed: (_a = node.attrs) == null ? void 0 : _a.closed,
...node.attrs,
type: "bullet",
...attrs
type: type != null ? type : "bullet"
},

@@ -1013,2 +1014,3 @@ content: node.content ? migrateNodes(node.content) : void 0

defaultMarkerToDOM,
doSplitList,
flatListGroup,

@@ -1015,0 +1017,0 @@ getListType,

{
"name": "prosemirror-flat-list",
"type": "module",
"version": "0.0.12",
"version": "0.0.13",
"description": "",

@@ -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