4 Commits
Author SHA1 Message Date
olivier 680e7c69ef chore: bump to v1.2.1 2026-11-11 21:58:44 -05:00
olivier 31c58b0cd3 fix: preserve cursor position when stripping heading formatting 2026-11-11 21:58:43 -05:00
olivier aec145604a chore: remove GitHub Actions workflow (no runner on Gitea) 2026-11-03 10:20:39 -05:00
olivier 74b3a16151 feat: release v1.2.0 with configurable word deletion
Node.js build / build (22.x) (push) Has been cancelled
Node.js build / build (20.x) (push) Has been cancelled
2026-10-08 15:47:46 -04:00
10 changed files with 278 additions and 146 deletions

No files matched your search

-28
View File
@@ -1,28 +0,0 @@
name: Node.js build
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
+21
View File
@@ -3,6 +3,27 @@
All notable changes to this project are documented in this file. All notable changes to this project are documented in this file.
Format loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Format loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [1.2.1] - 2026-11-11
### Fixed
- **Toggle Heading (strip formatting) left the cursor before the new marker on an
empty line.** Running *Toggle Heading - H1…H6 (strip formatting)* on an empty line
produced `|### ` instead of `### |`: the line was rewritten with `setLine`, which
maps a caret at column 0 to before the inserted text. The line replacement and the
cursor position are now set in a single transaction; the cursor keeps its position
relative to the line's text, also accounting for removed bold/italic markers.
(`src/ToggleHeading.ts`)
## [1.2.0] - 2026-10-08
### Added
- **Delete Previous Word** and **Delete Next Word** commands, configurable through
Obsidian's Hotkeys settings and individually enabled under Line Operations.
Native editor word deletion handles selections, multiple cursors, and undo.
No default hotkeys are assigned; existing word-deletion shortcuts are unchanged.
## [1.1.0] - 2026-09-07 ## [1.1.0] - 2026-09-07
### Added ### Added
+14
View File
@@ -54,6 +54,8 @@ Essential line manipulation commands for efficient editing.
| Delete Line | Remove the current line entirely | | Delete Line | Remove the current line entirely |
| Delete to Start of Line | Remove all text from cursor to the beginning of the line | | Delete to Start of Line | Remove all text from cursor to the beginning of the line |
| Delete to End of Line | Remove all text from cursor to the end of the line | | Delete to End of Line | Remove all text from cursor to the end of the line |
| Delete Previous Word | Delete to the previous word boundary, or delete the selection |
| Delete Next Word | Delete to the next word boundary, or delete the selection |
| Join Lines | Merge the current line with the next line | | Join Lines | Merge the current line with the next line |
| Duplicate Line | Copy the current line and insert it below | | Duplicate Line | Copy the current line and insert it below |
| Copy Line Up | Duplicate the current line above (VSCode style) | | Copy Line Up | Duplicate the current line above (VSCode style) |
@@ -178,6 +180,18 @@ All commands can be assigned custom keyboard shortcuts:
3. Click the `+` icon next to any command 3. Click the `+` icon next to any command
4. Press your desired key combination 4. Press your desired key combination
For word deletion, search for **BindThem: Delete Previous Word** or
**BindThem: Delete Next Word**. These commands have no default hotkeys and leave
the built-in `Ctrl+Backspace` and `Ctrl+Delete` shortcuts unchanged. They use the
editor's native word boundaries, support multiple cursors, and can be undone.
If the cursor is inside a word, only the portion in the chosen direction is
deleted; an existing selection is deleted instead.
Enable or disable these commands under **Settings > BindThem > Line Operations**.
On Windows, `Ctrl+Alt+Delete` is reserved by the operating system and cannot be
assigned to an Obsidian command. Use another combination, such as
`Ctrl+Alt+Backspace` or `Ctrl+Alt+Shift+Delete`, provided it has no conflicting binding.
## Credits ## Credits
This plugin merges and refactors functionality from: This plugin merges and refactors functionality from:
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "bindthem", "id": "bindthem",
"name": "BindThem", "name": "BindThem",
"version": "1.1.0", "version": "1.2.1",
"minAppVersion": "0.15.0", "minAppVersion": "0.15.0",
"description": "Enhanced editor shortcuts and formatting tools. Combines smart text wrapping (bold, italic, code, etc.), directional copy/move, heading toggles (H1-H6), line operations, case transformation, multi-cursor support, and file utilities into one unified plugin.", "description": "Enhanced editor shortcuts and formatting tools. Combines smart text wrapping (bold, italic, code, etc.), directional copy/move, heading toggles (H1-H6), line operations, case transformation, multi-cursor support, and file utilities into one unified plugin.",
"author": "Olivier Legendre", "author": "Olivier Legendre",
+167 -103
View File
@@ -1,17 +1,19 @@
{ {
"name": "bindthem", "name": "bindthem",
"version": "1.0.0", "version": "1.2.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bindthem", "name": "bindthem",
"version": "1.0.0", "version": "1.2.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@codemirror/commands": "6.8.1",
"obsidian": "latest" "obsidian": "latest"
}, },
"devDependencies": { "devDependencies": {
"@codemirror/view": "6.38.6",
"@eslint/js": "9.30.1", "@eslint/js": "9.30.1",
"@types/node": "^16.11.6", "@types/node": "^16.11.6",
"esbuild": "0.25.5", "esbuild": "0.25.5",
@@ -23,22 +25,53 @@
"typescript-eslint": "8.35.1" "typescript-eslint": "8.35.1"
} }
}, },
"node_modules/@codemirror/commands": {
"version": "6.8.1",
"resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.8.1.tgz",
"integrity": "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
"@codemirror/state": "^6.4.0",
"@codemirror/view": "^6.27.0",
"@lezer/common": "^1.1.0"
}
},
"node_modules/@codemirror/language": {
"version": "6.13.1",
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.13.1.tgz",
"integrity": "sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/streamparser": "^6.0.0",
"@codemirror/view": "^6.23.0",
"@lezer/common": "^1.5.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"style-mod": "^4.0.0"
}
},
"node_modules/@codemirror/state": { "node_modules/@codemirror/state": {
"version": "6.5.0", "version": "6.7.6",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.7.6.tgz",
"integrity": "sha512-MwBHVK60IiIHDcoMet78lxt6iw5gJOGSbNbOIVBHWVXIH4/Nq1+GQgLLGgI1KlnN86WDXsPudVaqYHKBIx7Eyw==", "integrity": "sha512-kAz+AncRtKuIknedxT1bq4XwXv4UowhbkHU1myPrtVb/jZtImWuV5BXzv5vK6i3kYACsdiZiQKFQQ5Mq7elW8w==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@marijn/find-cluster-break": "^1.0.0" "@marijn/find-cluster-break": "^1.0.0"
} }
}, },
"node_modules/@codemirror/streamparser": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@codemirror/streamparser/-/streamparser-6.0.0.tgz",
"integrity": "sha512-JTFPF6xrfjt0mnfGPgzcLiMwYmvIyNaoizp8BYzv8FE8KrT6GBGDZ190rtt+O7Wke3gG/MFHyiY9YGNeimof4w==",
"license": "MIT"
},
"node_modules/@codemirror/view": { "node_modules/@codemirror/view": {
"version": "6.38.6", "version": "6.38.6",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.6.tgz", "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.6.tgz",
"integrity": "sha512-qiS0z1bKs5WOvHIAC0Cybmv4AJSkAXgX5aD6Mqd2epSLlVJsQl8NG23jCVouIgkh4All/mrbdsf2UOLFnJw0tw==", "integrity": "sha512-qiS0z1bKs5WOvHIAC0Cybmv4AJSkAXgX5aD6Mqd2epSLlVJsQl8NG23jCVouIgkh4All/mrbdsf2UOLFnJw0tw==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@codemirror/state": "^6.5.0", "@codemirror/state": "^6.5.0",
"crelt": "^1.0.6", "crelt": "^1.0.6",
@@ -695,12 +728,35 @@
"url": "https://github.com/sponsors/nzakas" "url": "https://github.com/sponsors/nzakas"
} }
}, },
"node_modules/@lezer/common": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.3.tgz",
"integrity": "sha512-H0iErY4e43LpXbYDyBci5W4v/RwTgGV3YzYOlJPiGZ8RY8w51kVE+xLn1tg3Z6UmSfyETvtsUK3r7YsgDQEI7Q==",
"license": "MIT"
},
"node_modules/@lezer/highlight": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.5.tgz",
"integrity": "sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.3.0"
}
},
"node_modules/@lezer/lr": {
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.11.tgz",
"integrity": "sha512-UwgZcl1R66H2hDzBrA7kWyYmX6s8p5TQ+e/t7CuvgCtBEPxbEPaHYHu+pJBvTvDotEJpuQkJjbXuHiw5Cixxgw==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.0.0"
}
},
"node_modules/@marijn/find-cluster-break": { "node_modules/@marijn/find-cluster-break": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz",
"integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/@microsoft/eslint-plugin-sdl": { "node_modules/@microsoft/eslint-plugin-sdl": {
"version": "1.1.0", "version": "1.1.0",
@@ -885,9 +941,9 @@
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.5", "version": "7.0.12",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz",
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -1044,9 +1100,9 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "2.0.2", "version": "2.1.7",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1054,13 +1110,13 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
"version": "9.0.5", "version": "9.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.2"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
@@ -1070,9 +1126,9 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.7.3", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -1148,9 +1204,9 @@
} }
}, },
"node_modules/ajv": { "node_modules/ajv": {
"version": "6.12.6", "version": "6.15.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1381,9 +1437,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.12", "version": "1.1.21",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1512,8 +1568,7 @@
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.6", "version": "7.0.6",
@@ -2005,9 +2060,9 @@
} }
}, },
"node_modules/eslint-compat-utils/node_modules/semver": { "node_modules/eslint-compat-utils/node_modules/semver": {
"version": "7.7.3", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -2080,9 +2135,9 @@
} }
}, },
"node_modules/eslint-plugin-depend/node_modules/semver": { "node_modules/eslint-plugin-depend/node_modules/semver": {
"version": "7.7.3", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -2188,9 +2243,9 @@
} }
}, },
"node_modules/eslint-plugin-json-schema-validator/node_modules/ajv": { "node_modules/eslint-plugin-json-schema-validator/node_modules/ajv": {
"version": "8.17.1", "version": "8.20.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2205,9 +2260,9 @@
} }
}, },
"node_modules/eslint-plugin-json-schema-validator/node_modules/brace-expansion": { "node_modules/eslint-plugin-json-schema-validator/node_modules/brace-expansion": {
"version": "2.0.2", "version": "2.1.7",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2222,9 +2277,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/eslint-plugin-json-schema-validator/node_modules/minimatch": { "node_modules/eslint-plugin-json-schema-validator/node_modules/minimatch": {
"version": "8.0.4", "version": "8.0.7",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.7.tgz",
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", "integrity": "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
@@ -2264,9 +2319,9 @@
} }
}, },
"node_modules/eslint-plugin-n/node_modules/brace-expansion": { "node_modules/eslint-plugin-n/node_modules/brace-expansion": {
"version": "2.0.2", "version": "2.1.7",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2287,13 +2342,13 @@
} }
}, },
"node_modules/eslint-plugin-n/node_modules/minimatch": { "node_modules/eslint-plugin-n/node_modules/minimatch": {
"version": "9.0.5", "version": "9.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.2"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
@@ -2303,9 +2358,9 @@
} }
}, },
"node_modules/eslint-plugin-n/node_modules/semver": { "node_modules/eslint-plugin-n/node_modules/semver": {
"version": "7.7.3", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -2358,21 +2413,6 @@
"undici-types": "~5.26.4" "undici-types": "~5.26.4"
} }
}, },
"node_modules/eslint-plugin-obsidianmd/node_modules/obsidian": {
"version": "1.8.7",
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.8.7.tgz",
"integrity": "sha512-h4bWwNFAGRXlMlMAzdEiIM2ppTGlrh7uGOJS6w4gClrsjc+ei/3YAtU2VdFUlCiPuTHpY4aBpFJJW75S1Tl/JA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/codemirror": "5.60.8",
"moment": "2.29.4"
},
"peerDependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0"
}
},
"node_modules/eslint-plugin-obsidianmd/node_modules/typescript": { "node_modules/eslint-plugin-obsidianmd/node_modules/typescript": {
"version": "5.4.5", "version": "5.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
@@ -2421,19 +2461,25 @@
} }
}, },
"node_modules/eslint-plugin-react/node_modules/resolve": { "node_modules/eslint-plugin-react/node_modules/resolve": {
"version": "2.0.0-next.5", "version": "2.0.0-next.7",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz",
"integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"is-core-module": "^2.13.0", "es-errors": "^1.3.0",
"is-core-module": "^2.16.2",
"node-exports-info": "^1.6.0",
"object-keys": "^1.1.1",
"path-parse": "^1.0.7", "path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0" "supports-preserve-symlinks-flag": "^1.0.0"
}, },
"bin": { "bin": {
"resolve": "bin/resolve" "resolve": "bin/resolve"
}, },
"engines": {
"node": ">= 0.4"
},
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
@@ -2986,9 +3032,9 @@
} }
}, },
"node_modules/hasown": { "node_modules/hasown": {
"version": "2.0.2", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3135,13 +3181,13 @@
} }
}, },
"node_modules/is-core-module": { "node_modules/is-core-module": {
"version": "2.16.1", "version": "2.17.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz",
"integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"hasown": "^2.0.2" "hasown": "^2.0.4"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@@ -3522,9 +3568,9 @@
} }
}, },
"node_modules/json-schema-migrate/node_modules/ajv": { "node_modules/json-schema-migrate/node_modules/ajv": {
"version": "8.17.1", "version": "8.20.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3623,9 +3669,9 @@
} }
}, },
"node_modules/jsonc-eslint-parser/node_modules/semver": { "node_modules/jsonc-eslint-parser/node_modules/semver": {
"version": "7.7.3", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -3746,9 +3792,9 @@
} }
}, },
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
@@ -3798,6 +3844,25 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/node-exports-info": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz",
"integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==",
"dev": true,
"license": "MIT",
"dependencies": {
"array.prototype.flatmap": "^1.3.3",
"es-errors": "^1.3.0",
"object.entries": "^1.1.9",
"semver": "^6.3.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/object-assign": { "node_modules/object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -3922,17 +3987,17 @@
} }
}, },
"node_modules/obsidian": { "node_modules/obsidian": {
"version": "1.10.3", "version": "1.8.7",
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.10.3.tgz", "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.8.7.tgz",
"integrity": "sha512-VP+ZSxNMG7y6Z+sU9WqLvJAskCfkFrTz2kFHWmmzis+C+4+ELjk/sazwcTHrHXNZlgCeo8YOlM6SOrAFCynNew==", "integrity": "sha512-h4bWwNFAGRXlMlMAzdEiIM2ppTGlrh7uGOJS6w4gClrsjc+ei/3YAtU2VdFUlCiPuTHpY4aBpFJJW75S1Tl/JA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/codemirror": "5.60.8", "@types/codemirror": "5.60.8",
"moment": "2.29.4" "moment": "2.29.4"
}, },
"peerDependencies": { "peerDependencies": {
"@codemirror/state": "6.5.0", "@codemirror/state": "^6.0.0",
"@codemirror/view": "6.38.6" "@codemirror/view": "^6.0.0"
} }
}, },
"node_modules/optionator": { "node_modules/optionator": {
@@ -4191,13 +4256,14 @@
} }
}, },
"node_modules/resolve": { "node_modules/resolve": {
"version": "1.22.11", "version": "1.22.13",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz",
"integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", "integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"is-core-module": "^2.16.1", "es-errors": "^1.3.0",
"is-core-module": "^2.17.0",
"path-parse": "^1.0.7", "path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0" "supports-preserve-symlinks-flag": "^1.0.0"
}, },
@@ -4659,8 +4725,7 @@
"version": "4.1.3", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz", "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz",
"integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==", "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "7.2.0", "version": "7.2.0",
@@ -4982,8 +5047,7 @@
"version": "2.2.8", "version": "2.2.8",
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/which": { "node_modules/which": {
"version": "2.0.2", "version": "2.0.2",
+13 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "bindthem", "name": "bindthem",
"version": "1.1.0", "version": "1.2.1",
"description": "A merged plugin combining obsidian-tweaks, obsidian-editor-shortcuts, and heading-toggler functionalities.", "description": "A merged plugin combining obsidian-tweaks, obsidian-editor-shortcuts, and heading-toggler functionalities.",
"main": "main.js", "main": "main.js",
"type": "module", "type": "module",
@@ -10,20 +10,28 @@
"version": "node version-bump.mjs && git add manifest.json versions.json", "version": "node version-bump.mjs && git add manifest.json versions.json",
"lint": "eslint ." "lint": "eslint ."
}, },
"keywords": ["obsidian", "plugin", "editor", "shortcuts", "formatting"], "keywords": [
"obsidian",
"plugin",
"editor",
"shortcuts",
"formatting"
],
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@codemirror/view": "6.38.6",
"@eslint/js": "9.30.1",
"@types/node": "^16.11.6", "@types/node": "^16.11.6",
"esbuild": "0.25.5", "esbuild": "0.25.5",
"eslint-plugin-obsidianmd": "0.1.9", "eslint-plugin-obsidianmd": "0.1.9",
"globals": "14.0.0", "globals": "14.0.0",
"jiti": "2.6.1",
"tslib": "2.4.0", "tslib": "2.4.0",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "8.35.1", "typescript-eslint": "8.35.1"
"@eslint/js": "9.30.1",
"jiti": "2.6.1"
}, },
"dependencies": { "dependencies": {
"@codemirror/commands": "6.8.1",
"obsidian": "latest" "obsidian": "latest"
} }
} }
+38 -8
View File
@@ -121,20 +121,50 @@ export class ToggleHeading {
let content = line let content = line
let currentLevel = 0 let currentLevel = 0
let oldPrefixLength = 0
if (match) { if (match) {
currentLevel = match[1].length currentLevel = match[1].length
content = match[2] content = match[2]
oldPrefixLength = line.length - content.length
} }
// Strip bold and italic formatting // Cursor offset within the content (a caret inside the old marker
content = content // counts as the start of the content)
.replace(/(\*\*|__)(.*?)\1/g, '$2') let contentCursor = Math.max(0, cursor.ch - oldPrefixLength)
.replace(/(\*|_)(.*?)\1/g, '$2')
editor.setLine( // Strip bold and italic formatting, shifting the cursor offset left
cursor.line, // by the number of marker characters removed before it
currentLevel === level ? content : '#'.repeat(level) + ' ' + content const strip = (text: string, regex: RegExp): string =>
) text.replace(regex, (whole: string, marker: string, inner: string, offset: number) => {
const closeStart = offset + marker.length + inner.length
if (contentCursor >= closeStart + marker.length) {
contentCursor -= 2 * marker.length
} else if (contentCursor > closeStart) {
contentCursor = closeStart - marker.length
} else if (contentCursor >= offset + marker.length) {
contentCursor -= marker.length
} else if (contentCursor > offset) {
contentCursor = offset
}
return inner
})
content = strip(content, /(\*\*|__)(.*?)\1/g)
content = strip(content, /(\*|_)(.*?)\1/g)
const newPrefix = currentLevel === level ? '' : '#'.repeat(level) + ' '
// Replace the line and place the cursor in one transaction: a bare
// setLine maps a caret at ch 0 to before the inserted `#… ` prefix
editor.transaction({
changes: [{
from: { line: cursor.line, ch: 0 },
to: { line: cursor.line, ch: line.length },
text: newPrefix + content,
}],
selection: {
from: { line: cursor.line, ch: newPrefix.length + contentCursor },
},
}, 'ToggleHeadingStrip' + level.toString())
} }
} }
+19
View File
@@ -1,4 +1,6 @@
import { Editor, MarkdownView, MarkdownFileInfo, Plugin } from 'obsidian'; import { Editor, MarkdownView, MarkdownFileInfo, Plugin } from 'obsidian';
import { deleteGroupBackward, deleteGroupForward } from '@codemirror/commands';
import type { EditorView } from '@codemirror/view';
import { import {
BindThemSettings, BindThemSettings,
@@ -472,6 +474,23 @@ export default class BindThemPlugin extends Plugin {
editorCallback: (editor: Editor, view: MarkdownView | MarkdownFileInfo) => { editorCallback: (editor: Editor, view: MarkdownView | MarkdownFileInfo) => {
this.deleteToLineBoundary(editor, 'end'); this.deleteToLineBoundary(editor, 'end');
}}); }});
this.addConditionalCommand({
id: 'delete-previous-word',
name: 'Delete Previous Word',
icon: 'delete',
editorCallback: (editor: Editor) => {
// Obsidian's Editor.exec API does not expose word deletion.
deleteGroupBackward((editor as Editor & { cm: EditorView }).cm);
}
});
this.addConditionalCommand({
id: 'delete-next-word',
name: 'Delete Next Word',
icon: 'delete',
editorCallback: (editor: Editor) => {
deleteGroupForward((editor as Editor & { cm: EditorView }).cm);
}
});
this.addConditionalCommand({ this.addConditionalCommand({
id: 'join-lines', id: 'join-lines',
name: 'Join Lines', name: 'Join Lines',
+2
View File
@@ -75,6 +75,8 @@ export const COMMANDS: Record<keyof typeof COMMAND_CATEGORIES, CommandDefinition
{ id: 'delete-line', name: 'Delete line' }, { id: 'delete-line', name: 'Delete line' },
{ id: 'delete-to-start-of-line', name: 'Delete to start of line' }, { id: 'delete-to-start-of-line', name: 'Delete to start of line' },
{ id: 'delete-to-end-of-line', name: 'Delete to end of line' }, { id: 'delete-to-end-of-line', name: 'Delete to end of line' },
{ id: 'delete-previous-word', name: 'Delete previous word' },
{ id: 'delete-next-word', name: 'Delete next word' },
{ id: 'join-lines', name: 'Join lines' }, { id: 'join-lines', name: 'Join lines' },
{ id: 'duplicate-line', name: 'Duplicate line' }, { id: 'duplicate-line', name: 'Duplicate line' },
{ id: 'copy-line-up', name: 'Copy line up' }, { id: 'copy-line-up', name: 'Copy line up' },
+3 -1
View File
@@ -1,4 +1,6 @@
{ {
"1.0.0": "0.15.0", "1.0.0": "0.15.0",
"1.1.0": "0.15.0" "1.1.0": "0.15.0",
"1.2.0": "0.15.0",
"1.2.1": "0.15.0"
} }