diff --git a/README.md b/README.md index 6501b36..ee269d1 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ Quickly add new pages or content to your vault. You can also do a [manual installation](docs/ManualInstallation.md). ## What's new? +### 0.5.4 +- Improved the file suggester: now suggests by alias and has a better display. + ### 0.5.0 - 0.5.3 - Added support for scripts on mobile devices. - (0.5.1) Exposed Obsidian API for scripts. Only works for desktop usage. diff --git a/manifest.json b/manifest.json index f556c7c..fd3805a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "quickadd", "name": "QuickAdd", - "version": "0.5.3", + "version": "0.5.4", "minAppVersion": "0.13.19", "description": "Quickly add new pages or content to your vault.", "author": "Christian B. B. Houmann", diff --git a/package.json b/package.json index 90ab6bb..6ba3349 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quickadd", - "version": "0.5.2", + "version": "0.5.4", "description": "Quickly add new pages or content to your vault.", "main": "main.js", "scripts": { diff --git a/src/choiceExecutor.ts b/src/choiceExecutor.ts index 0457b11..7e86670 100644 --- a/src/choiceExecutor.ts +++ b/src/choiceExecutor.ts @@ -11,7 +11,7 @@ import {CaptureChoiceEngine} from "./engine/CaptureChoiceEngine"; import {MacroChoiceEngine} from "./engine/MacroChoiceEngine"; import type {IChoiceExecutor} from "./IChoiceExecutor"; import type IMultiChoice from "./types/choices/IMultiChoice"; -import ChoiceSuggester from "./gui/choiceSuggester"; +import ChoiceSuggester from "./gui/suggesters/choiceSuggester"; export class ChoiceExecutor implements IChoiceExecutor { public variables: Map = new Map(); diff --git a/src/gui/ChoiceBuilder/captureChoiceBuilder.ts b/src/gui/ChoiceBuilder/captureChoiceBuilder.ts index e17566b..59dd0f7 100644 --- a/src/gui/ChoiceBuilder/captureChoiceBuilder.ts +++ b/src/gui/ChoiceBuilder/captureChoiceBuilder.ts @@ -2,7 +2,6 @@ import {ChoiceBuilder} from "./choiceBuilder"; import type ICaptureChoice from "../../types/choices/ICaptureChoice"; import type {App} from "obsidian"; import {Setting, TextAreaComponent, TextComponent, ToggleComponent} from "obsidian"; -import {FormatSyntaxSuggester} from "../formatSyntaxSuggester"; import { CREATE_IF_NOT_FOUND_BOTTOM, CREATE_IF_NOT_FOUND_TOP, @@ -12,10 +11,11 @@ import { import {FormatDisplayFormatter} from "../../formatters/formatDisplayFormatter"; import type QuickAdd from "../../main"; import {FileNameDisplayFormatter} from "../../formatters/fileNameDisplayFormatter"; -import {GenericTextSuggester} from "../genericTextSuggester"; import {getTemplatePaths} from "../../utility"; import {NewTabDirection} from "../../types/newTabDirection"; import type {FileViewMode} from "../../types/fileViewMode"; +import {GenericTextSuggester} from "../suggesters/genericTextSuggester"; +import {FormatSyntaxSuggester} from "../suggesters/formatSyntaxSuggester"; export class CaptureChoiceBuilder extends ChoiceBuilder { choice: ICaptureChoice; diff --git a/src/gui/ChoiceBuilder/choiceBuilder.ts b/src/gui/ChoiceBuilder/choiceBuilder.ts index 2c4dc33..3350aa7 100644 --- a/src/gui/ChoiceBuilder/choiceBuilder.ts +++ b/src/gui/ChoiceBuilder/choiceBuilder.ts @@ -1,9 +1,9 @@ import {App, Modal, SearchComponent, Setting} from "obsidian"; import type IChoice from "../../types/choices/IChoice"; import type {SvelteComponent} from "svelte"; -import {GenericTextSuggester} from "../genericTextSuggester"; import GenericInputPrompt from "../GenericInputPrompt/GenericInputPrompt"; import {log} from "../../logger/logManager"; +import {GenericTextSuggester} from "../suggesters/genericTextSuggester"; export abstract class ChoiceBuilder extends Modal { private resolvePromise: (input: IChoice) => void; diff --git a/src/gui/ChoiceBuilder/macroChoiceBuilder.ts b/src/gui/ChoiceBuilder/macroChoiceBuilder.ts index 41ce6c4..3c9a892 100644 --- a/src/gui/ChoiceBuilder/macroChoiceBuilder.ts +++ b/src/gui/ChoiceBuilder/macroChoiceBuilder.ts @@ -1,8 +1,7 @@ import {ChoiceBuilder} from "./choiceBuilder"; import type IMacroChoice from "../../types/choices/IMacroChoice"; import type {App} from "obsidian"; -import {DropdownComponent, Setting} from "obsidian"; -import {GenericTextSuggester} from "../genericTextSuggester"; +import {DropdownComponent} from "obsidian"; import type {IMacro} from "../../types/macros/IMacro"; export class MacroChoiceBuilder extends ChoiceBuilder { diff --git a/src/gui/ChoiceBuilder/templateChoiceBuilder.ts b/src/gui/ChoiceBuilder/templateChoiceBuilder.ts index 29adea6..33a0647 100644 --- a/src/gui/ChoiceBuilder/templateChoiceBuilder.ts +++ b/src/gui/ChoiceBuilder/templateChoiceBuilder.ts @@ -1,16 +1,16 @@ import {ChoiceBuilder} from "./choiceBuilder"; import {App, ButtonComponent, Setting, TextComponent, ToggleComponent} from "obsidian"; import type ITemplateChoice from "../../types/choices/ITemplateChoice"; -import {FormatSyntaxSuggester} from "../formatSyntaxSuggester"; import {NewTabDirection} from "../../types/newTabDirection"; import FolderList from "./FolderList.svelte"; import {FileNameDisplayFormatter} from "../../formatters/fileNameDisplayFormatter"; -import {ExclusiveSuggester} from "../exclusiveSuggester"; import {log} from "../../logger/logManager"; import {getAllFolderPathsInVault, getTemplatePaths} from "../../utility"; -import {GenericTextSuggester} from "../genericTextSuggester"; import type QuickAdd from "../../main"; import type {FileViewMode} from "../../types/fileViewMode"; +import {GenericTextSuggester} from "../suggesters/genericTextSuggester"; +import {FormatSyntaxSuggester} from "../suggesters/formatSyntaxSuggester"; +import {ExclusiveSuggester} from "../suggesters/exclusiveSuggester"; export class TemplateChoiceBuilder extends ChoiceBuilder { choice: ITemplateChoice; diff --git a/src/gui/MacroGUIs/MacroBuilder.ts b/src/gui/MacroGUIs/MacroBuilder.ts index f1257f4..24eaaf5 100644 --- a/src/gui/MacroGUIs/MacroBuilder.ts +++ b/src/gui/MacroGUIs/MacroBuilder.ts @@ -1,7 +1,6 @@ import type {IMacro} from "../../types/macros/IMacro"; import {App, ButtonComponent, DropdownComponent, Modal, Setting, TextComponent, TFile} from "obsidian"; import type {IObsidianCommand} from "../../types/macros/IObsidianCommand"; -import {GenericTextSuggester} from "../genericTextSuggester"; import {UserScript} from "../../types/macros/UserScript"; import {ObsidianCommand} from "../../types/macros/ObsidianCommand"; import {JAVASCRIPT_FILE_EXTENSION_REGEX} from "../../constants"; @@ -27,6 +26,7 @@ import {log} from "../../logger/logManager"; import {SelectActiveLineCommand} from "../../types/macros/EditorCommands/SelectActiveLineCommand"; import {SelectLinkOnActiveLineCommand} from "../../types/macros/EditorCommands/SelectLinkOnActiveLineCommand"; import GenericYesNoPrompt from "../GenericYesNoPrompt/GenericYesNoPrompt"; +import {GenericTextSuggester} from "../suggesters/genericTextSuggester"; export class MacroBuilder extends Modal { public macro: IMacro; diff --git a/src/gui/MacroGUIs/UserScriptSettingsModal.ts b/src/gui/MacroGUIs/UserScriptSettingsModal.ts index 6035798..0822e42 100644 --- a/src/gui/MacroGUIs/UserScriptSettingsModal.ts +++ b/src/gui/MacroGUIs/UserScriptSettingsModal.ts @@ -1,8 +1,8 @@ import {App, Modal, Setting, TextComponent} from "obsidian"; import type {IUserScript} from "../../types/macros/IUserScript"; -import {FormatSyntaxSuggester} from "../formatSyntaxSuggester"; import QuickAdd from "../../main"; import {FormatDisplayFormatter} from "../../formatters/formatDisplayFormatter"; +import {FormatSyntaxSuggester} from "../suggesters/formatSyntaxSuggester"; export class UserScriptSettingsModal extends Modal { constructor(app: App, private command: IUserScript, private settings: {[key: string]: any}) { diff --git a/src/gui/MathModal.ts b/src/gui/MathModal.ts index 8d34ff3..8ce1e51 100644 --- a/src/gui/MathModal.ts +++ b/src/gui/MathModal.ts @@ -1,7 +1,7 @@ import {ButtonComponent, debounce, finishRenderMath, loadMathJax, Modal, renderMath, TextAreaComponent} from "obsidian"; import QuickAdd from "../main"; -import {LaTeXSuggester} from "./LaTeXSuggester"; import {LATEX_CURSOR_MOVE_HERE} from "../LaTeXSymbols"; +import {LaTeXSuggester} from "./suggesters/LaTeXSuggester"; export class MathModal extends Modal { public waitForClose: Promise; diff --git a/src/gui/suggesters/LaTeXSuggester.ts b/src/gui/suggesters/LaTeXSuggester.ts index 77ab32c..c917517 100644 --- a/src/gui/suggesters/LaTeXSuggester.ts +++ b/src/gui/suggesters/LaTeXSuggester.ts @@ -1,8 +1,8 @@ import {TextInputSuggest} from "./suggest"; -import {LATEX_CURSOR_MOVE_HERE, LaTeXSymbols} from "../LaTeXSymbols"; -import QuickAdd from "../main"; import Fuse from "fuse.js"; import {renderMath} from "obsidian"; +import {LATEX_CURSOR_MOVE_HERE, LaTeXSymbols} from "../../LaTeXSymbols"; +import QuickAdd from "../../main"; const LATEX_REGEX = new RegExp(/\\([a-z{}A-Z0-9]*)$/); diff --git a/src/gui/suggesters/choiceSuggester.ts b/src/gui/suggesters/choiceSuggester.ts index c94e708..b7d0de1 100644 --- a/src/gui/suggesters/choiceSuggester.ts +++ b/src/gui/suggesters/choiceSuggester.ts @@ -1,11 +1,11 @@ import {FuzzySuggestModal} from "obsidian"; -import type IChoice from "../types/choices/IChoice"; -import type QuickAdd from "../main"; -import type IMultiChoice from "../types/choices/IMultiChoice"; -import {MultiChoice} from "../types/choices/MultiChoice"; -import {ChoiceType} from "../types/choices/choiceType"; -import type {IChoiceExecutor} from "../IChoiceExecutor"; -import {ChoiceExecutor} from "../choiceExecutor"; +import type IChoice from "../../types/choices/IChoice"; +import {ChoiceExecutor} from "../../choiceExecutor"; +import {ChoiceType} from "../../types/choices/choiceType"; +import {MultiChoice} from "../../types/choices/MultiChoice"; +import type IMultiChoice from "../../types/choices/IMultiChoice"; +import type QuickAdd from "../../main"; +import type {IChoiceExecutor} from "../../IChoiceExecutor"; export default class ChoiceSuggester extends FuzzySuggestModal { private choiceExecutor: IChoiceExecutor = new ChoiceExecutor(this.app, this.plugin); diff --git a/src/gui/suggesters/formatSyntaxSuggester.ts b/src/gui/suggesters/formatSyntaxSuggester.ts index f8d47e8..11c671d 100644 --- a/src/gui/suggesters/formatSyntaxSuggester.ts +++ b/src/gui/suggesters/formatSyntaxSuggester.ts @@ -1,18 +1,21 @@ import {TextInputSuggest} from "./suggest"; import type {App} from "obsidian"; -import type QuickAdd from "../main"; import { - DATE_FORMAT_SYNTAX_SUGGEST_REGEX, DATE_SYNTAX, - DATE_SYNTAX_SUGGEST_REGEX, LINKCURRENT_SYNTAX, - LINKCURRENT_SYNTAX_SUGGEST_REGEX, - MACRO_SYNTAX_SUGGEST_REGEX, MATH_VALUE_SYNTAX, MATH_VALUE_SYNTAX_SUGGEST_REGEX, NAME_SYNTAX, + DATE_FORMAT_SYNTAX_SUGGEST_REGEX, + DATE_SYNTAX, DATE_SYNTAX_SUGGEST_REGEX, + LINKCURRENT_SYNTAX, + LINKCURRENT_SYNTAX_SUGGEST_REGEX, MACRO_SYNTAX_SUGGEST_REGEX, MATH_VALUE_SYNTAX, + MATH_VALUE_SYNTAX_SUGGEST_REGEX, + NAME_SYNTAX, NAME_SYNTAX_SUGGEST_REGEX, - TEMPLATE_SYNTAX_SUGGEST_REGEX, VALUE_SYNTAX, + TEMPLATE_SYNTAX_SUGGEST_REGEX, + VALUE_SYNTAX, VALUE_SYNTAX_SUGGEST_REGEX, VARIABLE_DATE_SYNTAX_SUGGEST_REGEX, VARIABLE_SYNTAX_SUGGEST_REGEX -} from "../constants"; -import {getTemplatePaths} from "../utility"; +} from "../../constants"; +import {getTemplatePaths} from "../../utility"; +import type QuickAdd from "../../main"; enum FormatSyntaxToken { Date, DateFormat, VariableDate, Value, Name, diff --git a/src/main.ts b/src/main.ts index 181f0a6..15d6f60 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,5 @@ import {Plugin} from 'obsidian'; import {DEFAULT_SETTINGS, QuickAddSettings, QuickAddSettingsTab} from "./quickAddSettingsTab"; -import ChoiceSuggester from "./gui/choiceSuggester"; import {log} from "./logger/logManager"; import {ConsoleErrorLogger} from "./logger/consoleErrorLogger"; import {GuiLogger} from "./logger/guiLogger"; @@ -12,6 +11,7 @@ import type IMultiChoice from "./types/choices/IMultiChoice"; import {deleteObsidianCommand} from "./utility"; import type IMacroChoice from "./types/choices/IMacroChoice"; import {MathModal} from "./gui/MathModal"; +import ChoiceSuggester from "./gui/suggesters/choiceSuggester"; export default class QuickAdd extends Plugin { static instance: QuickAdd; diff --git a/versions.json b/versions.json index cb003b6..b04e8c7 100644 --- a/versions.json +++ b/versions.json @@ -3,5 +3,5 @@ "0.4.17": "0.12.17", "0.4.18": "0.13.19", "0.4.21": "0.13.19", - "0.5.3": "0.13.19" + "0.5.4": "0.13.19" }