1- import {
2- App ,
3- Editor ,
4- MarkdownView ,
5- Modal ,
6- Plugin ,
7- PluginSettingTab ,
8- Setting ,
9- } from "obsidian" ;
1+ import { App , Editor , MarkdownView , Modal , Plugin } from "obsidian" ;
102
113import { DefaultRubyVM } from "@ruby/wasm-wasi/dist/browser" ;
124
13- // Remember to rename these classes and interfaces!
14-
15- interface RubyWasmPluginSettings {
16- mySetting : string ;
17- }
18-
19- const DEFAULT_SETTINGS : RubyWasmPluginSettings = {
20- mySetting : "default" ,
21- } ;
22-
235export default class RubyWasmPlugin extends Plugin {
24- settings : RubyWasmPluginSettings ;
25-
266 // Function to check if inside code block
277 isInCodeBlock = ( editor : Editor , line : number ) => {
288 const totalLines = editor . lineCount ( ) ;
@@ -44,8 +24,6 @@ export default class RubyWasmPlugin extends Plugin {
4424 } ;
4525
4626 async onload ( ) {
47- await this . loadSettings ( ) ;
48-
4927 const response = await fetch (
5028 "https://cdn.jsdelivr.net/npm/@ruby/[email protected] /dist/ruby+stdlib.wasm" 5129 ) ;
@@ -95,9 +73,6 @@ export default class RubyWasmPlugin extends Plugin {
9573 } ,
9674 } ) ;
9775
98- // This adds a settings tab so the user can configure various aspects of the plugin
99- this . addSettingTab ( new RubyWasmSettingTab ( this . app , this ) ) ;
100-
10176 // If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin)
10277 // Using this function will automatically remove the event listener when this plugin is disabled.
10378 // this.registerDomEvent(document, "click", (evt: MouseEvent) => {
@@ -111,18 +86,6 @@ export default class RubyWasmPlugin extends Plugin {
11186 }
11287
11388 onunload ( ) { }
114-
115- async loadSettings ( ) {
116- this . settings = Object . assign (
117- { } ,
118- DEFAULT_SETTINGS ,
119- await this . loadData ( )
120- ) ;
121- }
122-
123- async saveSettings ( ) {
124- await this . saveData ( this . settings ) ;
125- }
12689}
12790
12891class CodeModal extends Modal {
@@ -167,30 +130,3 @@ class CodeModal extends Modal {
167130 contentEl . empty ( ) ;
168131 }
169132}
170-
171- class RubyWasmSettingTab extends PluginSettingTab {
172- plugin : RubyWasmPlugin ;
173-
174- constructor ( app : App , plugin : RubyWasmPlugin ) {
175- super ( app , plugin ) ;
176- this . plugin = plugin ;
177- }
178-
179- display ( ) : void {
180- const { containerEl } = this ;
181-
182- containerEl . empty ( ) ;
183-
184- new Setting ( containerEl ) . setName ( "ruby.wasm" ) ;
185- // .setDesc("It's a secret");
186- // .addText((text) =>
187- // text
188- // .setPlaceholder("Enter your secret")
189- // .setValue(this.plugin.settings.mySetting)
190- // .onChange(async (value) => {
191- // this.plugin.settings.mySetting = value;
192- // await this.plugin.saveSettings();
193- // })
194- // );
195- }
196- }
0 commit comments