Merge pull request #1 from oeN/fixes/before-release

Correctly unload and filter suggestion by extension
This commit is contained in:
Diomede 2021-05-24 20:54:14 +02:00 committed by GitHub
commit 8187dfb364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 3 deletions

View file

@ -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 {

View file

@ -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",

View file

@ -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": {

View file

@ -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);
});

View file

@ -1,3 +1,3 @@
{
"0.1.4": "0.12.3"
"0.1.5": "0.12.3"
}