mirror of
https://github.com/zadam/trilium.git
synced 2026-02-26 08:33:36 +01:00
fix(editor): resolve strange stuck indent when a Note has images (#8520)
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
This commit is contained in:
commit
f62f156c93
@ -2,28 +2,28 @@
|
||||
* https://github.com/zadam/trilium/issues/978
|
||||
*/
|
||||
|
||||
import { ModelDocumentFragment, ModelElement, Plugin, ModelPosition } from "ckeditor5";
|
||||
import { ModelDocumentFragment, ModelElement, Plugin, ModelPosition, ViewDocumentTabEvent, isWidget } from "ckeditor5";
|
||||
|
||||
export default class IndentBlockShortcutPlugin extends Plugin {
|
||||
|
||||
init() {
|
||||
this.editor.keystrokes.set( 'Tab', ( _, cancel ) => {
|
||||
const command = this.editor.commands.get( 'indentBlock' );
|
||||
this.listenTo<ViewDocumentTabEvent>(this.editor.editing.view.document, "tab", (ev, data) => {
|
||||
// In tables, allow default Tab behavior for cell navigation
|
||||
if (this.isInTable()) return;
|
||||
|
||||
if (command && command.isEnabled && !this.isInTable() ) {
|
||||
// Always cancel in non-table contexts to prevent widget navigation
|
||||
data.preventDefault();
|
||||
ev.stop();
|
||||
|
||||
const commandName = data.shiftKey ? "outdentBlock" : "indentBlock";
|
||||
const command = this.editor.commands.get(commandName);
|
||||
if (command?.isEnabled) {
|
||||
command.execute();
|
||||
cancel();
|
||||
}
|
||||
} );
|
||||
|
||||
this.editor.keystrokes.set( 'Shift+Tab', ( _, cancel ) => {
|
||||
const command = this.editor.commands.get( 'outdentBlock' );
|
||||
|
||||
if (command && command.isEnabled && !this.isInTable() ) {
|
||||
command.execute();
|
||||
cancel();
|
||||
}
|
||||
} );
|
||||
}, {
|
||||
priority: "highest",
|
||||
context: node => isWidget( node ) || node.is( 'editableElement' ),
|
||||
});
|
||||
}
|
||||
|
||||
// in table TAB should switch cells
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user