@tiptap/core 3.0.0-beta.19 → 3.0.0-beta.21
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/chunk-GRT2MR5L.js +59 -0
- package/dist/chunk-GRT2MR5L.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-TH7LERQR.js +34 -0
- package/dist/chunk-TH7LERQR.js.map +1 -0
- package/dist/chunk-UNIMJOD2.js +1010 -0
- package/dist/chunk-UNIMJOD2.js.map +1 -0
- package/dist/esm-7BF7U2WM.js +47055 -0
- package/dist/esm-7BF7U2WM.js.map +1 -0
- package/dist/index.cjs +54030 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/json-diff-main-ASELUCBE.js +4742 -0
- package/dist/json-diff-main-ASELUCBE.js.map +1 -0
- package/dist/json-diff-worker-ET432FKY.js +398 -0
- package/dist/json-diff-worker-ET432FKY.js.map +1 -0
- package/package.json +5 -3
- package/src/Editor.ts +43 -0
- package/src/commands/cut.ts +1 -1
- package/src/types.ts +12 -0
package/dist/index.d.cts
CHANGED
|
@@ -1172,6 +1172,18 @@ interface EditorOptions {
|
|
|
1172
1172
|
* @default false
|
|
1173
1173
|
*/
|
|
1174
1174
|
emitContentError: boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
|
+
*
|
|
1178
|
+
* Requires having the `prosemirror-dev-tools` npm package installed.
|
|
1179
|
+
* @type boolean
|
|
1180
|
+
* @default false
|
|
1181
|
+
* @example
|
|
1182
|
+
* ```js
|
|
1183
|
+
* enableDevTools: true
|
|
1184
|
+
* ```
|
|
1185
|
+
*/
|
|
1186
|
+
enableDevTools: boolean;
|
|
1175
1187
|
/**
|
|
1176
1188
|
* Called before the editor is constructed.
|
|
1177
1189
|
*/
|
|
@@ -2912,6 +2924,25 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2912
2924
|
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
2913
2925
|
*/
|
|
2914
2926
|
unmount(): void;
|
|
2927
|
+
/**
|
|
2928
|
+
*
|
|
2929
|
+
* @returns
|
|
2930
|
+
*/
|
|
2931
|
+
/**
|
|
2932
|
+
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
|
+
*
|
|
2934
|
+
* This method dynamically imports the `prosemirror-dev-tools` package and applies it to the current
|
|
2935
|
+
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
|
+
*
|
|
2937
|
+
* @private
|
|
2938
|
+
* @remarks
|
|
2939
|
+
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
|
+
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
+
* - If the `prosemirror-dev-tools` package is missing, a warning is shown in the console.
|
|
2942
|
+
*
|
|
2943
|
+
* @returns {void}
|
|
2944
|
+
*/
|
|
2945
|
+
private applyDevTools;
|
|
2915
2946
|
/**
|
|
2916
2947
|
* Returns the editor storage.
|
|
2917
2948
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1172,6 +1172,18 @@ interface EditorOptions {
|
|
|
1172
1172
|
* @default false
|
|
1173
1173
|
*/
|
|
1174
1174
|
emitContentError: boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
|
+
*
|
|
1178
|
+
* Requires having the `prosemirror-dev-tools` npm package installed.
|
|
1179
|
+
* @type boolean
|
|
1180
|
+
* @default false
|
|
1181
|
+
* @example
|
|
1182
|
+
* ```js
|
|
1183
|
+
* enableDevTools: true
|
|
1184
|
+
* ```
|
|
1185
|
+
*/
|
|
1186
|
+
enableDevTools: boolean;
|
|
1175
1187
|
/**
|
|
1176
1188
|
* Called before the editor is constructed.
|
|
1177
1189
|
*/
|
|
@@ -2912,6 +2924,25 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2912
2924
|
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
2913
2925
|
*/
|
|
2914
2926
|
unmount(): void;
|
|
2927
|
+
/**
|
|
2928
|
+
*
|
|
2929
|
+
* @returns
|
|
2930
|
+
*/
|
|
2931
|
+
/**
|
|
2932
|
+
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
|
+
*
|
|
2934
|
+
* This method dynamically imports the `prosemirror-dev-tools` package and applies it to the current
|
|
2935
|
+
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
|
+
*
|
|
2937
|
+
* @private
|
|
2938
|
+
* @remarks
|
|
2939
|
+
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
|
+
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
+
* - If the `prosemirror-dev-tools` package is missing, a warning is shown in the console.
|
|
2942
|
+
*
|
|
2943
|
+
* @returns {void}
|
|
2944
|
+
*/
|
|
2945
|
+
private applyDevTools;
|
|
2915
2946
|
/**
|
|
2916
2947
|
* Returns the editor storage.
|
|
2917
2948
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-PR4QN5HX.js";
|
|
6
4
|
|
|
7
5
|
// src/helpers/createChainableState.ts
|
|
8
6
|
function createChainableState(config) {
|
|
@@ -2552,7 +2550,7 @@ var cut = (originRange, targetPos) => ({ editor, tr }) => {
|
|
|
2552
2550
|
tr.deleteRange(originRange.from, originRange.to);
|
|
2553
2551
|
const newPos = tr.mapping.map(targetPos);
|
|
2554
2552
|
tr.insert(newPos, contentSlice.content);
|
|
2555
|
-
tr.setSelection(new TextSelection3(tr.doc.resolve(newPos - 1)));
|
|
2553
|
+
tr.setSelection(new TextSelection3(tr.doc.resolve(Math.max(newPos - 1, 0))));
|
|
2556
2554
|
return true;
|
|
2557
2555
|
};
|
|
2558
2556
|
|
|
@@ -4299,6 +4297,7 @@ var Editor = class extends EventEmitter {
|
|
|
4299
4297
|
enablePasteRules: true,
|
|
4300
4298
|
enableCoreExtensions: true,
|
|
4301
4299
|
enableContentCheck: false,
|
|
4300
|
+
enableDevTools: false,
|
|
4302
4301
|
emitContentError: false,
|
|
4303
4302
|
onBeforeCreate: () => null,
|
|
4304
4303
|
onCreate: () => null,
|
|
@@ -4381,6 +4380,38 @@ var Editor = class extends EventEmitter {
|
|
|
4381
4380
|
(_a = this.css) == null ? void 0 : _a.remove();
|
|
4382
4381
|
this.css = null;
|
|
4383
4382
|
}
|
|
4383
|
+
/**
|
|
4384
|
+
*
|
|
4385
|
+
* @returns
|
|
4386
|
+
*/
|
|
4387
|
+
/**
|
|
4388
|
+
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
4389
|
+
*
|
|
4390
|
+
* This method dynamically imports the `prosemirror-dev-tools` package and applies it to the current
|
|
4391
|
+
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
4392
|
+
*
|
|
4393
|
+
* @private
|
|
4394
|
+
* @remarks
|
|
4395
|
+
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
4396
|
+
* - If the editor view is not available, the dev tools are not applied.
|
|
4397
|
+
* - If the `prosemirror-dev-tools` package is missing, a warning is shown in the console.
|
|
4398
|
+
*
|
|
4399
|
+
* @returns {void}
|
|
4400
|
+
*/
|
|
4401
|
+
applyDevTools() {
|
|
4402
|
+
if (typeof window === "undefined" || !this.options.enableDevTools) {
|
|
4403
|
+
return;
|
|
4404
|
+
}
|
|
4405
|
+
import("./esm-7BF7U2WM.js").then(({ default: apply }) => {
|
|
4406
|
+
if (!this.editorView) {
|
|
4407
|
+
return;
|
|
4408
|
+
}
|
|
4409
|
+
apply(this.editorView);
|
|
4410
|
+
}).catch(() => {
|
|
4411
|
+
console.warn("[Tiptap warning]: Devtools are enabled but `prosemirror-dev-tools` is not installed.");
|
|
4412
|
+
console.warn("Install 'prosemirror-dev-tools' as a dev dependency to use the dev tools.");
|
|
4413
|
+
});
|
|
4414
|
+
}
|
|
4384
4415
|
/**
|
|
4385
4416
|
* Returns the editor storage.
|
|
4386
4417
|
*/
|
|
@@ -4618,6 +4649,9 @@ var Editor = class extends EventEmitter {
|
|
|
4618
4649
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
4619
4650
|
state: this.editorState
|
|
4620
4651
|
});
|
|
4652
|
+
if (this.options.enableDevTools) {
|
|
4653
|
+
this.applyDevTools();
|
|
4654
|
+
}
|
|
4621
4655
|
const newState = this.state.reconfigure({
|
|
4622
4656
|
plugins: this.extensionManager.plugins
|
|
4623
4657
|
});
|