@tiptap/core 3.5.2 → 3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.5.2",
4
+ "version": "3.6.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,10 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "^3.5.2"
55
+ "@tiptap/pm": "^3.6.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@tiptap/pm": "^3.5.2"
58
+ "@tiptap/pm": "^3.6.0"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
package/src/Editor.ts CHANGED
@@ -304,7 +304,7 @@ export class Editor extends EventEmitter<EditorEvents> {
304
304
  this.editorState = state
305
305
  },
306
306
  dispatch: (tr: Transaction): ReturnType<EditorView['dispatch']> => {
307
- this.editorState = this.state.apply(tr)
307
+ this.dispatchTransaction(tr)
308
308
  },
309
309
 
310
310
  // Stub some commonly accessed properties to prevent errors
@@ -500,7 +500,7 @@ export class Editor extends EventEmitter<EditorEvents> {
500
500
  /**
501
501
  * Creates a ProseMirror view.
502
502
  */
503
- private createView(element: NonNullable<EditorOptions['element']> & {}): void {
503
+ private createView(element: NonNullable<EditorOptions['element']>): void {
504
504
  this.editorView = new EditorView(element, {
505
505
  ...this.options.editorProps,
506
506
  attributes: {
package/src/types.ts CHANGED
@@ -261,11 +261,13 @@ export type EnableRules = (AnyExtension | string)[] | boolean
261
261
 
262
262
  export interface EditorOptions {
263
263
  /**
264
- * The element or selector to bind the editor to
265
- * If `null` is passed, the editor will not be mounted automatically
266
- * If a function is passed, it will be called with the editor's root element
264
+ * The element to bind the editor to:
265
+ * - If an `Element` is passed, the editor will be mounted appended to that element
266
+ * - If `null` is passed, the editor will not be mounted automatically
267
+ * - If an object with a `mount` property is passed, the editor will be mounted to that element
268
+ * - If a function is passed, it will be called with the editor's element, which should place the editor within the document
267
269
  */
268
- element: Element | null
270
+ element: Element | { mount: HTMLElement } | ((editor: HTMLElement) => void) | null
269
271
  /**
270
272
  * The content of the editor (HTML, JSON, or a JSON array)
271
273
  */