@tiptap/core 3.17.0 → 3.18.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.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/NodePos.ts +8 -3
- package/src/commands/focus.ts +8 -2
- package/src/lib/ResizableNodeView.ts +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -4104,7 +4104,7 @@ declare class ResizableNodeView {
|
|
|
4104
4104
|
* @returns The container element to be inserted into the editor
|
|
4105
4105
|
*/
|
|
4106
4106
|
get dom(): HTMLElement;
|
|
4107
|
-
get contentDOM(): HTMLElement |
|
|
4107
|
+
get contentDOM(): HTMLElement | null;
|
|
4108
4108
|
private handleEditorUpdate;
|
|
4109
4109
|
/**
|
|
4110
4110
|
* Called when the node's content or attributes change.
|
package/dist/index.d.ts
CHANGED
|
@@ -4104,7 +4104,7 @@ declare class ResizableNodeView {
|
|
|
4104
4104
|
* @returns The container element to be inserted into the editor
|
|
4105
4105
|
*/
|
|
4106
4106
|
get dom(): HTMLElement;
|
|
4107
|
-
get contentDOM(): HTMLElement |
|
|
4107
|
+
get contentDOM(): HTMLElement | null;
|
|
4108
4108
|
private handleEditorUpdate;
|
|
4109
4109
|
/**
|
|
4110
4110
|
* Called when the node's content or attributes change.
|
package/dist/index.js
CHANGED
|
@@ -543,8 +543,12 @@ var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch })
|
|
|
543
543
|
}
|
|
544
544
|
});
|
|
545
545
|
};
|
|
546
|
-
|
|
547
|
-
|
|
546
|
+
try {
|
|
547
|
+
if (view.hasFocus() && position === null || position === false) {
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
} catch {
|
|
551
|
+
return false;
|
|
548
552
|
}
|
|
549
553
|
if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
|
|
550
554
|
delayedFocus();
|
|
@@ -4321,19 +4325,20 @@ var NodePos = class _NodePos {
|
|
|
4321
4325
|
this.node.content.forEach((node, offset) => {
|
|
4322
4326
|
const isBlock = node.isBlock && !node.isTextblock;
|
|
4323
4327
|
const isNonTextAtom = node.isAtom && !node.isText;
|
|
4328
|
+
const isInline = node.isInline;
|
|
4324
4329
|
const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
|
|
4325
4330
|
if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {
|
|
4326
4331
|
return;
|
|
4327
4332
|
}
|
|
4328
4333
|
const $pos = this.resolvedPos.doc.resolve(targetPos);
|
|
4329
|
-
if (!isBlock && $pos.depth <= this.depth) {
|
|
4334
|
+
if (!isBlock && !isInline && $pos.depth <= this.depth) {
|
|
4330
4335
|
return;
|
|
4331
4336
|
}
|
|
4332
|
-
const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock ? node : null);
|
|
4337
|
+
const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);
|
|
4333
4338
|
if (isBlock) {
|
|
4334
4339
|
childNodePos.actualDepth = this.depth + 1;
|
|
4335
4340
|
}
|
|
4336
|
-
children.push(
|
|
4341
|
+
children.push(childNodePos);
|
|
4337
4342
|
});
|
|
4338
4343
|
return children;
|
|
4339
4344
|
}
|
|
@@ -5409,7 +5414,8 @@ var ResizableNodeView = class {
|
|
|
5409
5414
|
return this.container;
|
|
5410
5415
|
}
|
|
5411
5416
|
get contentDOM() {
|
|
5412
|
-
|
|
5417
|
+
var _a;
|
|
5418
|
+
return (_a = this.contentElement) != null ? _a : null;
|
|
5413
5419
|
}
|
|
5414
5420
|
handleEditorUpdate() {
|
|
5415
5421
|
const isEditable = this.editor.isEditable;
|