mirror of
https://github.com/exoticknight/quick-nav.git
synced 2026-07-22 05:37:37 +00:00
fix: update copyright year and improve command identifiers for clarity
This commit is contained in:
parent
fa6273e6a9
commit
4dd394ac96
6 changed files with 69 additions and 76 deletions
2
LICENSE
2
LICENSE
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,5 @@
|
|||
"description": "Swift cursor navigation plugin to enhance editing",
|
||||
"author": "ExoticKnight",
|
||||
"authorUrl": "https://github.com/exoticknight",
|
||||
"fundingUrl": "https://github.com/exoticknight",
|
||||
"isDesktopOnly": true
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"author": "exoticknight",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@codemirror/commands": "^6.8.0",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
12
src/main.ts
12
src/main.ts
|
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
MarkdownView,
|
||||
Editor,
|
||||
Plugin,
|
||||
} from "obsidian";
|
||||
import { Command, EditorView } from "@codemirror/view";
|
||||
|
|
@ -33,19 +33,15 @@ 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) {
|
||||
getEditorViewToExecCommand(editor: Editor, command: Command): boolean {
|
||||
// @ts-expect-error, not typed
|
||||
const editorView = view.editor.cm as EditorView;
|
||||
const editorView = editor.cm as EditorView;
|
||||
return command(editorView);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
onunload() { }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue