diff --git a/README.md b/README.md index 9f271f2..3d0a8bd 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ In the settings of the plugin you will Find settings and options to add your own ## Inline Generator -If you found yourself needing a quick name for an Elf or really wanting a quick dungeon description then look no further then the Inline generator. You can activate this by using the Callout token (Default is set to '@', can be changed in settings)and scrolling through the list of generators possible. +If you found yourself needing a quick name for an Elf or really wanting a quick dungeon description then look no further then the Inline generator. You can activate this by using the Callout token (Default is set to '@', can be changed in settings) and scrolling through the list of generators possible. -### Example +### Inline Example ![Example](Obsidian_mrGSNRjLpe.gif) @@ -67,4 +67,4 @@ Below is a table for all the settings in this plugin - ~~Randomization within a note.~~ - Possibly more Generation type. - Better UI -- JSON Import And Export +- ~~JSON Import And Export~~ diff --git a/editor/GeneratorModal.ts b/editor/GeneratorModal.ts index c324704..b0675b3 100644 --- a/editor/GeneratorModal.ts +++ b/editor/GeneratorModal.ts @@ -119,7 +119,7 @@ export class GeneratorModal extends Modal { multiNames: false } genSettings.race = raceSelected; - settingsdiv.innerHTML = ""; + settingsdiv.empty(); settingsdiv.createEl("h3", { text: "Customise The Generation" }); new Setting(settingsdiv) .setName("Male or Female?") @@ -197,7 +197,7 @@ export class GeneratorModal extends Modal { } generatorInnSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (settings: innGeneratorSettings) => {name:string,description:string,rumors:string[]}) { - settingsdiv.innerHTML = ""; + settingsdiv.empty(); settingsdiv.createEl("h3", { text: "Customise The Generation" }); genAmount = 1; let innList = ''; @@ -245,7 +245,7 @@ export class GeneratorModal extends Modal { } generatorLootSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (enableCurrency:boolean, currencyFrequency: number, currencyTypes: object[], lootTable: lootTables) => string, enableCurrency:boolean, currencyFrequency: number, currencyTypes: object[]) { - settingsdiv.innerHTML = ""; + settingsdiv.empty(); settingsdiv.createEl("h3", { text: "Customise The Generation" }); genAmount = 1; let list = ''; @@ -292,7 +292,7 @@ export class GeneratorModal extends Modal { } generatorFCGSettlementSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: () => ISettlementDomainObject) { - settingsdiv.innerHTML = ""; + settingsdiv.empty(); settingsdiv.createEl("h3", { text: "Customise The Generation" }); genAmount = 1; let list = ''; @@ -343,7 +343,7 @@ export class GeneratorModal extends Modal { // eslint-disable-next-line @typescript-eslint/no-explicit-any generatorCustomSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (settings ?: any) => string, settings ?: any) { - settingsdiv.innerHTML = ""; + settingsdiv.empty(); settingsdiv.createEl("h3", { text: "Customise The Generation" }); genAmount = 1; let list = ""; diff --git a/main.ts b/main.ts index e1056c9..c85f8e8 100644 --- a/main.ts +++ b/main.ts @@ -1,5 +1,5 @@ import { GeneratorModal } from 'editor/GeneratorModal'; -import { MarkdownView, Notice, Plugin } from 'obsidian'; +import { Notice, Plugin } from 'obsidian'; import { InlineGeneratorSuggester } from "editor/InlineGenerator"; import { FantasyPluginSettings, possibleOptions } from 'settings/Datatypes'; import { DEFAULT_SETTINGS } from 'settings/DefaultSetting'; @@ -16,20 +16,16 @@ export default class FantasyPlugin extends Plugin { async onload() { await this.loadSettings(); app.workspace.onLayoutReady(() => { - const view = this.app.workspace.getActiveViewOfType(MarkdownView); - // Make sure the user is editing a Markdown file. - if (view) { - //Register the InlineGeneratorSuggester to the Editor suggester. - this.registerEditorSuggest(new InlineGeneratorSuggester(this.getOptionsForSuggest, this)); - } + //Register the InlineGeneratorSuggester to the Editor suggester. + this.registerEditorSuggest(new InlineGeneratorSuggester(this.getOptionsForSuggest, this)); }); // This creates an icon in the left ribbon to access the modal for the Fantasy Content Generator. + // eslint-disable-next-line @typescript-eslint/no-unused-vars const ribbonIconEl = this.addRibbonIcon('book', 'Fantasy Generators', (evt: MouseEvent) => { // Called when the user clicks the icon. new GeneratorModal(this.app, (result) => { const copyContent = async () => { - console.log(); //Try to see if any generators spit out an Error or if copying the string fails. try { if (result instanceof Error) { @@ -48,15 +44,10 @@ export default class FantasyPlugin extends Plugin { }, this).open(); }); - // Perform additional things with the ribbon - ribbonIconEl.addClass('my-plugin-ribbon-class'); // This adds a settings tab so the user can configure various aspects of the plugin this.addSettingTab(new SettingTab(this.app, this)); - // When registering intervals, this function will automatically clear the interval when the plugin is disabled. - this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000)); - console.log("loaded Fantasy Content Generator"); }