|
1 | | -import { Decoration, DecorationSet, EditorView, ViewPlugin, ViewUpdate } from '@codemirror/view'; |
2 | | -import { Range, RangeSet } from '@codemirror/state'; |
| 1 | +import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view'; |
| 2 | +import { type Range, type RangeSet } from '@codemirror/state'; |
3 | 3 | import { syntaxTree, tokenClassNodeProp } from '@codemirror/language'; |
4 | | -import { SyntaxNode } from '@lezer/common'; |
5 | | -import { Component, editorLivePreviewField, TFile } from 'obsidian'; |
6 | | -import MetaBindPlugin from '../main'; |
7 | | -import { MBWidgetType } from './Cm6_Widgets'; |
| 4 | +import { type SyntaxNode } from '@lezer/common'; |
| 5 | +import { Component, editorLivePreviewField, type TFile } from 'obsidian'; |
| 6 | +import type MetaBindPlugin from '../main'; |
| 7 | +import { type MBWidgetType } from './Cm6_Widgets'; |
8 | 8 | import { Cm6_Util } from './Cm6_Util'; |
9 | 9 |
|
| 10 | +// eslint-disable-next-line @typescript-eslint/no-explicit-any |
10 | 11 | export function createMarkdownRenderChildWidgetEditorPlugin(plugin: MetaBindPlugin): ViewPlugin<any> { |
11 | 12 | return ViewPlugin.fromClass( |
12 | 13 | class { |
@@ -195,54 +196,4 @@ export function createMarkdownRenderChildWidgetEditorPlugin(plugin: MetaBindPlug |
195 | 196 | decorations: v => v.decorations, |
196 | 197 | }, |
197 | 198 | ); |
198 | | - |
199 | | - // return StateField.define<RangeSet<Decoration>>({ |
200 | | - // create(state): RangeSet<Decoration> { |
201 | | - // return Decoration.none; |
202 | | - // }, |
203 | | - // |
204 | | - // update(oldState: RangeSet<Decoration>, transaction: Transaction): RangeSet<Decoration> { |
205 | | - // const builder = new RangeSetBuilder<Decoration>(); |
206 | | - // const filePath = transaction.state.field(editorInfoField).file?.path ?? ''; |
207 | | - // |
208 | | - // syntaxTree(transaction.state).iterate({ |
209 | | - // enter(node: SyntaxNodeRef) { |
210 | | - // // check for inline code |
211 | | - // if (node.type.name !== 'inline-code') { |
212 | | - // return; |
213 | | - // } |
214 | | - // |
215 | | - // // check for selection and cursor |
216 | | - // if (Cm6_Util.checkSelectionOverlap(transaction.selection, node.from, node.to)) { |
217 | | - // return; |
218 | | - // } |
219 | | - // |
220 | | - // // check for content |
221 | | - // const content = transaction.state.sliceDoc(node.from, node.to); |
222 | | - // if (!isDeclaration(widgetType, content)) { |
223 | | - // return; |
224 | | - // } |
225 | | - // |
226 | | - // const widget = constructMarkdownRenderChildWidget(widgetType, content, filePath, plugin); |
227 | | - // if (!widget) { |
228 | | - // return; |
229 | | - // } |
230 | | - // |
231 | | - // builder.add( |
232 | | - // node.from, |
233 | | - // node.to, |
234 | | - // Decoration.replace({ |
235 | | - // widget: widget, |
236 | | - // }) |
237 | | - // ); |
238 | | - // }, |
239 | | - // }); |
240 | | - // |
241 | | - // return builder.finish(); |
242 | | - // }, |
243 | | - // |
244 | | - // provide(field: StateField<DecorationSet>): Extension { |
245 | | - // return EditorView.decorations.from(field); |
246 | | - // }, |
247 | | - // }); |
248 | 199 | } |
0 commit comments