@tiptap/core
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.1...@tiptap/core@2.0.0-beta.2) (2021-03-09) | ||
**Note:** Version bump only for package @tiptap/core | ||
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-alpha.22...@tiptap/core@2.0.0-beta.1) (2021-03-05) | ||
@@ -8,0 +16,0 @@ |
@@ -94,3 +94,3 @@ import { Plugin, Transaction } from 'prosemirror-state'; | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options; | ||
@@ -100,2 +100,9 @@ editor: Editor; | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options; | ||
editor: Editor; | ||
}) => void) | null; | ||
/** | ||
* The editor state has changed. | ||
@@ -102,0 +109,0 @@ */ |
@@ -101,3 +101,3 @@ import { DOMOutputSpec, MarkSpec, Mark as ProseMirrorMark, MarkType } from 'prosemirror-model'; | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options; | ||
@@ -108,2 +108,10 @@ editor: Editor; | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options; | ||
editor: Editor; | ||
type: MarkType; | ||
}) => void) | null; | ||
/** | ||
* The editor state has changed. | ||
@@ -110,0 +118,0 @@ */ |
@@ -101,3 +101,3 @@ import { DOMOutputSpec, NodeSpec, Node as ProseMirrorNode, NodeType } from 'prosemirror-model'; | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options; | ||
@@ -108,2 +108,10 @@ editor: Editor; | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options; | ||
editor: Editor; | ||
type: NodeType; | ||
}) => void) | null; | ||
/** | ||
* The editor state has changed. | ||
@@ -110,0 +118,0 @@ */ |
@@ -22,12 +22,24 @@ import { Node as ProseMirrorNode, Mark as ProseMirrorMark, ParseOptions } from 'prosemirror-model'; | ||
enablePasteRules: boolean; | ||
onCreate: () => void; | ||
onUpdate: () => void; | ||
onSelection: () => void; | ||
onCreate: (props: { | ||
editor: Editor; | ||
}) => void; | ||
onUpdate: (props: { | ||
editor: Editor; | ||
}) => void; | ||
onViewUpdate: (props: { | ||
editor: Editor; | ||
}) => void; | ||
onSelectionUpdate: (props: { | ||
editor: Editor; | ||
}) => void; | ||
onTransaction: (props: { | ||
editor: Editor; | ||
transaction: Transaction; | ||
}) => void; | ||
onFocus: (props: { | ||
editor: Editor; | ||
event: FocusEvent; | ||
}) => void; | ||
onBlur: (props: { | ||
editor: Editor; | ||
event: FocusEvent; | ||
@@ -34,0 +46,0 @@ }) => void; |
{ | ||
"name": "@tiptap/core", | ||
"description": "headless rich text editor", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"homepage": "https://tiptap.dev", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "67781052b0ac805fbf82099a50e27f1dd28f8061" | ||
"gitHead": "bf357dd7cb3da87d494dd8843e90505bba9214ca" | ||
} |
@@ -58,3 +58,4 @@ import { EditorState, Plugin, Transaction } from 'prosemirror-state' | ||
onUpdate: () => null, | ||
onSelection: () => null, | ||
onSelectionUpdate: () => null, | ||
onViewUpdate: () => null, | ||
onTransaction: () => null, | ||
@@ -76,3 +77,4 @@ onFocus: () => null, | ||
this.on('update', this.options.onUpdate) | ||
this.on('selection', this.options.onSelection) | ||
this.on('selectionUpdate', this.options.onSelectionUpdate) | ||
this.on('viewUpdate', this.options.onViewUpdate) | ||
this.on('transaction', this.options.onTransaction) | ||
@@ -85,3 +87,3 @@ this.on('focus', this.options.onFocus) | ||
this.commands.focus(this.options.autofocus) | ||
this.emit('create') | ||
this.emit('create', { editor: this }) | ||
}, 0) | ||
@@ -228,3 +230,5 @@ } | ||
view: () => ({ | ||
update: () => this.emit('viewUpdate'), | ||
update: () => this.emit('viewUpdate', { | ||
editor: this, | ||
}), | ||
}), | ||
@@ -321,6 +325,11 @@ }), | ||
this.view.updateState(state) | ||
this.emit('transaction', { transaction }) | ||
this.emit('transaction', { | ||
editor: this, | ||
transaction, | ||
}) | ||
if (selectionHasChanged) { | ||
this.emit('selection') | ||
this.emit('selectionUpdate', { | ||
editor: this, | ||
}) | ||
} | ||
@@ -332,7 +341,13 @@ | ||
if (focus) { | ||
this.emit('focus', { event: focus.event }) | ||
this.emit('focus', { | ||
editor: this, | ||
event: focus.event, | ||
}) | ||
} | ||
if (blur) { | ||
this.emit('blur', { event: blur.event }) | ||
this.emit('blur', { | ||
editor: this, | ||
event: blur.event, | ||
}) | ||
} | ||
@@ -344,3 +359,6 @@ | ||
this.emit('update', { transaction }) | ||
this.emit('update', { | ||
editor: this, | ||
transaction, | ||
}) | ||
} | ||
@@ -347,0 +365,0 @@ |
@@ -115,3 +115,3 @@ import { Plugin, Transaction } from 'prosemirror-state' | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options, | ||
@@ -122,2 +122,10 @@ editor: Editor, | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options, | ||
editor: Editor, | ||
}) => void) | null, | ||
/** | ||
* The editor state has changed. | ||
@@ -124,0 +132,0 @@ */ |
@@ -43,6 +43,10 @@ import { keymap } from 'prosemirror-keymap' | ||
if (typeof extension.config.onSelection === 'function') { | ||
this.editor.on('selection', extension.config.onSelection.bind(context)) | ||
if (typeof extension.config.onSelectionUpdate === 'function') { | ||
this.editor.on('selectionUpdate', extension.config.onSelectionUpdate.bind(context)) | ||
} | ||
if (typeof extension.config.onViewUpdate === 'function') { | ||
this.editor.on('viewUpdate', extension.config.onViewUpdate.bind(context)) | ||
} | ||
if (typeof extension.config.onTransaction === 'function') { | ||
@@ -49,0 +53,0 @@ this.editor.on('transaction', extension.config.onTransaction.bind(context)) |
@@ -132,3 +132,3 @@ import { | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options, | ||
@@ -140,2 +140,11 @@ editor: Editor, | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options, | ||
editor: Editor, | ||
type: MarkType, | ||
}) => void) | null, | ||
/** | ||
* The editor state has changed. | ||
@@ -142,0 +151,0 @@ */ |
@@ -133,3 +133,3 @@ import { | ||
*/ | ||
onSelection?: ((this: { | ||
onSelectionUpdate?: ((this: { | ||
options: Options, | ||
@@ -141,2 +141,11 @@ editor: Editor, | ||
/** | ||
* The view has changed. | ||
*/ | ||
onViewUpdate?: ((this: { | ||
options: Options, | ||
editor: Editor, | ||
type: NodeType, | ||
}) => void) | null, | ||
/** | ||
* The editor state has changed. | ||
@@ -143,0 +152,0 @@ */ |
@@ -44,8 +44,9 @@ import { | ||
enablePasteRules: boolean, | ||
onCreate: () => void, | ||
onUpdate: () => void, | ||
onSelection: () => void, | ||
onTransaction: (props: { transaction: Transaction }) => void, | ||
onFocus: (props: { event: FocusEvent }) => void, | ||
onBlur: (props: { event: FocusEvent }) => void, | ||
onCreate: (props: { editor: Editor }) => void, | ||
onUpdate: (props: { editor: Editor }) => void, | ||
onViewUpdate: (props: { editor: Editor }) => void, | ||
onSelectionUpdate: (props: { editor: Editor }) => void, | ||
onTransaction: (props: { editor: Editor, transaction: Transaction }) => void, | ||
onFocus: (props: { editor: Editor, event: FocusEvent }) => void, | ||
onBlur: (props: { editor: Editor, event: FocusEvent }) => void, | ||
onDestroy: () => void, | ||
@@ -52,0 +53,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2255891
14280