File tree Expand file tree Collapse file tree 3 files changed +36
-10
lines changed
layouts/PagesLayout/MainToolbar Expand file tree Collapse file tree 3 files changed +36
-10
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import { VueNodeViewRenderer } from '@tiptap/vue-3';
33
44import NodeView from './NodeView.vue' ;
55
6+ declare module '@tiptap/core' {
7+ interface Commands < ReturnType > {
8+ inlineMath : {
9+ addInlineMath : ( ) => ReturnType ;
10+ } ;
11+ }
12+ }
13+
614export const InlineMathExtension = Node . create ( {
715 name : 'inlineMath' ,
816
@@ -41,14 +49,19 @@ export const InlineMathExtension = Node.create({
4149 return VueNodeViewRenderer ( NodeView ) ;
4250 } ,
4351
44- addCommands ( ) : any {
52+ addCommands ( ) {
4553 return {
4654 addInlineMath :
47- ( options : any ) =>
48- ( { commands } : any ) =>
55+ ( ) =>
56+ ( { commands, state } ) =>
4957 commands . insertContent ( {
5058 type : this . name ,
51- attrs : options ,
59+ attrs : {
60+ input : state . doc . textBetween (
61+ state . selection . from ,
62+ state . selection . to ,
63+ ) ,
64+ } ,
5265 } ) ,
5366 } ;
5467 } ,
Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import { VueNodeViewRenderer } from '@tiptap/vue-3';
33
44import NodeView from './NodeView.vue' ;
55
6+ declare module '@tiptap/core' {
7+ interface Commands < ReturnType > {
8+ mathBlock : {
9+ addMathBlock : ( ) => ReturnType ;
10+ } ;
11+ }
12+ }
13+
614export const MathBlockExtension = Node . create ( {
715 name : 'mathBlock' ,
816
@@ -40,14 +48,19 @@ export const MathBlockExtension = Node.create({
4048 return VueNodeViewRenderer ( NodeView ) ;
4149 } ,
4250
43- addCommands ( ) : any {
51+ addCommands ( ) {
4452 return {
4553 addMathBlock :
46- ( options : any ) =>
47- ( { commands } : any ) =>
54+ ( ) =>
55+ ( { commands, state } ) =>
4856 commands . insertContent ( {
4957 type : this . name ,
50- attrs : options ,
58+ attrs : {
59+ input : state . doc . textBetween (
60+ state . selection . from ,
61+ state . selection . to ,
62+ ) ,
63+ } ,
5164 } ) ,
5265 } ;
5366 } ,
Original file line number Diff line number Diff line change 2626 icon =" mdi-sigma-lower"
2727 icon-size =" 24px"
2828 :disable =" page.react.readOnly || !page.activeElem.react.exists"
29- @click =" page.selection.format((chain) => ( chain as any) .addInlineMath())"
29+ @click =" page.selection.format((chain) => chain.addInlineMath())"
3030 />
3131 <ToolbarBtn
3232 :tooltip =" `Math block`"
3333 icon =" mdi-sigma"
3434 icon-size =" 24px"
3535 :disable =" page.react.readOnly || !page.activeElem.react.exists"
36- @click =" page.selection.format((chain) => ( chain as any) .addMathBlock())"
36+ @click =" page.selection.format((chain) => chain.addMathBlock())"
3737 />
3838
3939 <q-separator
You can’t perform that action at this time.
0 commit comments