fix: update copyright year and improve command identifiers for clarity

This commit is contained in:
exoticknight 2025-03-23 00:37:42 +08:00
parent fa6273e6a9
commit 4dd394ac96
6 changed files with 69 additions and 76 deletions

View file

@ -1,4 +1,4 @@
Copyright 2024 exoticknight
Copyright 2025 exoticknight
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -1,11 +1,10 @@
{
"id": "quick-nav",
"name": "Quick Nav",
"version": "1.0.4",
"minAppVersion": "0.15.0",
"description": "Swift cursor navigation plugin to enhance editing",
"author": "ExoticKnight",
"authorUrl": "https://github.com/exoticknight",
"fundingUrl": "https://github.com/exoticknight",
"isDesktopOnly": true
}
"id": "quick-nav",
"name": "Quick Nav",
"version": "1.0.4",
"minAppVersion": "0.15.0",
"description": "Swift cursor navigation plugin to enhance editing",
"author": "ExoticKnight",
"authorUrl": "https://github.com/exoticknight",
"isDesktopOnly": true
}

View file

@ -1,26 +1,26 @@
{
"name": "quick-nav",
"version": "1.0.4",
"description": "Swift cursor navigation plugin to enhance editing",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"lint": "eslint ./src/",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@codemirror/commands": "^6.8.0",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
}
}
"name": "quick-nav",
"version": "1.0.4",
"description": "Swift cursor navigation plugin to enhance editing",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"lint": "eslint ./src/",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],
"author": "exoticknight",
"license": "MIT",
"devDependencies": {
"@codemirror/commands": "^6.8.0",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
}
}

View file

@ -1,4 +1,3 @@
import type { Modifier } from "obsidian";
import type { Command } from "@codemirror/view";
import {
cursorCharLeft,
@ -17,43 +16,43 @@ export const CursorMove: {
commandFn: Command;
}[] = [
{
id: "quick-nav-move-cursor-up",
name: "Move Cursor Up",
id: "move-cursor-up",
name: "Move cursor up",
commandFn: cursorLineUp,
},
{
id: "quick-nav-move-cursor-down",
name: "Move Cursor Down",
id: "move-cursor-down",
name: "Move cursor down",
commandFn: cursorLineDown,
},
{
id: "quick-nav-move-cursor-left",
name: "Move Cursor Left",
id: "move-cursor-left",
name: "Move cursor left",
commandFn: cursorCharLeft,
},
{
id: "quick-nav-move-cursor-right",
name: "Move Cursor Right",
id: "move-cursor-right",
name: "Move cursor right",
commandFn: cursorCharRight,
},
{
id: "quick-nav-move-cursor-page-up",
name: "Move Cursor Page Up",
id: "move-cursor-page-up",
name: "Move cursor page up",
commandFn: cursorPageUp,
},
{
id: "quick-nav-move-cursor-page-down",
name: "Move Cursor Page Down",
id: "move-cursor-page-down",
name: "Move cursor page down",
commandFn: cursorPageDown,
},
{
id: "quick-nav-move-cursor-left-end",
name: "Move Cursor Left End",
id: "move-cursor-left-end",
name: "Move cursor left end",
commandFn: cursorLineBoundaryLeft,
},
{
id: "quick-nav-move-cursor-right-end",
name: "Move Cursor Right End",
id: "move-cursor-right-end",
name: "Move cursor right end",
commandFn: cursorLineBoundaryRight,
},
];

View file

@ -1,4 +1,3 @@
import type { Modifier } from "obsidian";
import type { Command } from "@codemirror/view";
import {
selectCharLeft,
@ -15,33 +14,33 @@ export const CursorSelect: {
commandFn: Command;
}[] = [
{
id: "quick-nav-select-cursor-up",
name: "Select Cursor Up",
id: "select-cursor-up",
name: "Select cursor up",
commandFn: selectLineUp,
},
{
id: "quick-nav-select-cursor-down",
name: "Select Cursor Down",
id: "select-cursor-down",
name: "Select cursor down",
commandFn: selectLineDown,
},
{
id: "quick-nav-select-cursor-left",
name: "Select Cursor Left",
id: "select-cursor-left",
name: "Select cursor left",
commandFn: selectCharLeft,
},
{
id: "quick-nav-select-cursor-right",
name: "Select Cursor Right",
id: "select-cursor-right",
name: "Select cursor right",
commandFn: selectCharRight,
},
{
id: "quick-nav-select-cursor-left-end",
name: "Select Cursor Left End",
id: "select-cursor-left-end",
name: "Select cursor left end",
commandFn: selectLineBoundaryLeft,
},
{
id: "quick-nav-select-cursor-right-end",
name: "Select Cursor Right End",
id: "select-cursor-right-end",
name: "Select cursor right end",
commandFn: selectLineBoundaryRight,
},
];

View file

@ -1,5 +1,5 @@
import {
MarkdownView,
Editor,
Plugin,
} from "obsidian";
import { Command, EditorView } from "@codemirror/view";
@ -33,18 +33,14 @@ export default class QuickNavPlugin extends Plugin {
this.addCommand({
id,
name,
callback: () => this.getEditorViewToExecCommand(commandFn),
editorCallback: (editor) => this.getEditorViewToExecCommand(editor, commandFn)
});
}
getEditorViewToExecCommand(command: Command): boolean {
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
if (view) {
// @ts-expect-error, not typed
const editorView = view.editor.cm as EditorView;
return command(editorView);
}
return false;
getEditorViewToExecCommand(editor: Editor, command: Command): boolean {
// @ts-expect-error, not typed
const editorView = editor.cm as EditorView;
return command(editorView);
}
onunload() { }