complete the basic customisation feature

This commit is contained in:
Jiaxin Peng
2023-11-16 01:00:52 +00:00
parent b978cf7e01
commit 6ce689ba96
8 changed files with 86 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
import { FuzzySuggestModal, FuzzyMatch } from 'obsidian';
import MyPlugin from "../main";
import {i18nConfig} from "../lang/I18n";
import { i18nConfig } from "../lang/I18n";
/**
* Simple interface for what should be displayed and stored for suggester
@@ -38,7 +38,7 @@ export class FuzzySuggester extends FuzzySuggestModal<DatabaseList>{
return item.name
}
onChooseItem(item: DatabaseList, evt:MouseEvent | KeyboardEvent): void { }
onChooseItem(item: DatabaseList, evt: MouseEvent | KeyboardEvent): void { }
onChooseSuggestion(item: FuzzyMatch<DatabaseList>, evt: MouseEvent | KeyboardEvent): void {
this.callback(item.item, evt)

View File

@@ -1,7 +1,7 @@
import {i18nConfig} from "src/lang/I18n";
import {Editor, MarkdownView} from "obsidian";
import {FuzzySuggester, DatabaseList} from "./FuzzySuggester";
import {uploadCommandGeneral, uploadCommandNext} from "../upload/uploadCommand";
import { i18nConfig } from "src/lang/I18n";
import { Editor, MarkdownView } from "obsidian";
import { FuzzySuggester, DatabaseList } from "./FuzzySuggester";
import { uploadCommandGeneral, uploadCommandNext } from "../upload/uploadCommand";
import ObsidianSyncNotionPlugin from "src/main";
@@ -14,7 +14,7 @@ interface Command {
// create the commands list
export default class RibbonCommands {
plugin: ObsidianSyncNotionPlugin;
plugin: ObsidianSyncNotionPlugin;
Ncommand: Command[] = [];
@@ -55,22 +55,22 @@ export default class RibbonCommands {
});
}
async ribbonDisplay() {
const NcommandList: DatabaseList[] = [];
async ribbonDisplay() {
const NcommandList: DatabaseList[] = [];
this.Ncommand.map(command => NcommandList.push(
{
name:command.name,
match: command.editorCallback
}
)
);
this.Ncommand.map(command => NcommandList.push(
{
name: command.name,
match: command.editorCallback
}
)
);
const fusg = new FuzzySuggester(this.plugin);
const fusg = new FuzzySuggester(this.plugin);
fusg.setSuggesterData(NcommandList);
await fusg.display(async (results) => {await results.match()})
};
fusg.setSuggesterData(NcommandList);
await fusg.display(async (results) => { await results.match() })
};
// if the setting has been changed, try to rebuild the command list
async updateCommand() {