File tree Expand file tree Collapse file tree
packages/editor/src/components/custom/source Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070<script >
7171import onecolor from " onecolor" ;
7272import { NodeViewWrapper } from " @tiptap/vue-3" ;
73- import { TextSelection } from " @tiptap/pm/state" ;
73+ import { NodeSelection , TextSelection } from " @tiptap/pm/state" ;
7474
7575import katex from " katex" ;
7676import " @/packages/editor/src/styles/katex.scss" ;
@@ -178,7 +178,7 @@ export default {
178178 this .thisForeground = val;
179179 },
180180 selected (val ) {
181- if (val) this .show ();
181+ if (val && this . isCurrentNodeSelection () ) this .show ();
182182 },
183183 },
184184 computed: {
@@ -252,6 +252,13 @@ export default {
252252 if (this .$refs .input ) this .$refs .input .focus ();
253253 }, 300 );
254254 },
255+ isCurrentNodeSelection () {
256+ const { selection } = this .editor .state ;
257+ return (
258+ selection instanceof NodeSelection &&
259+ selection .from === this .getPos ()
260+ );
261+ },
255262 close (confirm = true ) {
256263 this .showPopper = false ;
257264 if (confirm) this .updateAttributes ({ value: this .thisValue });
You can’t perform that action at this time.
0 commit comments