From 3128c5eb9dba8411b973384ae73120e998f3c9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 23 Nov 2020 18:31:35 +0100 Subject: [PATCH] improve ignoreMutation --- packages/vue/src/VueRenderer.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/vue/src/VueRenderer.ts b/packages/vue/src/VueRenderer.ts index 40ec5394..dbca0f82 100644 --- a/packages/vue/src/VueRenderer.ts +++ b/packages/vue/src/VueRenderer.ts @@ -40,8 +40,8 @@ class VueNodeView implements NodeView { const { id } = this const Inner = Vue.extend({ - functional: true, - // inheritAttrs: false, + // functional: true, + inheritAttrs: false, props: { as: { type: String, @@ -50,8 +50,8 @@ class VueNodeView implements NodeView { }, render(createElement, context) { return createElement( - context.props.as, { - // this.as, { + // context.props.as, { + this.as, { style: { whiteSpace: 'pre-wrap', }, @@ -114,19 +114,18 @@ class VueNodeView implements NodeView { } ignoreMutation(mutation: MutationRecord | { type: 'selection'; target: Element }) { - // return false - // if (mutation.type === 'selection') { - // console.log({ mutation }) - // return true - // } - // return true - // console.log({ mutation }) + if (mutation.type === 'selection') { + return true + } if (!this.contentDOM) { return true } - return !this.contentDOM.contains(mutation.target) + const contentDOMHasChanged = !this.contentDOM.contains(mutation.target) + || this.contentDOM === mutation.target + + return contentDOMHasChanged } update(node: ProseMirrorNode, decorations: Decoration[]) {