prosemirror-flat-list
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -1418,2 +1418,15 @@ // src/commands/dedent-list.ts | ||
// src/utils/unwrap-list-slice.ts | ||
import { Slice as Slice4 } from "prosemirror-model"; | ||
function unwrapListSlice(slice) { | ||
while (slice.openStart >= 2 && slice.openEnd >= 2 && slice.content.childCount === 1 && isListNode(slice.content.child(0))) { | ||
slice = new Slice4( | ||
slice.content.child(0).content, | ||
slice.openStart - 1, | ||
slice.openEnd - 1 | ||
); | ||
} | ||
return slice; | ||
} | ||
// src/plugins/clipboard.ts | ||
@@ -1423,3 +1436,4 @@ function createListClipboardPlugin(schema) { | ||
props: { | ||
clipboardSerializer: ListDOMSerializer.fromSchema(schema) | ||
clipboardSerializer: ListDOMSerializer.fromSchema(schema), | ||
transformCopied: unwrapListSlice | ||
} | ||
@@ -1557,3 +1571,4 @@ }); | ||
setSafeSelection, | ||
unwrapListSlice, | ||
wrappingListInputRule | ||
}; |
@@ -19,2 +19,3 @@ import type { Attrs } from 'prosemirror-model'; | ||
import { Schema } from 'prosemirror-model'; | ||
import { Slice } from 'prosemirror-model'; | ||
import { Transaction } from 'prosemirror-state'; | ||
@@ -477,2 +478,10 @@ | ||
/** | ||
* Reduce the open depth of a slice if it only contains a single list node. This | ||
* will improve the copy/paste experience. | ||
* | ||
* @internal | ||
*/ | ||
export declare function unwrapListSlice(slice: Slice): Slice; | ||
/** | ||
* Build an input rule for automatically wrapping a textblock into a list node | ||
@@ -479,0 +488,0 @@ * when a given string is typed. |
@@ -1418,2 +1418,15 @@ // src/commands/dedent-list.ts | ||
// src/utils/unwrap-list-slice.ts | ||
import { Slice as Slice4 } from "prosemirror-model"; | ||
function unwrapListSlice(slice) { | ||
while (slice.openStart >= 2 && slice.openEnd >= 2 && slice.content.childCount === 1 && isListNode(slice.content.child(0))) { | ||
slice = new Slice4( | ||
slice.content.child(0).content, | ||
slice.openStart - 1, | ||
slice.openEnd - 1 | ||
); | ||
} | ||
return slice; | ||
} | ||
// src/plugins/clipboard.ts | ||
@@ -1423,3 +1436,4 @@ function createListClipboardPlugin(schema) { | ||
props: { | ||
clipboardSerializer: ListDOMSerializer.fromSchema(schema) | ||
clipboardSerializer: ListDOMSerializer.fromSchema(schema), | ||
transformCopied: unwrapListSlice | ||
} | ||
@@ -1557,3 +1571,4 @@ }); | ||
setSafeSelection, | ||
unwrapListSlice, | ||
wrappingListInputRule | ||
}; |
{ | ||
"name": "prosemirror-flat-list", | ||
"type": "module", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162385
5129