@tiptap/core 3.0.0-next.5 → 3.0.0-next.7
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 +48 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -17
- package/dist/index.d.ts +32 -17
- package/dist/index.js +74 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/CommandManager.ts +3 -3
- package/src/Editor.ts +30 -15
- package/src/Extendable.ts +10 -9
- package/src/Extension.ts +17 -1
- package/src/ExtensionManager.ts +8 -6
- package/src/InputRule.ts +6 -4
- package/src/Mark.ts +13 -1
- package/src/MarkView.ts +3 -3
- package/src/Node.ts +13 -1
- package/src/NodePos.ts +3 -3
- package/src/NodeView.ts +3 -3
- package/src/PasteRule.ts +6 -4
- package/src/Tracker.ts +1 -1
- package/src/commands/blur.ts +1 -1
- package/src/commands/clearContent.ts +1 -1
- package/src/commands/clearNodes.ts +1 -1
- package/src/commands/command.ts +1 -1
- package/src/commands/createParagraphNear.ts +1 -1
- package/src/commands/cut.ts +1 -1
- package/src/commands/deleteCurrentNode.ts +1 -1
- package/src/commands/deleteNode.ts +2 -2
- package/src/commands/deleteRange.ts +1 -1
- package/src/commands/deleteSelection.ts +1 -1
- package/src/commands/enter.ts +1 -1
- package/src/commands/exitCode.ts +1 -1
- package/src/commands/extendMarkRange.ts +2 -2
- package/src/commands/first.ts +1 -1
- package/src/commands/focus.ts +1 -1
- package/src/commands/forEach.ts +1 -1
- package/src/commands/insertContent.ts +2 -2
- package/src/commands/insertContentAt.ts +3 -2
- package/src/commands/join.ts +1 -1
- package/src/commands/joinItemBackward.ts +1 -1
- package/src/commands/joinItemForward.ts +1 -1
- package/src/commands/joinTextblockBackward.ts +1 -1
- package/src/commands/joinTextblockForward.ts +1 -1
- package/src/commands/keyboardShortcut.ts +1 -1
- package/src/commands/lift.ts +2 -2
- package/src/commands/liftEmptyBlock.ts +1 -1
- package/src/commands/liftListItem.ts +2 -2
- package/src/commands/newlineInCode.ts +1 -1
- package/src/commands/resetAttributes.ts +2 -2
- package/src/commands/scrollIntoView.ts +1 -1
- package/src/commands/selectAll.ts +1 -1
- package/src/commands/selectNodeBackward.ts +1 -1
- package/src/commands/selectNodeForward.ts +1 -1
- package/src/commands/selectParentNode.ts +1 -1
- package/src/commands/selectTextblockEnd.ts +1 -1
- package/src/commands/selectTextblockStart.ts +1 -1
- package/src/commands/setContent.ts +2 -2
- package/src/commands/setMark.ts +3 -3
- package/src/commands/setMeta.ts +1 -1
- package/src/commands/setNode.ts +2 -2
- package/src/commands/setNodeSelection.ts +1 -1
- package/src/commands/setTextSelection.ts +1 -1
- package/src/commands/sinkListItem.ts +2 -2
- package/src/commands/splitBlock.ts +3 -2
- package/src/commands/splitListItem.ts +3 -2
- package/src/commands/toggleList.ts +3 -3
- package/src/commands/toggleMark.ts +2 -2
- package/src/commands/toggleNode.ts +2 -2
- package/src/commands/toggleWrap.ts +2 -2
- package/src/commands/undoInputRule.ts +1 -1
- package/src/commands/unsetAllMarks.ts +1 -1
- package/src/commands/unsetMark.ts +2 -2
- package/src/commands/updateAttributes.ts +3 -3
- package/src/commands/wrapIn.ts +2 -2
- package/src/commands/wrapInList.ts +2 -2
- package/src/extensions/focusEvents.ts +3 -1
- package/src/extensions/index.ts +1 -1
- package/src/helpers/combineTransactionSteps.ts +2 -2
- package/src/helpers/createChainableState.ts +1 -1
- package/src/helpers/createDocument.ts +2 -2
- package/src/helpers/createNodeFromContent.ts +3 -2
- package/src/helpers/defaultBlockAt.ts +1 -1
- package/src/helpers/findChildren.ts +2 -2
- package/src/helpers/findChildrenInRange.ts +2 -2
- package/src/helpers/findParentNode.ts +2 -2
- package/src/helpers/findParentNodeClosestToPos.ts +2 -2
- package/src/helpers/flattenExtensions.ts +1 -1
- package/src/helpers/generateHTML.ts +1 -1
- package/src/helpers/generateJSON.ts +1 -1
- package/src/helpers/generateText.ts +1 -1
- package/src/helpers/getAttributes.ts +2 -2
- package/src/helpers/getAttributesFromExtensions.ts +1 -1
- package/src/helpers/getChangedRanges.ts +2 -2
- package/src/helpers/getDebugJSON.ts +2 -2
- package/src/helpers/getExtensionField.ts +4 -4
- package/src/helpers/getHTMLFromFragment.ts +2 -1
- package/src/helpers/getMarkAttributes.ts +2 -2
- package/src/helpers/getMarkRange.ts +2 -2
- package/src/helpers/getMarkType.ts +1 -1
- package/src/helpers/getMarksBetween.ts +2 -2
- package/src/helpers/getNodeAtPosition.ts +2 -2
- package/src/helpers/getNodeAttributes.ts +2 -2
- package/src/helpers/getNodeType.ts +1 -1
- package/src/helpers/getRenderedAttributes.ts +2 -2
- package/src/helpers/getSchema.ts +3 -3
- package/src/helpers/getSchemaByResolvedExtensions.ts +3 -2
- package/src/helpers/getSchemaTypeByName.ts +1 -1
- package/src/helpers/getSchemaTypeNameByName.ts +1 -1
- package/src/helpers/getSplittedAttributes.ts +1 -1
- package/src/helpers/getText.ts +2 -2
- package/src/helpers/getTextBetween.ts +2 -2
- package/src/helpers/getTextContentFromNodes.ts +1 -1
- package/src/helpers/getTextSerializersFromSchema.ts +2 -2
- package/src/helpers/injectExtensionAttributesToParseRule.ts +2 -2
- package/src/helpers/isActive.ts +1 -1
- package/src/helpers/isAtEndOfNode.ts +1 -1
- package/src/helpers/isAtStartOfNode.ts +1 -1
- package/src/helpers/isExtensionRulesEnabled.ts +1 -1
- package/src/helpers/isList.ts +1 -1
- package/src/helpers/isMarkActive.ts +3 -3
- package/src/helpers/isNodeActive.ts +3 -3
- package/src/helpers/isNodeEmpty.ts +1 -1
- package/src/helpers/posToDOMRect.ts +1 -1
- package/src/helpers/resolveExtensions.ts +1 -1
- package/src/helpers/resolveFocusPosition.ts +2 -2
- package/src/helpers/selectionToInsertionEnd.ts +2 -1
- package/src/helpers/sortExtensions.ts +1 -1
- package/src/helpers/splitExtensions.ts +4 -4
- package/src/inputRules/markInputRule.ts +4 -3
- package/src/inputRules/nodeInputRule.ts +4 -3
- package/src/inputRules/textInputRule.ts +2 -1
- package/src/inputRules/textblockTypeInputRule.ts +4 -3
- package/src/inputRules/wrappingInputRule.ts +5 -4
- package/src/pasteRules/markPasteRule.ts +4 -3
- package/src/pasteRules/nodePasteRule.ts +4 -3
- package/src/pasteRules/textPasteRule.ts +2 -1
- package/src/types.ts +10 -10
- package/src/utilities/callOrReturn.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
CommandManager: () => CommandManager,
|
|
24
24
|
Editor: () => Editor,
|
|
25
25
|
Extension: () => Extension,
|
|
26
|
-
Fragment: () =>
|
|
26
|
+
Fragment: () => Fragment6,
|
|
27
27
|
InputRule: () => InputRule,
|
|
28
28
|
Mark: () => Mark,
|
|
29
29
|
MarkView: () => MarkView,
|
|
@@ -1939,7 +1939,7 @@ var Extendable = class {
|
|
|
1939
1939
|
const extension = new this.constructor({ ...this.config, ...extendedConfig });
|
|
1940
1940
|
extension.parent = this;
|
|
1941
1941
|
this.child = extension;
|
|
1942
|
-
extension.name =
|
|
1942
|
+
extension.name = "name" in extendedConfig ? extendedConfig.name : extension.parent.name;
|
|
1943
1943
|
return extension;
|
|
1944
1944
|
}
|
|
1945
1945
|
};
|
|
@@ -1973,6 +1973,12 @@ var Mark = class _Mark extends Extendable {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
return false;
|
|
1975
1975
|
}
|
|
1976
|
+
configure(options) {
|
|
1977
|
+
return super.configure(options);
|
|
1978
|
+
}
|
|
1979
|
+
extend(extendedConfig) {
|
|
1980
|
+
return super.extend(extendedConfig);
|
|
1981
|
+
}
|
|
1976
1982
|
};
|
|
1977
1983
|
|
|
1978
1984
|
// src/PasteRule.ts
|
|
@@ -2463,7 +2469,8 @@ __export(extensions_exports, {
|
|
|
2463
2469
|
FocusEvents: () => FocusEvents,
|
|
2464
2470
|
Keymap: () => Keymap,
|
|
2465
2471
|
Paste: () => Paste,
|
|
2466
|
-
Tabindex: () => Tabindex
|
|
2472
|
+
Tabindex: () => Tabindex,
|
|
2473
|
+
focusEventsPluginKey: () => focusEventsPluginKey
|
|
2467
2474
|
});
|
|
2468
2475
|
|
|
2469
2476
|
// src/extensions/clipboardTextSerializer.ts
|
|
@@ -2478,6 +2485,12 @@ var Extension = class _Extension extends Extendable {
|
|
|
2478
2485
|
static create(config = {}) {
|
|
2479
2486
|
return new _Extension(config);
|
|
2480
2487
|
}
|
|
2488
|
+
configure(options) {
|
|
2489
|
+
return super.configure(options);
|
|
2490
|
+
}
|
|
2491
|
+
extend(extendedConfig) {
|
|
2492
|
+
return super.extend(extendedConfig);
|
|
2493
|
+
}
|
|
2481
2494
|
};
|
|
2482
2495
|
|
|
2483
2496
|
// src/extensions/clipboardTextSerializer.ts
|
|
@@ -3894,13 +3907,14 @@ var Editable = Extension.create({
|
|
|
3894
3907
|
|
|
3895
3908
|
// src/extensions/focusEvents.ts
|
|
3896
3909
|
var import_state17 = require("@tiptap/pm/state");
|
|
3910
|
+
var focusEventsPluginKey = new import_state17.PluginKey("focusEvents");
|
|
3897
3911
|
var FocusEvents = Extension.create({
|
|
3898
3912
|
name: "focusEvents",
|
|
3899
3913
|
addProseMirrorPlugins() {
|
|
3900
3914
|
const { editor } = this;
|
|
3901
3915
|
return [
|
|
3902
3916
|
new import_state17.Plugin({
|
|
3903
|
-
key:
|
|
3917
|
+
key: focusEventsPluginKey,
|
|
3904
3918
|
props: {
|
|
3905
3919
|
handleDOMEvents: {
|
|
3906
3920
|
focus: (view, event) => {
|
|
@@ -4342,6 +4356,7 @@ function createStyleTag(style2, nonce, suffix) {
|
|
|
4342
4356
|
var Editor = class extends EventEmitter {
|
|
4343
4357
|
constructor(options = {}) {
|
|
4344
4358
|
super();
|
|
4359
|
+
this.css = null;
|
|
4345
4360
|
this.editorView = null;
|
|
4346
4361
|
this.isFocused = false;
|
|
4347
4362
|
/**
|
|
@@ -4413,6 +4428,9 @@ var Editor = class extends EventEmitter {
|
|
|
4413
4428
|
this.mount(this.options.element);
|
|
4414
4429
|
}
|
|
4415
4430
|
}
|
|
4431
|
+
/**
|
|
4432
|
+
* Attach the editor to the DOM, creating a new editor view.
|
|
4433
|
+
*/
|
|
4416
4434
|
mount(el) {
|
|
4417
4435
|
if (typeof document === "undefined") {
|
|
4418
4436
|
throw new Error(
|
|
@@ -4429,6 +4447,23 @@ var Editor = class extends EventEmitter {
|
|
|
4429
4447
|
this.isInitialized = true;
|
|
4430
4448
|
}, 0);
|
|
4431
4449
|
}
|
|
4450
|
+
/**
|
|
4451
|
+
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
4452
|
+
*/
|
|
4453
|
+
unmount() {
|
|
4454
|
+
var _a;
|
|
4455
|
+
if (this.editorView) {
|
|
4456
|
+
const dom = this.editorView.dom;
|
|
4457
|
+
if (dom == null ? void 0 : dom.editor) {
|
|
4458
|
+
delete dom.editor;
|
|
4459
|
+
}
|
|
4460
|
+
this.editorView.destroy();
|
|
4461
|
+
}
|
|
4462
|
+
this.editorView = null;
|
|
4463
|
+
this.isInitialized = false;
|
|
4464
|
+
(_a = this.css) == null ? void 0 : _a.remove();
|
|
4465
|
+
this.css = null;
|
|
4466
|
+
}
|
|
4432
4467
|
/**
|
|
4433
4468
|
* Returns the editor storage.
|
|
4434
4469
|
*/
|
|
@@ -4676,7 +4711,7 @@ var Editor = class extends EventEmitter {
|
|
|
4676
4711
|
dom.editor = this;
|
|
4677
4712
|
}
|
|
4678
4713
|
/**
|
|
4679
|
-
* Creates all node views.
|
|
4714
|
+
* Creates all node and mark views.
|
|
4680
4715
|
*/
|
|
4681
4716
|
createNodeViews() {
|
|
4682
4717
|
if (this.view.isDestroyed) {
|
|
@@ -4820,13 +4855,7 @@ var Editor = class extends EventEmitter {
|
|
|
4820
4855
|
*/
|
|
4821
4856
|
destroy() {
|
|
4822
4857
|
this.emit("destroy");
|
|
4823
|
-
|
|
4824
|
-
const dom = this.editorView.dom;
|
|
4825
|
-
if (dom && dom.editor) {
|
|
4826
|
-
delete dom.editor;
|
|
4827
|
-
}
|
|
4828
|
-
this.editorView.destroy();
|
|
4829
|
-
}
|
|
4858
|
+
this.unmount();
|
|
4830
4859
|
this.removeAllListeners();
|
|
4831
4860
|
}
|
|
4832
4861
|
/**
|
|
@@ -4995,7 +5024,7 @@ function wrappingInputRule(config) {
|
|
|
4995
5024
|
}
|
|
4996
5025
|
|
|
4997
5026
|
// src/jsx-runtime.ts
|
|
4998
|
-
function
|
|
5027
|
+
function Fragment6(props) {
|
|
4999
5028
|
return props.children;
|
|
5000
5029
|
}
|
|
5001
5030
|
var h = (tag, attributes) => {
|
|
@@ -5072,6 +5101,12 @@ var Node3 = class _Node extends Extendable {
|
|
|
5072
5101
|
static create(config = {}) {
|
|
5073
5102
|
return new _Node(config);
|
|
5074
5103
|
}
|
|
5104
|
+
configure(options) {
|
|
5105
|
+
return super.configure(options);
|
|
5106
|
+
}
|
|
5107
|
+
extend(extendedConfig) {
|
|
5108
|
+
return super.extend(extendedConfig);
|
|
5109
|
+
}
|
|
5075
5110
|
};
|
|
5076
5111
|
|
|
5077
5112
|
// src/NodeView.ts
|