@@ -109,17 +109,17 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
109109 } ,
110110 } ) ;
111111
112- this . addCommand ( {
113- id : 'mb-test-command' ,
114- name : 'test command' ,
115- editorCallback : ( editor : Editor , view : MarkdownView | MarkdownFileInfo ) => {
116- if ( view . file ) {
117- this . app . fileManager . processFrontMatter ( view . file , frontmatter => {
118- return frontmatter ;
119- } ) ;
120- }
121- } ,
122- } ) ;
112+ // this.addCommand({
113+ // id: 'mb-test-command',
114+ // name: 'test command',
115+ // editorCallback: (editor: Editor, view: MarkdownView | MarkdownFileInfo) => {
116+ // if (view.file) {
117+ // this.app.fileManager.processFrontMatter(view.file, frontmatter => {
118+ // return frontmatter;
119+ // });
120+ // }
121+ // },
122+ // });
123123
124124 // if (this.settings.devMode) {
125125 // this.addCommand({
@@ -138,55 +138,6 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
138138 this . addSettingTab ( new MetaBindSettingTab ( this . app , this ) ) ;
139139 }
140140
141- /**
142- * Inspired by https://github.com/SilentVoid13/Templater/blob/487805b5ad1fd7fbc145040ed82b4c41fc2c48e2/src/editor/Editor.ts#L67
143- */
144- async registerCodeMirrorMode ( ) : Promise < void > {
145- const js_mode : Mode < any > = window . CodeMirror . getMode ( { } , 'javascript' ) ;
146- if ( js_mode == null || js_mode . name === 'null' ) {
147- console . log ( "Couldn't find js mode, can't enable syntax highlighting." ) ;
148- return ;
149- }
150-
151- // if templater enabled, this only runs on the code blocks, otherwise this runs on the whole document
152-
153- window . CodeMirror . defineMode ( 'meta-bind-js' , config => {
154- const mbOverlay : any = {
155- startState : ( ) => {
156- const js_state = window . CodeMirror . startState ( js_mode ) ;
157- return {
158- ...js_state ,
159- } ;
160- } ,
161- blankLine : ( state : any ) => {
162- return null ;
163- } ,
164- copyState : ( state : any ) => {
165- const js_state = window . CodeMirror . startState ( js_mode ) ;
166- return {
167- ...js_state ,
168- } ;
169- } ,
170- token : ( stream : any , state : any ) => {
171- // const globals = ['app', 'mb', 'dv', 'filePath', 'ctx'];
172-
173- // console.log(stream);
174-
175- // for (const global of globals) {
176- // if (stream.match(global)) {
177- // return 'variable';
178- // }
179- // }
180-
181- const js_result = js_mode . token && js_mode . token ( stream , state ) ;
182- return `line-HyperMD-codeblock ${ js_result } ` ;
183- } ,
184- } ;
185-
186- return mbOverlay ;
187- } ) ;
188- }
189-
190141 onunload ( ) : void {
191142 console . log ( `meta-bind | Main >> unload` ) ;
192143 this . mdrcManager . unload ( ) ;
0 commit comments