Skip to content

Commit

Permalink
add ctrl+a keystroke, close #2466
Browse files Browse the repository at this point in the history
  • Loading branch information
jancimertel committed Dec 26, 2024
1 parent 4e7c255 commit bc0be27
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/annotator/src/lib/Keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,9 @@ export default class Keys {
if (e.ctrlKey || e.metaKey) {
if (e.key === "c") {
this.annotator.onCopyText();
}
if (e.key === "v") {
} else if (e.key === "v") {
this.annotator.onPasteText();
}
if (e.key === "x") {
} else if (e.key === "x") {
if (this.text.mode === EditMode.RAW) {
this.annotator.onCopyText();
const area = this.cursor.getSelectedArea();
Expand All @@ -518,6 +516,17 @@ export default class Keys {
);
}
}
} else if (e.key === "a") {
this.cursor.selectStart = {
yLine: 0,
xLine: 0,
}

const lastSegment = this.text.segments[this.text.segments.length - 1];
this.cursor.selectEnd = {
xLine: lastSegment.lines[lastSegment.lines.length - 1].length,
yLine: lastSegment.lineEnd
}
}
break;
}
Expand Down

0 comments on commit bc0be27

Please sign in to comment.