@tiptap/vue-2
Advanced tools
Comparing version 2.0.0-beta.40 to 2.0.0-beta.41
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.0.0-beta.41](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.40...@tiptap/vue-2@2.0.0-beta.41) (2021-07-27) | ||
### Features | ||
* add ignoreMutation option to NodeViewRenderer, fix [#1538](https://github.com/ueberdosis/tiptap/issues/1538) ([651e691](https://github.com/ueberdosis/tiptap/commit/651e6911e3ea5407df6a48783ee16733e0a4f474)) | ||
# [2.0.0-beta.40](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.39...@tiptap/vue-2@2.0.0-beta.40) (2021-07-26) | ||
@@ -8,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { NodeViewRenderer } from '@tiptap/core'; | ||
import { NodeViewRenderer, NodeViewRendererOptions } from '@tiptap/core'; | ||
import { Decoration } from 'prosemirror-view'; | ||
@@ -42,6 +42,11 @@ import { Node as ProseMirrorNode } from 'prosemirror-model'; | ||
}; | ||
export interface VueNodeViewRendererOptions { | ||
stopEvent: ((event: Event) => boolean) | null; | ||
update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null; | ||
export interface VueNodeViewRendererOptions extends NodeViewRendererOptions { | ||
update: ((props: { | ||
oldNode: ProseMirrorNode; | ||
oldDecorations: Decoration[]; | ||
newNode: ProseMirrorNode; | ||
newDecorations: Decoration[]; | ||
updateProps: () => void; | ||
}) => boolean) | null; | ||
} | ||
export declare function VueNodeViewRenderer(component: Vue | VueConstructor, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer; |
@@ -256,4 +256,18 @@ 'use strict'; | ||
update(node, decorations) { | ||
const updateProps = (props) => { | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps(props); | ||
}; | ||
if (typeof this.options.update === 'function') { | ||
return this.options.update(node, decorations); | ||
const oldNode = this.node; | ||
const oldDecorations = this.decorations; | ||
this.node = node; | ||
this.decorations = decorations; | ||
return this.options.update({ | ||
oldNode, | ||
oldDecorations, | ||
newNode: node, | ||
newDecorations: decorations, | ||
updateProps, | ||
}); | ||
} | ||
@@ -268,4 +282,3 @@ if (node.type !== this.node.type) { | ||
this.decorations = decorations; | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps({ node, decorations }); | ||
updateProps(); | ||
return true; | ||
@@ -272,0 +285,0 @@ } |
@@ -249,4 +249,18 @@ import { Editor as Editor$1, NodeView } from '@tiptap/core'; | ||
update(node, decorations) { | ||
const updateProps = (props) => { | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps(props); | ||
}; | ||
if (typeof this.options.update === 'function') { | ||
return this.options.update(node, decorations); | ||
const oldNode = this.node; | ||
const oldDecorations = this.decorations; | ||
this.node = node; | ||
this.decorations = decorations; | ||
return this.options.update({ | ||
oldNode, | ||
oldDecorations, | ||
newNode: node, | ||
newDecorations: decorations, | ||
updateProps, | ||
}); | ||
} | ||
@@ -261,4 +275,3 @@ if (node.type !== this.node.type) { | ||
this.decorations = decorations; | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps({ node, decorations }); | ||
updateProps(); | ||
return true; | ||
@@ -265,0 +278,0 @@ } |
@@ -253,4 +253,18 @@ (function (global, factory) { | ||
update(node, decorations) { | ||
const updateProps = (props) => { | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps(props); | ||
}; | ||
if (typeof this.options.update === 'function') { | ||
return this.options.update(node, decorations); | ||
const oldNode = this.node; | ||
const oldDecorations = this.decorations; | ||
this.node = node; | ||
this.decorations = decorations; | ||
return this.options.update({ | ||
oldNode, | ||
oldDecorations, | ||
newNode: node, | ||
newDecorations: decorations, | ||
updateProps, | ||
}); | ||
} | ||
@@ -265,4 +279,3 @@ if (node.type !== this.node.type) { | ||
this.decorations = decorations; | ||
this.decorationClasses.value = this.getDecorationClasses(); | ||
this.renderer.updateProps({ node, decorations }); | ||
updateProps(); | ||
return true; | ||
@@ -269,0 +282,0 @@ } |
{ | ||
"name": "@tiptap/vue-2", | ||
"description": "Vue components for tiptap", | ||
"version": "2.0.0-beta.40", | ||
"version": "2.0.0-beta.41", | ||
"homepage": "https://tiptap.dev", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "345ea8cf8abba6422dabc6e548594fb8e2c30409" | ||
"gitHead": "51fef7d49aad78310b20c174e425553a878ffbe6" | ||
} |
@@ -6,2 +6,3 @@ import { | ||
NodeViewRendererProps, | ||
NodeViewRendererOptions, | ||
} from '@tiptap/core' | ||
@@ -50,8 +51,13 @@ import { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view' | ||
export interface VueNodeViewRendererOptions { | ||
stopEvent: ((event: Event) => boolean) | null, | ||
update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null, | ||
export interface VueNodeViewRendererOptions extends NodeViewRendererOptions { | ||
update: ((props: { | ||
oldNode: ProseMirrorNode, | ||
oldDecorations: Decoration[], | ||
newNode: ProseMirrorNode, | ||
newDecorations: Decoration[], | ||
updateProps: () => void, | ||
}) => boolean) | null, | ||
} | ||
class VueNodeView extends NodeView<(Vue | VueConstructor), Editor> { | ||
class VueNodeView extends NodeView<(Vue | VueConstructor), Editor, VueNodeViewRendererOptions> { | ||
@@ -119,4 +125,21 @@ renderer!: VueRenderer | ||
update(node: ProseMirrorNode, decorations: Decoration[]) { | ||
const updateProps = (props?: Record<string, any>) => { | ||
this.decorationClasses.value = this.getDecorationClasses() | ||
this.renderer.updateProps(props) | ||
} | ||
if (typeof this.options.update === 'function') { | ||
return this.options.update(node, decorations) | ||
const oldNode = this.node | ||
const oldDecorations = this.decorations | ||
this.node = node | ||
this.decorations = decorations | ||
return this.options.update({ | ||
oldNode, | ||
oldDecorations, | ||
newNode: node, | ||
newDecorations: decorations, | ||
updateProps, | ||
}) | ||
} | ||
@@ -134,5 +157,5 @@ | ||
this.decorations = decorations | ||
this.decorationClasses.value = this.getDecorationClasses() | ||
this.renderer.updateProps({ node, decorations }) | ||
updateProps() | ||
return true | ||
@@ -139,0 +162,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
117944
1591