Remove duplicated commands

This commit is contained in:
Lost Paul 2025-01-11 22:08:54 +01:00
parent 7b086542d8
commit 07ad2b927b
5 changed files with 9 additions and 71 deletions

View file

@ -1,7 +1,7 @@
{
"id": "folder-notes",
"name": "Folder notes",
"version": "1.7.34",
"version": "1.7.35",
"minAppVersion": "0.15.0",
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
"author": "Lost Paul",
@ -9,4 +9,4 @@
"fundingUrl": "https://ko-fi.com/paul305844",
"helpUrl": "https://lostpaul.github.io/obsidian-folder-notes/",
"isDesktopOnly": false
}
}

View file

@ -36,24 +36,6 @@ export class Commands {
}
});
console.log('registering commands')
this.plugin.addCommand({
id: 'open-folder-overview-view',
name: 'Change folder overview settings',
callback: () => {
this.plugin.activateOverviewView();
}
});
this.plugin.addCommand({
id: 'open-folder-overview-view',
name: 'Change folder overview settings',
callback: () => {
this.plugin.activateOverviewView();
}
});
this.plugin.addCommand({
id: 'create-folder-note',
name: 'Create folder note with a new folder for the active note in the current folder',
@ -133,33 +115,7 @@ export class Commands {
openFolderNote(this.plugin, folderNote);
}
});
this.plugin.addCommand({
id: 'insert-folder-overview-fn',
name: 'Insert folder overview',
editorCheckCallback: (checking: boolean, editor: Editor) => {
const line = editor.getCursor().line;
const lineText = editor.getLine(line);
if (lineText.trim() === '' || lineText.trim() === '>') {
if (!checking) {
let json = Object.assign({}, this.plugin.settings.defaultOverview);
json.id = crypto.randomUUID();
const yaml = stringifyYaml(json)
if (lineText.trim() === '') {
editor.replaceSelection(`\`\`\`folder-overview\n${yaml}\`\`\`\n`);
} else if (lineText.trim() === '>') {
// add > to the beginning of each line
const lines = yaml.split('\n');
const newLines = lines.map((line) => {
return `> ${line}`;
});
editor.replaceSelection(`\`\`\`folder-overview\n${newLines.join('\n')}\`\`\`\n`);
}
}
return true;
}
return false;
},
})
this.plugin.addCommand({
id: 'create-folder-note-from-selected-text',
name: 'Create folder note from selected text',
@ -445,27 +401,6 @@ export class Commands {
const text = editor.getSelection().trim();
const line = editor.getCursor().line;
const lineText = editor.getLine(line);
if (lineText.trim() === '' || lineText.trim() === '>') {
menu.addItem((item) => {
item.setTitle('Create folder overview')
.setIcon('edit')
.onClick(() => {
let json = Object.assign({}, this.plugin.settings.defaultOverview);
json.id = crypto.randomUUID();
const yaml = stringifyYaml(json)
if (lineText.trim() === '') {
editor.replaceSelection(`\`\`\`folder-overview\n${yaml}\`\`\`\n`);
} else if (lineText.trim() === '>') {
// add > to the beginning of each line
const lines = yaml.split('\n');
const newLines = lines.map((line) => {
return `> ${line}`;
});
editor.replaceSelection(`\`\`\`folder-overview\n${newLines.join('\n')}\`\`\`\n`);
}
});
});
}
if (!text || text.trim() === '') return;
menu.addItem((item) => {
item.setTitle('Create folder note')

View file

@ -1,5 +1,5 @@
import { TFile, TFolder } from 'obsidian';
import FolderNotesPlugin from 'src/main';
import FolderNotesPlugin from '../main';
import { getExcludedFolder } from 'src/ExcludeFolders/functions/folderFunctions';
import { getFolder, getFolderNote } from 'src/functions/folderNoteFunctions';
import { getFileExplorer } from './utils';

View file

@ -19,7 +19,9 @@ import { getExcludedFolder } from './ExcludeFolders/functions/folderFunctions';
import { FileExplorerView, InternalPlugin } from 'obsidian-typings'
import { getFocusedItem } from './functions/utils';
import { FOLDER_OVERVIEW_VIEW, FolderOverviewView } from './obsidian-folder-overview/src/view';
import {getFolderPathFromString } from './functions/utils';
import { getFolderPathFromString } from './functions/utils';
import { registerOverviewCommands } from './obsidian-folder-overview/src/Commands';
export default class FolderNotesPlugin extends Plugin {
observer: MutationObserver;
settings: FolderNotesSettings;
@ -61,6 +63,7 @@ export default class FolderNotesPlugin extends Plugin {
}
new Commands(this.app, this).registerCommands();
registerOverviewCommands(this);
this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this));

@ -1 +1 @@
Subproject commit 61d1bba885c403055f6a292f0d5447023946182c
Subproject commit fe16567ee66f046e7407050e595f23b470ef5add