From 65b57b3a13bf296fa7e5891f85ee905dd292c5ee Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Wed, 1 Mar 2023 18:32:16 +0200 Subject: [PATCH] reset counter --- .../src/ImageService/plugins/captionPlugin.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wax-prosemirror-services/src/ImageService/plugins/captionPlugin.js b/wax-prosemirror-services/src/ImageService/plugins/captionPlugin.js index 5df7f5cfc..2061eed54 100644 --- a/wax-prosemirror-services/src/ImageService/plugins/captionPlugin.js +++ b/wax-prosemirror-services/src/ImageService/plugins/captionPlugin.js @@ -78,6 +78,9 @@ const captionPlugin = key => view.state.selection.$head.path[6].type.name === 'figcaption' ) { counter += 1; + setTimeout(() => { + counter = 0; + }, 1500); } if ( @@ -95,13 +98,13 @@ const captionPlugin = key => } }, ); - const figcap = document.getElementById(captionId); + const figCapEl = document.getElementById(captionId); view.dispatch( view.state.tr.setSelection( NodeSelection.create( view.state.doc, - view.posAtDOM(figcap.parentElement), + view.posAtDOM(figCapEl.parentElement), ), ), ); @@ -116,9 +119,7 @@ const captionPlugin = key => if (figCap[6] && figCap[6].type.name === 'figcaption') { const figCapEl = document.getElementById(figCap[6].attrs.id); - if ( - figCapEl.parentElement.firstChild.tagName === 'figCapElTION' - ) { + if (figCapEl.parentElement.firstChild.tagName === 'FIGCAPTION') { figCapEl.parentElement.remove(); } } -- GitLab