mirror of
https://github.com/gregory-jagermeister/Fantasy-Content-Generator.git
synced 2026-07-22 07:30:31 +00:00
Conformed to Changed recommended
This commit is contained in:
parent
c1e4a15c6a
commit
a105b6f288
3 changed files with 12 additions and 21 deletions
|
|
@ -37,7 +37,7 @@ In the settings of the plugin you will Find settings and options to add your own
|
|||
|
||||
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
|
||||
|
||||

|
||||
|
||||
|
|
@ -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~~
|
||||
|
|
|
|||
|
|
@ -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 = "";
|
||||
|
|
|
|||
13
main.ts
13
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));
|
||||
}
|
||||
});
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue