@domternal/core 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +75 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -8
- package/dist/index.d.ts +38 -8
- package/dist/index.js +75 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -814,6 +814,15 @@ declare class ExtensionManager {
|
|
|
814
814
|
* while letting users override with explicitly configured versions.
|
|
815
815
|
*/
|
|
816
816
|
private deduplicateExtensions;
|
|
817
|
+
/**
|
|
818
|
+
* Clone every extension so this editor owns its instances. Extensions hold
|
|
819
|
+
* per-editor mutable state (`editor`, plus the `nodeType`/`markType` getters
|
|
820
|
+
* derived from it), and the same extension object is commonly reused across
|
|
821
|
+
* editors (one shared `extensions` array). Without cloning, binding a later
|
|
822
|
+
* editor clobbers an earlier one: its list `Enter` then falls back to a plain
|
|
823
|
+
* block split, dropping an indented "child" paragraph instead of a new `<li>`.
|
|
824
|
+
*/
|
|
825
|
+
private cloneExtensions;
|
|
817
826
|
/**
|
|
818
827
|
* Sorts extensions by priority (higher priority first)
|
|
819
828
|
* Default priority is 100
|
|
@@ -2745,9 +2754,8 @@ declare function insertChildrenZoneSibling(state: EditorState, dispatch: ((tr: T
|
|
|
2745
2754
|
* - `tr` has no prior steps (lift steps captured from a fresh state must
|
|
2746
2755
|
* replay against the same starting state as `tr`)
|
|
2747
2756
|
*
|
|
2748
|
-
* Returns true if
|
|
2749
|
-
*
|
|
2750
|
-
* top-level paragraph.
|
|
2757
|
+
* Returns true if a lift was applied to `tr`. The caller can keep chaining
|
|
2758
|
+
* work on `tr` (e.g. `setBlockType`, `wrapIn`) at the new cursor position.
|
|
2751
2759
|
*/
|
|
2752
2760
|
declare function liftCurrentListItem(state: EditorState, tr: Transaction): boolean;
|
|
2753
2761
|
|
|
@@ -3039,6 +3047,15 @@ interface WrappingInputRuleOptions {
|
|
|
3039
3047
|
* the same type above the newly wrapped node.
|
|
3040
3048
|
*/
|
|
3041
3049
|
joinPredicate?: (match: RegExpMatchArray, node: Node$1) => boolean;
|
|
3050
|
+
/**
|
|
3051
|
+
* When `true`, also join with an adjacent same-type node AFTER the newly
|
|
3052
|
+
* wrapped node, not just the one before. Lists set this so creating a list
|
|
3053
|
+
* item on a paragraph between two same-type lists merges all three into one
|
|
3054
|
+
* (Notion groups consecutive list items into a single list). Off by default
|
|
3055
|
+
* so wrappers like blockquote, where adjacent blocks stay separate, are
|
|
3056
|
+
* unaffected. Honours `joinPredicate` against the following node.
|
|
3057
|
+
*/
|
|
3058
|
+
joinForward?: boolean;
|
|
3042
3059
|
/**
|
|
3043
3060
|
* Optional guard predicate. When provided, the rule only fires if
|
|
3044
3061
|
* this returns true. Use this to prevent wrapping in certain contexts
|
|
@@ -3472,6 +3489,16 @@ declare class Extension<Options = unknown, Storage = unknown> {
|
|
|
3472
3489
|
* // configure({ nested: { ...original.options.nested, b: 3 } })
|
|
3473
3490
|
*/
|
|
3474
3491
|
configure(options: Partial<Options>): Extension<Options, Storage>;
|
|
3492
|
+
/**
|
|
3493
|
+
* Returns a fresh, unbound copy built from the same `config`: `editor` reset to
|
|
3494
|
+
* null and `options`/`storage` re-derived, while `configure()`/`extend()`
|
|
3495
|
+
* results are preserved (they live in `config`). Polymorphic: a `Node`/`Mark`
|
|
3496
|
+
* clones to its own subclass.
|
|
3497
|
+
*
|
|
3498
|
+
* `ExtensionManager` clones every extension so each editor owns its instances
|
|
3499
|
+
* and binding one editor can't mutate extensions shared with another.
|
|
3500
|
+
*/
|
|
3501
|
+
clone(): Extension<Options, Storage>;
|
|
3475
3502
|
/**
|
|
3476
3503
|
* Creates a new extension with extended configuration
|
|
3477
3504
|
* Original extension is not modified
|
|
@@ -6296,12 +6323,15 @@ interface StarterKitOptions {
|
|
|
6296
6323
|
*/
|
|
6297
6324
|
listKeymap?: false | Partial<ListKeymapOptions>;
|
|
6298
6325
|
/**
|
|
6299
|
-
* Set to
|
|
6300
|
-
* Tab / Shift-Tab keymap that indents a top-level block under the
|
|
6301
|
-
* previous list (and outdents back).
|
|
6302
|
-
*
|
|
6326
|
+
* Off by default. Set to `true` to enable the ListIndent extension, which
|
|
6327
|
+
* adds a Tab / Shift-Tab keymap that indents a top-level block under the
|
|
6328
|
+
* previous list (and outdents back). Kept off by default because it captures
|
|
6329
|
+
* Tab on a paragraph that merely follows a list, so Tab no longer moves focus
|
|
6330
|
+
* to the next field in embedded / form usage, and the same nesting is
|
|
6331
|
+
* reachable via the block-menu drag. Registered AFTER ListKeymap so the
|
|
6332
|
+
* in-list-item Tab/Shift-Tab keep priority.
|
|
6303
6333
|
*/
|
|
6304
|
-
listIndent?:
|
|
6334
|
+
listIndent?: boolean;
|
|
6305
6335
|
/**
|
|
6306
6336
|
* Set to false to disable the LinkPopover extension, or pass options to configure it.
|
|
6307
6337
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -814,6 +814,15 @@ declare class ExtensionManager {
|
|
|
814
814
|
* while letting users override with explicitly configured versions.
|
|
815
815
|
*/
|
|
816
816
|
private deduplicateExtensions;
|
|
817
|
+
/**
|
|
818
|
+
* Clone every extension so this editor owns its instances. Extensions hold
|
|
819
|
+
* per-editor mutable state (`editor`, plus the `nodeType`/`markType` getters
|
|
820
|
+
* derived from it), and the same extension object is commonly reused across
|
|
821
|
+
* editors (one shared `extensions` array). Without cloning, binding a later
|
|
822
|
+
* editor clobbers an earlier one: its list `Enter` then falls back to a plain
|
|
823
|
+
* block split, dropping an indented "child" paragraph instead of a new `<li>`.
|
|
824
|
+
*/
|
|
825
|
+
private cloneExtensions;
|
|
817
826
|
/**
|
|
818
827
|
* Sorts extensions by priority (higher priority first)
|
|
819
828
|
* Default priority is 100
|
|
@@ -2745,9 +2754,8 @@ declare function insertChildrenZoneSibling(state: EditorState, dispatch: ((tr: T
|
|
|
2745
2754
|
* - `tr` has no prior steps (lift steps captured from a fresh state must
|
|
2746
2755
|
* replay against the same starting state as `tr`)
|
|
2747
2756
|
*
|
|
2748
|
-
* Returns true if
|
|
2749
|
-
*
|
|
2750
|
-
* top-level paragraph.
|
|
2757
|
+
* Returns true if a lift was applied to `tr`. The caller can keep chaining
|
|
2758
|
+
* work on `tr` (e.g. `setBlockType`, `wrapIn`) at the new cursor position.
|
|
2751
2759
|
*/
|
|
2752
2760
|
declare function liftCurrentListItem(state: EditorState, tr: Transaction): boolean;
|
|
2753
2761
|
|
|
@@ -3039,6 +3047,15 @@ interface WrappingInputRuleOptions {
|
|
|
3039
3047
|
* the same type above the newly wrapped node.
|
|
3040
3048
|
*/
|
|
3041
3049
|
joinPredicate?: (match: RegExpMatchArray, node: Node$1) => boolean;
|
|
3050
|
+
/**
|
|
3051
|
+
* When `true`, also join with an adjacent same-type node AFTER the newly
|
|
3052
|
+
* wrapped node, not just the one before. Lists set this so creating a list
|
|
3053
|
+
* item on a paragraph between two same-type lists merges all three into one
|
|
3054
|
+
* (Notion groups consecutive list items into a single list). Off by default
|
|
3055
|
+
* so wrappers like blockquote, where adjacent blocks stay separate, are
|
|
3056
|
+
* unaffected. Honours `joinPredicate` against the following node.
|
|
3057
|
+
*/
|
|
3058
|
+
joinForward?: boolean;
|
|
3042
3059
|
/**
|
|
3043
3060
|
* Optional guard predicate. When provided, the rule only fires if
|
|
3044
3061
|
* this returns true. Use this to prevent wrapping in certain contexts
|
|
@@ -3472,6 +3489,16 @@ declare class Extension<Options = unknown, Storage = unknown> {
|
|
|
3472
3489
|
* // configure({ nested: { ...original.options.nested, b: 3 } })
|
|
3473
3490
|
*/
|
|
3474
3491
|
configure(options: Partial<Options>): Extension<Options, Storage>;
|
|
3492
|
+
/**
|
|
3493
|
+
* Returns a fresh, unbound copy built from the same `config`: `editor` reset to
|
|
3494
|
+
* null and `options`/`storage` re-derived, while `configure()`/`extend()`
|
|
3495
|
+
* results are preserved (they live in `config`). Polymorphic: a `Node`/`Mark`
|
|
3496
|
+
* clones to its own subclass.
|
|
3497
|
+
*
|
|
3498
|
+
* `ExtensionManager` clones every extension so each editor owns its instances
|
|
3499
|
+
* and binding one editor can't mutate extensions shared with another.
|
|
3500
|
+
*/
|
|
3501
|
+
clone(): Extension<Options, Storage>;
|
|
3475
3502
|
/**
|
|
3476
3503
|
* Creates a new extension with extended configuration
|
|
3477
3504
|
* Original extension is not modified
|
|
@@ -6296,12 +6323,15 @@ interface StarterKitOptions {
|
|
|
6296
6323
|
*/
|
|
6297
6324
|
listKeymap?: false | Partial<ListKeymapOptions>;
|
|
6298
6325
|
/**
|
|
6299
|
-
* Set to
|
|
6300
|
-
* Tab / Shift-Tab keymap that indents a top-level block under the
|
|
6301
|
-
* previous list (and outdents back).
|
|
6302
|
-
*
|
|
6326
|
+
* Off by default. Set to `true` to enable the ListIndent extension, which
|
|
6327
|
+
* adds a Tab / Shift-Tab keymap that indents a top-level block under the
|
|
6328
|
+
* previous list (and outdents back). Kept off by default because it captures
|
|
6329
|
+
* Tab on a paragraph that merely follows a list, so Tab no longer moves focus
|
|
6330
|
+
* to the next field in embedded / form usage, and the same nesting is
|
|
6331
|
+
* reachable via the block-menu drag. Registered AFTER ListKeymap so the
|
|
6332
|
+
* in-list-item Tab/Shift-Tab keep priority.
|
|
6303
6333
|
*/
|
|
6304
|
-
listIndent?:
|
|
6334
|
+
listIndent?: boolean;
|
|
6305
6335
|
/**
|
|
6306
6336
|
* Set to false to disable the LinkPopover extension, or pass options to configure it.
|
|
6307
6337
|
*/
|
package/dist/index.js
CHANGED
|
@@ -298,7 +298,8 @@ var ExtensionManager = class {
|
|
|
298
298
|
}
|
|
299
299
|
const flattened = this.flattenExtensions(options.extensions);
|
|
300
300
|
const deduped = this.deduplicateExtensions(flattened);
|
|
301
|
-
|
|
301
|
+
const cloned = this.cloneExtensions(deduped);
|
|
302
|
+
this._extensions = this.resolveExtensions(cloned);
|
|
302
303
|
this.detectConflicts();
|
|
303
304
|
this.checkDependencies();
|
|
304
305
|
this.bindEditorToExtensions();
|
|
@@ -406,6 +407,17 @@ var ExtensionManager = class {
|
|
|
406
407
|
}
|
|
407
408
|
return extensions.filter((ext, i) => seen.get(ext.name) === i);
|
|
408
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Clone every extension so this editor owns its instances. Extensions hold
|
|
412
|
+
* per-editor mutable state (`editor`, plus the `nodeType`/`markType` getters
|
|
413
|
+
* derived from it), and the same extension object is commonly reused across
|
|
414
|
+
* editors (one shared `extensions` array). Without cloning, binding a later
|
|
415
|
+
* editor clobbers an earlier one: its list `Enter` then falls back to a plain
|
|
416
|
+
* block split, dropping an indented "child" paragraph instead of a new `<li>`.
|
|
417
|
+
*/
|
|
418
|
+
cloneExtensions(extensions) {
|
|
419
|
+
return extensions.map((ext) => ext.clone());
|
|
420
|
+
}
|
|
409
421
|
/**
|
|
410
422
|
* Sorts extensions by priority (higher priority first)
|
|
411
423
|
* Default priority is 100
|
|
@@ -1125,7 +1137,7 @@ var markInputRulePatterns = {
|
|
|
1125
1137
|
highlight: /(?:==)([^=]+)(?:==)$/
|
|
1126
1138
|
};
|
|
1127
1139
|
function wrappingInputRule(options) {
|
|
1128
|
-
const { find: find2, type, getAttributes = null, joinPredicate, undoable, guard } = options;
|
|
1140
|
+
const { find: find2, type, getAttributes = null, joinPredicate, undoable, guard, joinForward } = options;
|
|
1129
1141
|
return new InputRule(
|
|
1130
1142
|
find2,
|
|
1131
1143
|
(state, match, start, end) => {
|
|
@@ -1141,6 +1153,21 @@ function wrappingInputRule(options) {
|
|
|
1141
1153
|
if (before?.type === type && canJoin(tr.doc, start - 1) && (!joinPredicate || joinPredicate(match, before))) {
|
|
1142
1154
|
tr.join(start - 1);
|
|
1143
1155
|
}
|
|
1156
|
+
if (joinForward) {
|
|
1157
|
+
const $cursor = tr.selection.$from;
|
|
1158
|
+
for (let d = $cursor.depth; d >= 0; d--) {
|
|
1159
|
+
if ($cursor.node(d).type === type) {
|
|
1160
|
+
const after = $cursor.after(d);
|
|
1161
|
+
if (after < tr.doc.content.size && canJoin(tr.doc, after)) {
|
|
1162
|
+
const nodeAfter = tr.doc.nodeAt(after);
|
|
1163
|
+
if (nodeAfter?.type === type && (!joinPredicate || joinPredicate(match, nodeAfter))) {
|
|
1164
|
+
tr.join(after);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1144
1171
|
return tr;
|
|
1145
1172
|
},
|
|
1146
1173
|
undoable !== void 0 ? { undoable } : {}
|
|
@@ -1523,6 +1550,19 @@ var Extension = class _Extension {
|
|
|
1523
1550
|
};
|
|
1524
1551
|
return new _Extension(newConfig);
|
|
1525
1552
|
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Returns a fresh, unbound copy built from the same `config`: `editor` reset to
|
|
1555
|
+
* null and `options`/`storage` re-derived, while `configure()`/`extend()`
|
|
1556
|
+
* results are preserved (they live in `config`). Polymorphic: a `Node`/`Mark`
|
|
1557
|
+
* clones to its own subclass.
|
|
1558
|
+
*
|
|
1559
|
+
* `ExtensionManager` clones every extension so each editor owns its instances
|
|
1560
|
+
* and binding one editor can't mutate extensions shared with another.
|
|
1561
|
+
*/
|
|
1562
|
+
clone() {
|
|
1563
|
+
const Ctor = this.constructor;
|
|
1564
|
+
return new Ctor(this.config);
|
|
1565
|
+
}
|
|
1526
1566
|
/**
|
|
1527
1567
|
* Creates a new extension with extended configuration
|
|
1528
1568
|
* Original extension is not modified
|
|
@@ -1961,6 +2001,7 @@ function isInListItemLabel($pos) {
|
|
|
1961
2001
|
}
|
|
1962
2002
|
|
|
1963
2003
|
// src/utils/liftCurrentListItem.ts
|
|
2004
|
+
var LIST_ITEM_TYPES = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
|
|
1964
2005
|
function liftCurrentListItem(state, tr) {
|
|
1965
2006
|
if (!tr.selection.empty) return false;
|
|
1966
2007
|
if (tr.steps.length !== 0) return false;
|
|
@@ -1968,6 +2009,16 @@ function liftCurrentListItem(state, tr) {
|
|
|
1968
2009
|
const listItemDepth = findListItemAncestorDepth($from);
|
|
1969
2010
|
if (listItemDepth === -1) return false;
|
|
1970
2011
|
if ($from.index(listItemDepth) !== 0) return false;
|
|
2012
|
+
const wrapperParent = $from.node(listItemDepth - 2);
|
|
2013
|
+
const isNested = LIST_ITEM_TYPES.has(wrapperParent.type.name);
|
|
2014
|
+
if (isNested) {
|
|
2015
|
+
const range = $from.blockRange();
|
|
2016
|
+
if (!range) return false;
|
|
2017
|
+
const target = liftTarget(range);
|
|
2018
|
+
if (target === null) return false;
|
|
2019
|
+
tr.lift(range, target);
|
|
2020
|
+
return true;
|
|
2021
|
+
}
|
|
1971
2022
|
const listItemType = $from.node(listItemDepth).type;
|
|
1972
2023
|
return liftListItem(listItemType)(state, (liftTr) => {
|
|
1973
2024
|
for (const step of liftTr.steps) tr.step(step);
|
|
@@ -2175,13 +2226,13 @@ var lift = () => ({ tr, dispatch }) => {
|
|
|
2175
2226
|
};
|
|
2176
2227
|
|
|
2177
2228
|
// src/utils/listItemCursorContext.ts
|
|
2178
|
-
var
|
|
2229
|
+
var LIST_ITEM_TYPES2 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
|
|
2179
2230
|
function getListItemCursorContext($from) {
|
|
2180
2231
|
if ($from.parent.type.name !== "paragraph") return null;
|
|
2181
2232
|
const itemDepth = $from.depth - 1;
|
|
2182
2233
|
if (itemDepth < 1) return null;
|
|
2183
2234
|
const itemNode = $from.node(itemDepth);
|
|
2184
|
-
if (!
|
|
2235
|
+
if (!LIST_ITEM_TYPES2.has(itemNode.type.name)) return null;
|
|
2185
2236
|
const wrapperDepth = itemDepth - 1;
|
|
2186
2237
|
const childIndex = $from.index(itemDepth);
|
|
2187
2238
|
return {
|
|
@@ -4077,7 +4128,7 @@ function defaultBubbleContexts(editor) {
|
|
|
4077
4128
|
}
|
|
4078
4129
|
|
|
4079
4130
|
// src/utils/insertAsListItemChild.ts
|
|
4080
|
-
var
|
|
4131
|
+
var LIST_ITEM_TYPES3 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
|
|
4081
4132
|
var LIST_WRAPPER_TYPES = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
|
|
4082
4133
|
function insertAsListItemChild(args) {
|
|
4083
4134
|
const { tr, wrapperPos, targetItemPos, blockNode, sourceRange } = args;
|
|
@@ -4090,7 +4141,7 @@ function insertAsListItemChild(args) {
|
|
|
4090
4141
|
if (targetItemPos !== void 0) {
|
|
4091
4142
|
if (targetItemPos < 0 || targetItemPos >= tr.doc.content.size) return { ok: false };
|
|
4092
4143
|
const candidate = tr.doc.nodeAt(targetItemPos);
|
|
4093
|
-
if (!candidate || !
|
|
4144
|
+
if (!candidate || !LIST_ITEM_TYPES3.has(candidate.type.name)) return { ok: false };
|
|
4094
4145
|
if (targetItemPos < wrapperPos + 1 || targetItemPos >= wrapperPos + wrapper.nodeSize) {
|
|
4095
4146
|
return { ok: false };
|
|
4096
4147
|
}
|
|
@@ -4098,7 +4149,7 @@ function insertAsListItemChild(args) {
|
|
|
4098
4149
|
targetItemStart = targetItemPos;
|
|
4099
4150
|
} else {
|
|
4100
4151
|
const last = wrapper.lastChild;
|
|
4101
|
-
if (!last || !
|
|
4152
|
+
if (!last || !LIST_ITEM_TYPES3.has(last.type.name)) return { ok: false };
|
|
4102
4153
|
let pos = wrapperPos + 1;
|
|
4103
4154
|
for (let i = 0; i < wrapper.childCount - 1; i++) {
|
|
4104
4155
|
pos += wrapper.child(i).nodeSize;
|
|
@@ -5892,11 +5943,11 @@ var BulletList = Node2.create({
|
|
|
5892
5943
|
}
|
|
5893
5944
|
return [
|
|
5894
5945
|
// - item
|
|
5895
|
-
wrappingInputRule({ find: /^\s*[-]\s$/, type: nodeType, guard: notInsideList }),
|
|
5946
|
+
wrappingInputRule({ find: /^\s*[-]\s$/, type: nodeType, guard: notInsideList, joinForward: true }),
|
|
5896
5947
|
// * item
|
|
5897
|
-
wrappingInputRule({ find: /^\s*[*]\s$/, type: nodeType, guard: notInsideList }),
|
|
5948
|
+
wrappingInputRule({ find: /^\s*[*]\s$/, type: nodeType, guard: notInsideList, joinForward: true }),
|
|
5898
5949
|
// + item
|
|
5899
|
-
wrappingInputRule({ find: /^\s*[+]\s$/, type: nodeType, guard: notInsideList })
|
|
5950
|
+
wrappingInputRule({ find: /^\s*[+]\s$/, type: nodeType, guard: notInsideList, joinForward: true })
|
|
5900
5951
|
];
|
|
5901
5952
|
}
|
|
5902
5953
|
});
|
|
@@ -5997,6 +6048,7 @@ var OrderedList = Node2.create({
|
|
|
5997
6048
|
find: /^(\d+)\.\s$/,
|
|
5998
6049
|
type: nodeType,
|
|
5999
6050
|
guard: notInsideList,
|
|
6051
|
+
joinForward: true,
|
|
6000
6052
|
getAttributes: (match) => {
|
|
6001
6053
|
const num = match[1];
|
|
6002
6054
|
return { start: num ? parseInt(num, 10) : 1 };
|
|
@@ -6526,9 +6578,9 @@ var TaskList = Node2.create({
|
|
|
6526
6578
|
}
|
|
6527
6579
|
return [
|
|
6528
6580
|
// [ ] at start of line creates unchecked task
|
|
6529
|
-
wrappingInputRule({ find: /^\s*\[\s?\]\s$/, type: nodeType, guard: notInsideList }),
|
|
6581
|
+
wrappingInputRule({ find: /^\s*\[\s?\]\s$/, type: nodeType, guard: notInsideList, joinForward: true }),
|
|
6530
6582
|
// [x] or [X] at start of line creates checked task
|
|
6531
|
-
wrappingInputRule({ find: /^\s*\[[xX]\]\s$/, type: nodeType, guard: notInsideList })
|
|
6583
|
+
wrappingInputRule({ find: /^\s*\[[xX]\]\s$/, type: nodeType, guard: notInsideList, joinForward: true })
|
|
6532
6584
|
];
|
|
6533
6585
|
}
|
|
6534
6586
|
});
|
|
@@ -7711,12 +7763,12 @@ var Placeholder = Extension.create({
|
|
|
7711
7763
|
];
|
|
7712
7764
|
}
|
|
7713
7765
|
});
|
|
7714
|
-
var
|
|
7766
|
+
var LIST_ITEM_TYPES4 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
|
|
7715
7767
|
var LIST_WRAPPER_TYPES2 = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
|
|
7716
7768
|
function isCursorInsideListItem(state) {
|
|
7717
7769
|
const { $from } = state.selection;
|
|
7718
7770
|
for (let d = $from.depth; d > 0; d--) {
|
|
7719
|
-
if (
|
|
7771
|
+
if (LIST_ITEM_TYPES4.has($from.node(d).type.name)) return true;
|
|
7720
7772
|
}
|
|
7721
7773
|
return false;
|
|
7722
7774
|
}
|
|
@@ -7771,7 +7823,7 @@ function outdentBlockFromListItem(state, dispatch) {
|
|
|
7771
7823
|
const { $from } = selection;
|
|
7772
7824
|
let listItemDepth = -1;
|
|
7773
7825
|
for (let d = $from.depth; d > 0; d--) {
|
|
7774
|
-
if (
|
|
7826
|
+
if (LIST_ITEM_TYPES4.has($from.node(d).type.name)) {
|
|
7775
7827
|
listItemDepth = d;
|
|
7776
7828
|
break;
|
|
7777
7829
|
}
|
|
@@ -8675,8 +8727,13 @@ var SelectionDecoration = Extension.create(
|
|
|
8675
8727
|
handleDOMEvents: {
|
|
8676
8728
|
blur(view, event) {
|
|
8677
8729
|
const related = event.relatedTarget;
|
|
8678
|
-
if (related instanceof HTMLElement
|
|
8679
|
-
|
|
8730
|
+
if (related instanceof HTMLElement) {
|
|
8731
|
+
const ownContainer = view.dom.closest(".dm-editor");
|
|
8732
|
+
const relatedContainer = related.closest(".dm-editor");
|
|
8733
|
+
const movedToAnotherEditor = ownContainer !== null && relatedContainer !== null && relatedContainer !== ownContainer;
|
|
8734
|
+
if (!movedToAnotherEditor && (related.closest("[data-dm-editor-ui]") || related.closest(".dm-toolbar") || related.closest(".dm-bubble-menu"))) {
|
|
8735
|
+
return false;
|
|
8736
|
+
}
|
|
8680
8737
|
}
|
|
8681
8738
|
const { from, to } = view.state.selection;
|
|
8682
8739
|
if (from !== to) {
|
|
@@ -10029,7 +10086,7 @@ var StarterKit = Extension.create({
|
|
|
10029
10086
|
maybeAdd(Gapcursor, this.options.gapcursor);
|
|
10030
10087
|
maybeAdd(TrailingNode, this.options.trailingNode);
|
|
10031
10088
|
maybeAdd(ListKeymap, this.options.listKeymap);
|
|
10032
|
-
|
|
10089
|
+
if (this.options.listIndent === true) extensions.push(ListIndent);
|
|
10033
10090
|
maybeAdd(LinkPopover, this.options.linkPopover);
|
|
10034
10091
|
maybeAdd(SelectionDecoration, this.options.selectionDecoration);
|
|
10035
10092
|
return extensions;
|