@tiptap/core 3.0.0-beta.15 → 3.0.0-beta.17
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 +27 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +27 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Extension.ts +14 -4
- package/src/Mark.ts +12 -4
- package/src/Node.ts +12 -4
- package/src/PasteRule.ts +1 -1
- package/src/commands/insertContentAt.ts +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1951,8 +1951,13 @@ var Mark = class _Mark extends Extendable {
|
|
|
1951
1951
|
super(...arguments);
|
|
1952
1952
|
this.type = "mark";
|
|
1953
1953
|
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Create a new Mark instance
|
|
1956
|
+
* @param config - Mark configuration object or a function that returns a configuration object
|
|
1957
|
+
*/
|
|
1954
1958
|
static create(config = {}) {
|
|
1955
|
-
|
|
1959
|
+
const resolvedConfig = typeof config === "function" ? config() : config;
|
|
1960
|
+
return new _Mark(resolvedConfig);
|
|
1956
1961
|
}
|
|
1957
1962
|
static handleExit({ editor, mark }) {
|
|
1958
1963
|
const { tr } = editor.state;
|
|
@@ -1978,7 +1983,8 @@ var Mark = class _Mark extends Extendable {
|
|
|
1978
1983
|
return super.configure(options);
|
|
1979
1984
|
}
|
|
1980
1985
|
extend(extendedConfig) {
|
|
1981
|
-
|
|
1986
|
+
const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
|
|
1987
|
+
return super.extend(resolvedConfig);
|
|
1982
1988
|
}
|
|
1983
1989
|
};
|
|
1984
1990
|
|
|
@@ -2146,7 +2152,7 @@ function pasteRulesPlugin(props) {
|
|
|
2146
2152
|
dropEvent = event;
|
|
2147
2153
|
if (!isDroppedFromProseMirror) {
|
|
2148
2154
|
const dragFromOtherEditor = tiptapDragFromOtherEditor;
|
|
2149
|
-
if (dragFromOtherEditor) {
|
|
2155
|
+
if (dragFromOtherEditor == null ? void 0 : dragFromOtherEditor.isEditable) {
|
|
2150
2156
|
setTimeout(() => {
|
|
2151
2157
|
const selection = dragFromOtherEditor.state.selection;
|
|
2152
2158
|
if (selection) {
|
|
@@ -2483,14 +2489,20 @@ var Extension = class _Extension extends Extendable {
|
|
|
2483
2489
|
super(...arguments);
|
|
2484
2490
|
this.type = "extension";
|
|
2485
2491
|
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Create a new Extension instance
|
|
2494
|
+
* @param config - Extension configuration object or a function that returns a configuration object
|
|
2495
|
+
*/
|
|
2486
2496
|
static create(config = {}) {
|
|
2487
|
-
|
|
2497
|
+
const resolvedConfig = typeof config === "function" ? config() : config;
|
|
2498
|
+
return new _Extension(resolvedConfig);
|
|
2488
2499
|
}
|
|
2489
2500
|
configure(options) {
|
|
2490
2501
|
return super.configure(options);
|
|
2491
2502
|
}
|
|
2492
2503
|
extend(extendedConfig) {
|
|
2493
|
-
|
|
2504
|
+
const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
|
|
2505
|
+
return super.extend(resolvedConfig);
|
|
2494
2506
|
}
|
|
2495
2507
|
};
|
|
2496
2508
|
|
|
@@ -2910,7 +2922,8 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
|
|
|
2910
2922
|
newContent = content;
|
|
2911
2923
|
const fromSelectionAtStart = selection.$from.parentOffset === 0;
|
|
2912
2924
|
const isTextSelection2 = selection.$from.node().isText || selection.$from.node().isTextblock;
|
|
2913
|
-
|
|
2925
|
+
const hasContent = selection.$from.node().content.size > 0;
|
|
2926
|
+
if (fromSelectionAtStart && isTextSelection2 && hasContent) {
|
|
2914
2927
|
from = Math.max(0, from - 1);
|
|
2915
2928
|
}
|
|
2916
2929
|
tr.replaceWith(from, to, newContent);
|
|
@@ -5141,14 +5154,20 @@ var Node3 = class _Node extends Extendable {
|
|
|
5141
5154
|
super(...arguments);
|
|
5142
5155
|
this.type = "node";
|
|
5143
5156
|
}
|
|
5157
|
+
/**
|
|
5158
|
+
* Create a new Node instance
|
|
5159
|
+
* @param config - Node configuration object or a function that returns a configuration object
|
|
5160
|
+
*/
|
|
5144
5161
|
static create(config = {}) {
|
|
5145
|
-
|
|
5162
|
+
const resolvedConfig = typeof config === "function" ? config() : config;
|
|
5163
|
+
return new _Node(resolvedConfig);
|
|
5146
5164
|
}
|
|
5147
5165
|
configure(options) {
|
|
5148
5166
|
return super.configure(options);
|
|
5149
5167
|
}
|
|
5150
5168
|
extend(extendedConfig) {
|
|
5151
|
-
|
|
5169
|
+
const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
|
|
5170
|
+
return super.extend(resolvedConfig);
|
|
5152
5171
|
}
|
|
5153
5172
|
};
|
|
5154
5173
|
|