rename main class
This commit is contained in:
parent
26a0b09c73
commit
b67be0bf75
|
@ -3,7 +3,7 @@ import {EditorView, Decoration, DecorationSet, ViewUpdate, ViewPlugin, WidgetTyp
|
||||||
import {StateField, StateEffect, StateEffectType} from "@codemirror/state";
|
import {StateField, StateEffect, StateEffectType} from "@codemirror/state";
|
||||||
import {Range} from "@codemirror/rangeset";
|
import {Range} from "@codemirror/rangeset";
|
||||||
import {syntaxTree, tokenClassNodeProp} from "@codemirror/language";
|
import {syntaxTree, tokenClassNodeProp} from "@codemirror/language";
|
||||||
import MyPlugin from "./main";
|
import LinkThumbnailPlugin from "./main";
|
||||||
|
|
||||||
//based on: https://gist.github.com/nothingislost/faa89aa723254883d37f45fd16162337
|
//based on: https://gist.github.com/nothingislost/faa89aa723254883d37f45fd16162337
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ const statefulDecorations = defineStatefulDecoration();
|
||||||
class StatefulDecorationSet {
|
class StatefulDecorationSet {
|
||||||
editor: EditorView;
|
editor: EditorView;
|
||||||
decoCache: { [cls: string]: Decoration } = Object.create(null);
|
decoCache: { [cls: string]: Decoration } = Object.create(null);
|
||||||
plugin: MyPlugin;
|
plugin: LinkThumbnailPlugin;
|
||||||
|
|
||||||
constructor(editor: EditorView, plugin: MyPlugin) {
|
constructor(editor: EditorView, plugin: LinkThumbnailPlugin) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class StatefulDecorationSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildViewPlugin(plugin: MyPlugin) {
|
function buildViewPlugin(plugin: LinkThumbnailPlugin) {
|
||||||
return ViewPlugin.fromClass(
|
return ViewPlugin.fromClass(
|
||||||
class {
|
class {
|
||||||
decoManager: StatefulDecorationSet;
|
decoManager: StatefulDecorationSet;
|
||||||
|
@ -105,7 +105,7 @@ function buildViewPlugin(plugin: MyPlugin) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asyncDecoBuilderExt(plugin: MyPlugin) {
|
export function asyncDecoBuilderExt(plugin: LinkThumbnailPlugin) {
|
||||||
return [statefulDecorations.field, buildViewPlugin(plugin)];
|
return [statefulDecorations.field, buildViewPlugin(plugin)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { MarkdownPostProcessorContext } from "obsidian";
|
import { MarkdownPostProcessorContext } from "obsidian";
|
||||||
import MyPlugin from "./main";
|
import LinkThumbnailPlugin from "./main";
|
||||||
import { linkThumbnailWidgetParams } from "./EnbedDecoratiion";
|
import { linkThumbnailWidgetParams } from "./EnbedDecoratiion";
|
||||||
|
|
||||||
export class PostProcessor {
|
export class PostProcessor {
|
||||||
plugin: MyPlugin;
|
plugin: LinkThumbnailPlugin;
|
||||||
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: LinkThumbnailPlugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { PostProcessor } from './PostProcessor';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default class MyPlugin extends Plugin {
|
export default class LinkThumbnailPlugin extends Plugin {
|
||||||
/**
|
/**
|
||||||
* @returns true if Live Preview is supported
|
* @returns true if Live Preview is supported
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue