@remirror/extension-list
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -1,2 +0,2 @@ | ||
var _initClass, _ListItemExtension, _dec, _dec2, _dec3, _initProto, _initClass2, _BulletListExtension, _dec4, _dec5, _dec6, _initProto2, _initClass3, _OrderedListExtension, _dec7, _dec8, _dec9, _initProto3, _dec10, _initProto4, _dec11, _dec12, _initProto5; | ||
var _initClass, _ListItemExtension, _dec, _dec2, _dec3, _initProto, _class, _initClass2, _BulletListExtension, _dec4, _dec5, _dec6, _initProto2, _class2, _initClass3, _OrderedListExtension, _dec7, _dec8, _dec9, _initProto3, _class3, _dec10, _initProto4, _class4, _dec11, _dec12, _initProto5, _class5; | ||
function createAddInitializerMethod(e, t) { return function (r) { assertNotFinished(t, "addInitializer"), assertCallable(r, "An initializer"), e.push(r); }; } | ||
@@ -35,6 +35,8 @@ function assertInstanceIfPrivate(e, t) { if (!e(t)) throw new TypeError("Attempted to access private element on non-instance"); } | ||
function isList(type) { | ||
return !!type.spec.group?.includes(ExtensionTag.ListContainerNode); | ||
var _type$spec$group; | ||
return !!((_type$spec$group = type.spec.group) !== null && _type$spec$group !== void 0 && _type$spec$group.includes(ExtensionTag.ListContainerNode)); | ||
} | ||
function isListItem(type) { | ||
return !!type.spec.group?.includes(ExtensionTag.ListItemNode); | ||
var _type$spec$group2; | ||
return !!((_type$spec$group2 = type.spec.group) !== null && _type$spec$group2 !== void 0 && _type$spec$group2.includes(ExtensionTag.ListItemNode)); | ||
} | ||
@@ -78,7 +80,7 @@ function isListNode(node) { | ||
if (listType.validContent(parentList.node.content)) { | ||
dispatch?.(tr.setNodeMarkup(parentList.pos, listType)); | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(parentList.pos, listType)); | ||
return true; | ||
} | ||
if (deepChangeListType(tr, parentList, listType, itemType)) { | ||
dispatch?.(tr.scrollIntoView()); | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.scrollIntoView()); | ||
return true; | ||
@@ -122,2 +124,3 @@ } | ||
if (dispatch) { | ||
var _listItemType$content; | ||
const keepItem = $from.index(-1) > 0; | ||
@@ -128,3 +131,3 @@ let wrap = Fragment.empty; | ||
} | ||
const content = listItemType.contentMatch.defaultType?.createAndFill() || void 0; | ||
const content = ((_listItemType$content = listItemType.contentMatch.defaultType) === null || _listItemType$content === void 0 ? void 0 : _listItemType$content.createAndFill()) || void 0; | ||
wrap = wrap.append(Fragment.from(listItemType.createAndFill(null, content) || void 0)); | ||
@@ -140,4 +143,5 @@ const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3; | ||
if (dispatch) { | ||
var _listItemType$content2; | ||
const newListItemStartPos = $from.after(-1); | ||
const content = listItemType.contentMatch.defaultType?.createAndFill() || void 0; | ||
const content = ((_listItemType$content2 = listItemType.contentMatch.defaultType) === null || _listItemType$content2 === void 0 ? void 0 : _listItemType$content2.createAndFill()) || void 0; | ||
const newListItem = listItemType.createAndFill(null, content); | ||
@@ -260,5 +264,6 @@ if (newListItem) { | ||
}) { | ||
var _slice$content$firstC; | ||
const oldList = range.parent; | ||
const slice = tr.doc.slice(range.start, range.end); | ||
if (oldList.type === listType && slice.content.firstChild?.type === itemType) { | ||
if (oldList.type === listType && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === itemType) { | ||
return false; | ||
@@ -391,3 +396,6 @@ } | ||
} = selection; | ||
const range = $from.blockRange($to, node => node.firstChild?.type === itemType); | ||
const range = $from.blockRange($to, node => { | ||
var _node$firstChild; | ||
return ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type) === itemType; | ||
}); | ||
return range; | ||
@@ -413,3 +421,3 @@ } | ||
const previousList = root.maybeChild(rootIndex - 1); | ||
const previousListItem = previousList?.lastChild; | ||
const previousListItem = previousList === null || previousList === void 0 ? void 0 : previousList.lastChild; | ||
if ( | ||
@@ -610,3 +618,3 @@ // current node must be the first node in its parent list item; | ||
if (dedentList(tr)) { | ||
dispatch?.(tr.scrollIntoView()); | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.scrollIntoView()); | ||
return true; | ||
@@ -721,3 +729,3 @@ } | ||
if (indentList(tr)) { | ||
dispatch?.(tr.scrollIntoView()); | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.scrollIntoView()); | ||
return true; | ||
@@ -769,9 +777,3 @@ } | ||
staticKeys: ["enableCollapsible"] | ||
}), _dec2 = command(), _dec3 = command(), class ListItemExtension extends NodeExtension { | ||
static { | ||
({ | ||
e: [_initProto], | ||
c: [_ListItemExtension, _initClass] | ||
} = _applyDecs(this, [[_dec2, 2, "toggleListItemClosed"], [_dec3, 2, "liftListItemOutOfList"]], [_dec])); | ||
} | ||
}), _dec2 = command(), _dec3 = command(), (_class = class ListItemExtension extends NodeExtension { | ||
constructor(...args) { | ||
@@ -864,3 +866,3 @@ super(...args); | ||
closed = isBoolean(closed) ? closed : !node.attrs.closed; | ||
dispatch?.(tr.setNodeMarkup(from, void 0, { | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(from, void 0, { | ||
...node.attrs, | ||
@@ -875,6 +877,6 @@ closed | ||
} | ||
static { | ||
_initClass(); | ||
} | ||
}), _ListItemExtension); | ||
}, ({ | ||
e: [_initProto], | ||
c: [_ListItemExtension, _initClass] | ||
} = _applyDecs(_class, [[_dec2, 2, "toggleListItemClosed"], [_dec3, 2, "liftListItemOutOfList"]], [_dec])), _initClass())), _ListItemExtension); | ||
function updateNodeViewDOM(node, dom) { | ||
@@ -901,9 +903,3 @@ node.attrs.closed ? dom.classList.add(ExtensionListTheme2.COLLAPSIBLE_LIST_ITEM_CLOSED) : dom.classList.remove(ExtensionListTheme2.COLLAPSIBLE_LIST_ITEM_CLOSED); | ||
command: "toggleBulletList" | ||
}), class BulletListExtension extends NodeExtension2 { | ||
static { | ||
({ | ||
e: [_initProto2], | ||
c: [_BulletListExtension, _initClass2] | ||
} = _applyDecs(this, [[_dec5, 2, "toggleBulletList"], [_dec6, 2, "listShortcut"]], [_dec4])); | ||
} | ||
}), (_class2 = class BulletListExtension extends NodeExtension2 { | ||
constructor(...args) { | ||
@@ -936,2 +932,3 @@ super(...args); | ||
return (_, view, getPos) => { | ||
var _parentListItemNode$t; | ||
const dom = document.createElement("div"); | ||
@@ -942,3 +939,3 @@ dom.style.position = "relative"; | ||
const parentListItemNode = $pos.node($pos.depth - 1); | ||
const isFirstLevel = parentListItemNode?.type?.name !== "listItem"; | ||
const isFirstLevel = (parentListItemNode === null || parentListItemNode === void 0 ? void 0 : (_parentListItemNode$t = parentListItemNode.type) === null || _parentListItemNode$t === void 0 ? void 0 : _parentListItemNode$t.name) !== "listItem"; | ||
if (!isFirstLevel) { | ||
@@ -997,6 +994,6 @@ const spine = document.createElement("div"); | ||
} | ||
static { | ||
_initClass2(); | ||
} | ||
}), _BulletListExtension); | ||
}, ({ | ||
e: [_initProto2], | ||
c: [_BulletListExtension, _initClass2] | ||
} = _applyDecs(_class2, [[_dec5, 2, "toggleBulletList"], [_dec6, 2, "listShortcut"]], [_dec4])), _initClass2())), _BulletListExtension); | ||
@@ -1015,9 +1012,3 @@ // src/ordered-list-extension.ts | ||
command: "toggleOrderedList" | ||
}), class OrderedListExtension extends NodeExtension3 { | ||
static { | ||
({ | ||
e: [_initProto3], | ||
c: [_OrderedListExtension, _initClass3] | ||
} = _applyDecs(this, [[_dec8, 2, "toggleOrderedList"], [_dec9, 2, "listShortcut"]], [_dec7])); | ||
} | ||
}), (_class3 = class OrderedListExtension extends NodeExtension3 { | ||
constructor(...args) { | ||
@@ -1108,6 +1099,6 @@ super(...args); | ||
} | ||
static { | ||
_initClass3(); | ||
} | ||
}), _OrderedListExtension); | ||
}, ({ | ||
e: [_initProto3], | ||
c: [_OrderedListExtension, _initClass3] | ||
} = _applyDecs(_class3, [[_dec8, 2, "toggleOrderedList"], [_dec9, 2, "listShortcut"]], [_dec7])), _initClass3())), _OrderedListExtension); | ||
@@ -1122,6 +1113,3 @@ // src/task-list-extension.ts | ||
import { ExtensionListTheme as ExtensionListTheme4 } from "@remirror/theme"; | ||
var TaskListItemExtension = (_dec10 = command4(), class _Class extends NodeExtension4 { | ||
static { | ||
[_initProto4] = _applyDecs(this, [[_dec10, 2, "toggleCheckboxChecked"]], []).e; | ||
} | ||
var TaskListItemExtension = (_dec10 = command4(), (_class4 = class _Class extends NodeExtension4 { | ||
constructor(...args) { | ||
@@ -1234,3 +1222,3 @@ super(...args); | ||
}; | ||
dispatch?.(tr.setNodeMarkup(pos, void 0, attrs)); | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(pos, void 0, attrs)); | ||
return true; | ||
@@ -1269,3 +1257,3 @@ }; | ||
} | ||
}); | ||
}, [_initProto4] = _applyDecs(_class4, [[_dec10, 2, "toggleCheckboxChecked"]], []).e, _class4)); | ||
function updateNodeViewDOM2(node, dom) { | ||
@@ -1288,6 +1276,3 @@ node.attrs.checked ? dom.setAttribute("data-checked", "") : dom.removeAttribute("data-checked"); | ||
command: "toggleTaskList" | ||
}), class _Class2 extends NodeExtension5 { | ||
static { | ||
[_initProto5] = _applyDecs(this, [[_dec11, 2, "toggleTaskList"], [_dec12, 2, "listShortcut"]], []).e; | ||
} | ||
}), (_class5 = class _Class2 extends NodeExtension5 { | ||
constructor(...args) { | ||
@@ -1329,3 +1314,3 @@ super(...args); | ||
} | ||
}); | ||
}, [_initProto5] = _applyDecs(_class5, [[_dec11, 2, "toggleTaskList"], [_dec12, 2, "listShortcut"]], []).e, _class5)); | ||
export { BulletListExtension, ListItemExtension, ListItemSharedExtension, OrderedListExtension, TaskListExtension, TaskListItemExtension, dedentList, indentList, sharedLiftListItem, sharedSinkListItem, toggleList, wrapSelectedItems }; |
{ | ||
"name": "@remirror/extension-list", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "The list extensions.", | ||
@@ -41,4 +41,4 @@ "keywords": [ | ||
"@babel/runtime": "^7.22.3", | ||
"@remirror/core": "3.0.0-beta.1", | ||
"@remirror/extension-events": "3.0.0-beta.1", | ||
"@remirror/core": "3.0.0-beta.2", | ||
"@remirror/extension-events": "3.0.0-beta.2", | ||
"@remirror/messages": "3.0.0-beta.1", | ||
@@ -45,0 +45,0 @@ "@remirror/theme": "3.0.0-beta.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
257628
4679
+ Added@babel/code-frame@7.24.7(transitive)
+ Added@babel/compat-data@7.24.7(transitive)
+ Added@babel/core@7.24.7(transitive)
+ Added@babel/generator@7.24.7(transitive)
+ Added@babel/helper-compilation-targets@7.24.7(transitive)
+ Added@babel/helper-environment-visitor@7.24.7(transitive)
+ Added@babel/helper-function-name@7.24.7(transitive)
+ Added@babel/helper-hoist-variables@7.24.7(transitive)
+ Added@babel/helper-module-imports@7.24.7(transitive)
+ Added@babel/helper-module-transforms@7.24.7(transitive)
+ Added@babel/helper-plugin-utils@7.24.7(transitive)
+ Added@babel/helper-simple-access@7.24.7(transitive)
+ Added@babel/helper-split-export-declaration@7.24.7(transitive)
+ Added@babel/helper-string-parser@7.24.7(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/helper-validator-option@7.24.7(transitive)
+ Added@babel/helpers@7.24.7(transitive)
+ Added@babel/highlight@7.24.7(transitive)
+ Added@babel/parser@7.24.7(transitive)
+ Added@babel/plugin-transform-modules-commonjs@7.24.7(transitive)
+ Added@babel/runtime@7.24.7(transitive)
+ Added@babel/template@7.24.7(transitive)
+ Added@babel/traverse@7.24.7(transitive)
+ Added@babel/types@7.24.7(transitive)
+ Added@remirror/core@3.0.0-beta.2(transitive)
+ Added@remirror/extension-events@3.0.0-beta.2(transitive)
+ Addedcaniuse-lite@1.0.30001629(transitive)
+ Addedelectron-to-chromium@1.4.790(transitive)
+ Addedprosemirror-model@1.21.1(transitive)
- Removed@babel/code-frame@7.24.6(transitive)
- Removed@babel/compat-data@7.24.6(transitive)
- Removed@babel/core@7.24.6(transitive)
- Removed@babel/generator@7.24.6(transitive)
- Removed@babel/helper-compilation-targets@7.24.6(transitive)
- Removed@babel/helper-environment-visitor@7.24.6(transitive)
- Removed@babel/helper-function-name@7.24.6(transitive)
- Removed@babel/helper-hoist-variables@7.24.6(transitive)
- Removed@babel/helper-module-imports@7.24.6(transitive)
- Removed@babel/helper-module-transforms@7.24.6(transitive)
- Removed@babel/helper-plugin-utils@7.24.6(transitive)
- Removed@babel/helper-simple-access@7.24.6(transitive)
- Removed@babel/helper-split-export-declaration@7.24.6(transitive)
- Removed@babel/helper-string-parser@7.24.6(transitive)
- Removed@babel/helper-validator-identifier@7.24.6(transitive)
- Removed@babel/helper-validator-option@7.24.6(transitive)
- Removed@babel/helpers@7.24.6(transitive)
- Removed@babel/highlight@7.24.6(transitive)
- Removed@babel/parser@7.24.6(transitive)
- Removed@babel/plugin-transform-modules-commonjs@7.24.6(transitive)
- Removed@babel/runtime@7.24.6(transitive)
- Removed@babel/template@7.24.6(transitive)
- Removed@babel/traverse@7.24.6(transitive)
- Removed@babel/types@7.24.6(transitive)
- Removed@remirror/core@3.0.0-beta.1(transitive)
- Removed@remirror/extension-events@3.0.0-beta.1(transitive)
- Removedelectron-to-chromium@1.4.788(transitive)
- Removedprosemirror-model@1.21.0(transitive)
Updated@remirror/core@3.0.0-beta.2