mirror of
https://github.com/oen/liquid-template.git
synced 2026-07-22 05:40:24 +00:00
fix: remove CodeMirror event on unload
remove the CodeMirror event when unloading the plugin Filter the file returned by the auto-suggest by extension
This commit is contained in:
parent
8ac98d2337
commit
dc3127a906
5 changed files with 10 additions and 3 deletions
4
main.ts
4
main.ts
|
|
@ -18,6 +18,10 @@ export default class LiquidTemplates extends Plugin {
|
|||
|
||||
onunload(): void {
|
||||
console.log('unloading liquid templates plugin');
|
||||
// remove the autosuggest handler when unloading the plugin
|
||||
this.app.workspace.iterateCodeMirrors((cm: CodeMirror.Editor) => {
|
||||
cm.off("change", this.autosuggestHandler);
|
||||
})
|
||||
}
|
||||
|
||||
setupAutosuggest(): void {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "liquid-templates",
|
||||
"name": "Liquid Templates",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"minAppVersion": "0.12.3",
|
||||
"description": "Empower your template with LiquidJS tags",
|
||||
"author": "diomedet",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "liquid-templates",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "Empower your template with LiquidJS tags",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
3
utils.ts
3
utils.ts
|
|
@ -1,6 +1,8 @@
|
|||
import { App, normalizePath, TAbstractFile, TFile, TFolder, Vault } from "obsidian";
|
||||
import { compact } from 'lodash';
|
||||
|
||||
const ALLOWED_EXTENSIONS = ['md']
|
||||
|
||||
export function getTFilesFromFolder(app: App, folderName: string, subfoldersToExclude?: string[]): Array<TFile> {
|
||||
folderName = normalizePath(folderName);
|
||||
let folder = app.vault.getAbstractFileByPath(folderName);
|
||||
|
|
@ -15,6 +17,7 @@ export function getTFilesFromFolder(app: App, folderName: string, subfoldersToEx
|
|||
Vault.recurseChildren(folder, (file: TAbstractFile) => {
|
||||
if (foldersToExclude.some(toExclude => file.path.startsWith(toExclude))) return;
|
||||
if (!(file instanceof TFile)) return;
|
||||
if (!ALLOWED_EXTENSIONS.includes(file.extension)) return;
|
||||
|
||||
files.push(file);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"0.1.4": "0.12.3"
|
||||
"0.1.5": "0.12.3"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue