prosemirror-flat-list
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -70,6 +70,11 @@ // src/commands/dedent-list.ts | ||
tag: "ol > li", | ||
getAttrs: (_element) => { | ||
getAttrs: (element) => { | ||
if (typeof element === "string") { | ||
return { | ||
type: "ordered" | ||
}; | ||
} | ||
return { | ||
type: "ordered" | ||
// ...extra.parse(element), | ||
type: "ordered", | ||
order: parseInteger(element.getAttribute("data-list-order")) | ||
}; | ||
@@ -83,3 +88,7 @@ } | ||
// src/schema/to-dom.ts | ||
function listToDOM(node, nativeList, markerToDOM = defaultMarkerToDOM) { | ||
function listToDOM({ | ||
node, | ||
nativeList = false, | ||
markerToDOM = defaultMarkerToDOM | ||
}) { | ||
var _a; | ||
@@ -96,3 +105,4 @@ const attrs = node.attrs; | ||
"data-list-collapsed": attrs.collapsed ? "" : void 0, | ||
"data-list-collapsable": node.childCount >= 2 ? "" : void 0 | ||
"data-list-collapsable": node.childCount >= 2 ? "" : void 0, | ||
style: attrs.order != null ? `counter-set: prosemirror-flat-list-counter ${attrs.order};` : void 0 | ||
}; | ||
@@ -152,3 +162,3 @@ const contentContainer = ["div", { class: "list-content" }, 0]; | ||
}, | ||
counter: { | ||
order: { | ||
default: null | ||
@@ -164,3 +174,3 @@ }, | ||
toDOM: (node) => { | ||
return listToDOM(node, false); | ||
return listToDOM({ node }); | ||
}, | ||
@@ -716,13 +726,2 @@ parseDOM: createParseDomRules() | ||
// src/commands/split-list.ts | ||
import { chainCommands as chainCommands2 } from "prosemirror-commands"; | ||
import { Selection } from "prosemirror-state"; | ||
import { canSplit as canSplit2 } from "prosemirror-transform"; | ||
// src/utils/is-block-node-selection.ts | ||
function isBlockNodeSelection(selection) { | ||
var _a, _b; | ||
return Boolean((_b = (_a = selection.node) == null ? void 0 : _a.type) == null ? void 0 : _b.isBlock); | ||
} | ||
// src/commands/protect-collapsed.ts | ||
@@ -753,2 +752,13 @@ var protectCollapsed = (state, dispatch) => { | ||
// src/commands/split-list.ts | ||
import { chainCommands as chainCommands2 } from "prosemirror-commands"; | ||
import { Selection } from "prosemirror-state"; | ||
import { canSplit as canSplit2 } from "prosemirror-transform"; | ||
// src/utils/is-block-node-selection.ts | ||
function isBlockNodeSelection(selection) { | ||
var _a, _b; | ||
return Boolean((_b = (_a = selection.node) == null ? void 0 : _a.type) == null ? void 0 : _b.isBlock); | ||
} | ||
// src/commands/split-list.ts | ||
function createSplitListCommand() { | ||
@@ -822,4 +832,4 @@ const splitListCommand = (state, dispatch) => { | ||
// src/commands/wrap-in-list.ts | ||
import { NodeRange as NodeRange4 } from "prosemirror-model"; | ||
import { findWrapping } from "prosemirror-transform"; | ||
import { NodeRange as NodeRange4 } from "prosemirror-model"; | ||
@@ -1059,3 +1069,3 @@ // src/utils/set-node-attributes.ts | ||
const nodes = DOMSerializer2.nodesFromSchema(schema); | ||
return { ...nodes, list: (node) => listToDOM(node, true) }; | ||
return { ...nodes, list: (node) => listToDOM({ node, nativeList: true }) }; | ||
} | ||
@@ -1062,0 +1072,0 @@ serializeFragment(fragment, options, target) { |
@@ -28,6 +28,15 @@ import { Attrs } from 'prosemirror-model'; | ||
/** @public */ | ||
/** | ||
* Returns a command function that decreases the indentation of selected list nodes. | ||
* | ||
* @public | ||
*/ | ||
export declare function createDedentListCommand(): Command; | ||
/** @public */ | ||
/** | ||
* Returns a command function that increases the indentation of selected list | ||
* nodes. | ||
* | ||
* @public | ||
*/ | ||
export declare function createIndentListCommand(): Command; | ||
@@ -52,3 +61,7 @@ | ||
/** @public */ | ||
/** | ||
* Returns a command function that moves up or down selected list nodes. | ||
* | ||
* @public | ||
*/ | ||
export declare function createMoveListCommand(direction: 'up' | 'down'): Command; | ||
@@ -59,6 +72,15 @@ | ||
/** @public */ | ||
/** | ||
* Returns a command that split the current list node. | ||
* | ||
* @public | ||
*/ | ||
export declare function createSplitListCommand(): Command; | ||
/** @public */ | ||
/** | ||
* Returns a command function that wraps the selection in a list with the given | ||
* type an attributes. | ||
* | ||
* @public | ||
*/ | ||
export declare function createWrapInListCommand<T extends Attrs = ListAttributes>(getAttrs: T | ((range: NodeRange) => T | null)): Command; | ||
@@ -69,3 +91,3 @@ | ||
/** @public */ | ||
/** @internal */ | ||
export declare const defaultMarkerToDOM: MarkerToDOM; | ||
@@ -123,5 +145,12 @@ | ||
/** @public */ | ||
export declare function listToDOM(node: Node_2, nativeList: boolean, markerToDOM?: MarkerToDOM): DOMOutputSpec; | ||
export declare function listToDOM({ node, nativeList, markerToDOM, }: ListToDOMProps): DOMOutputSpec; | ||
/** @public */ | ||
export declare interface ListToDOMProps { | ||
node: Node_2; | ||
nativeList?: boolean; | ||
markerToDOM?: MarkerToDOM; | ||
} | ||
/** @public */ | ||
export declare type ListType = 'bullet' | 'ordered' | 'task' | 'toggle'; | ||
@@ -128,0 +157,0 @@ |
@@ -70,6 +70,11 @@ // src/commands/dedent-list.ts | ||
tag: "ol > li", | ||
getAttrs: (_element) => { | ||
getAttrs: (element) => { | ||
if (typeof element === "string") { | ||
return { | ||
type: "ordered" | ||
}; | ||
} | ||
return { | ||
type: "ordered" | ||
// ...extra.parse(element), | ||
type: "ordered", | ||
order: parseInteger(element.getAttribute("data-list-order")) | ||
}; | ||
@@ -83,3 +88,7 @@ } | ||
// src/schema/to-dom.ts | ||
function listToDOM(node, nativeList, markerToDOM = defaultMarkerToDOM) { | ||
function listToDOM({ | ||
node, | ||
nativeList = false, | ||
markerToDOM = defaultMarkerToDOM | ||
}) { | ||
var _a; | ||
@@ -96,3 +105,4 @@ const attrs = node.attrs; | ||
"data-list-collapsed": attrs.collapsed ? "" : void 0, | ||
"data-list-collapsable": node.childCount >= 2 ? "" : void 0 | ||
"data-list-collapsable": node.childCount >= 2 ? "" : void 0, | ||
style: attrs.order != null ? `counter-set: prosemirror-flat-list-counter ${attrs.order};` : void 0 | ||
}; | ||
@@ -152,3 +162,3 @@ const contentContainer = ["div", { class: "list-content" }, 0]; | ||
}, | ||
counter: { | ||
order: { | ||
default: null | ||
@@ -164,3 +174,3 @@ }, | ||
toDOM: (node) => { | ||
return listToDOM(node, false); | ||
return listToDOM({ node }); | ||
}, | ||
@@ -716,13 +726,2 @@ parseDOM: createParseDomRules() | ||
// src/commands/split-list.ts | ||
import { chainCommands as chainCommands2 } from "prosemirror-commands"; | ||
import { Selection } from "prosemirror-state"; | ||
import { canSplit as canSplit2 } from "prosemirror-transform"; | ||
// src/utils/is-block-node-selection.ts | ||
function isBlockNodeSelection(selection) { | ||
var _a, _b; | ||
return Boolean((_b = (_a = selection.node) == null ? void 0 : _a.type) == null ? void 0 : _b.isBlock); | ||
} | ||
// src/commands/protect-collapsed.ts | ||
@@ -753,2 +752,13 @@ var protectCollapsed = (state, dispatch) => { | ||
// src/commands/split-list.ts | ||
import { chainCommands as chainCommands2 } from "prosemirror-commands"; | ||
import { Selection } from "prosemirror-state"; | ||
import { canSplit as canSplit2 } from "prosemirror-transform"; | ||
// src/utils/is-block-node-selection.ts | ||
function isBlockNodeSelection(selection) { | ||
var _a, _b; | ||
return Boolean((_b = (_a = selection.node) == null ? void 0 : _a.type) == null ? void 0 : _b.isBlock); | ||
} | ||
// src/commands/split-list.ts | ||
function createSplitListCommand() { | ||
@@ -822,4 +832,4 @@ const splitListCommand = (state, dispatch) => { | ||
// src/commands/wrap-in-list.ts | ||
import { NodeRange as NodeRange4 } from "prosemirror-model"; | ||
import { findWrapping } from "prosemirror-transform"; | ||
import { NodeRange as NodeRange4 } from "prosemirror-model"; | ||
@@ -1059,3 +1069,3 @@ // src/utils/set-node-attributes.ts | ||
const nodes = DOMSerializer2.nodesFromSchema(schema); | ||
return { ...nodes, list: (node) => listToDOM(node, true) }; | ||
return { ...nodes, list: (node) => listToDOM({ node, nativeList: true }) }; | ||
} | ||
@@ -1062,0 +1072,0 @@ serializeFragment(fragment, options, target) { |
{ | ||
"name": "prosemirror-flat-list", | ||
"type": "module", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "", | ||
@@ -56,3 +56,3 @@ "author": "ocavue <ocavue@gmail.com>", | ||
"postcss": "^8.4.21", | ||
"postcss-nesting": "^10.2.0", | ||
"postcss-nesting": "^11.2.1", | ||
"react": "^18.2.0", | ||
@@ -71,2 +71,5 @@ "react-dom": "^18.2.0", | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts" | ||
}, | ||
"scripts": { | ||
@@ -73,0 +76,0 @@ "dev": "tsup --watch", |
@@ -17,2 +17,2 @@ # prosemirror-flat-list | ||
For all public API, please see the [API docs](https://paka.dev/npm/prosemirror-flat-list) | ||
For all public API, please see the [API docs](https://github.com/ocavue/prosemirror-flat-list/blob/master/docs/modules/prosemirror_flat_list.md) |
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
112688
3593