@domternal/core 0.5.0 → 0.6.0

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.d.cts CHANGED
@@ -4164,6 +4164,7 @@ declare const TaskList: Node<TaskListOptions, unknown>;
4164
4164
  * - Enter: Split task item at cursor
4165
4165
  * - Tab: Sink (indent) task item
4166
4166
  * - Shift-Tab: Lift (outdent) task item
4167
+ * - Backspace: Lift task item when at start of empty-ish item (converts to paragraph)
4167
4168
  * - Mod-Enter: Toggle task checked state
4168
4169
  */
4169
4170
 
package/dist/index.d.ts CHANGED
@@ -4164,6 +4164,7 @@ declare const TaskList: Node<TaskListOptions, unknown>;
4164
4164
  * - Enter: Split task item at cursor
4165
4165
  * - Tab: Sink (indent) task item
4166
4166
  * - Shift-Tab: Lift (outdent) task item
4167
+ * - Backspace: Lift task item when at start of empty-ish item (converts to paragraph)
4167
4168
  * - Mod-Enter: Toggle task checked state
4168
4169
  */
4169
4170
 
package/dist/index.js CHANGED
@@ -5520,6 +5520,22 @@ var TaskItem = Node.create({
5520
5520
  if ($from.depth < 1 || $from.node(-1).type !== this.nodeType) return false;
5521
5521
  return liftListItem(this.nodeType)(this.editor.state, this.editor.view.dispatch);
5522
5522
  },
5523
+ Backspace: () => {
5524
+ if (!this.editor || !this.nodeType) return false;
5525
+ const { state, view } = this.editor;
5526
+ const { $from, empty } = state.selection;
5527
+ if (!empty || $from.parentOffset !== 0) return false;
5528
+ let taskItemDepth = -1;
5529
+ for (let d = $from.depth; d > 0; d--) {
5530
+ if ($from.node(d).type === this.nodeType) {
5531
+ taskItemDepth = d;
5532
+ break;
5533
+ }
5534
+ }
5535
+ if (taskItemDepth === -1) return false;
5536
+ if ($from.index(taskItemDepth) !== 0) return false;
5537
+ return liftListItem(this.nodeType)(state, view.dispatch);
5538
+ },
5523
5539
  "Mod-Enter": () => {
5524
5540
  return this.editor?.commands["toggleTask"]?.() ?? false;
5525
5541
  }
@@ -7469,7 +7485,7 @@ var SelectionDecoration = Extension.create(
7469
7485
  handleDOMEvents: {
7470
7486
  blur(view, event) {
7471
7487
  const related = event.relatedTarget;
7472
- if (related instanceof HTMLElement && related.closest("[data-dm-editor-ui]")) {
7488
+ if (related instanceof HTMLElement && (related.closest("[data-dm-editor-ui]") || related.closest(".dm-toolbar") || related.closest(".dm-bubble-menu"))) {
7473
7489
  return false;
7474
7490
  }
7475
7491
  const { from, to } = view.state.selection;