Skip to content

Commit 1395f04

Browse files
committed
[fix] Fix equationBase show in the new tiptap version: all selection will make the node selected.
1 parent 2a13e02 commit 1395f04

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/editor/src/components/custom/source/equationBase.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<script>
7171
import onecolor from "onecolor";
7272
import { NodeViewWrapper } from "@tiptap/vue-3";
73-
import { TextSelection } from "@tiptap/pm/state";
73+
import { NodeSelection, TextSelection } from "@tiptap/pm/state";
7474
7575
import katex from "katex";
7676
import "@/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 });

0 commit comments

Comments
 (0)