mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance (wip): customizable shortcuts
This commit is contained in:
committed by
Gabriel Horner
parent
9a89def497
commit
96aed148b4
@@ -196,16 +196,6 @@ export class TLApi<S extends TLShape = TLShape, K extends TLEventMap = TLEventMa
|
||||
return this
|
||||
}
|
||||
|
||||
save = () => {
|
||||
this.app.save()
|
||||
return this
|
||||
}
|
||||
|
||||
saveAs = () => {
|
||||
this.app.save()
|
||||
return this
|
||||
}
|
||||
|
||||
undo = () => {
|
||||
this.app.undo()
|
||||
return this
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
createNewLineBinding,
|
||||
dedupe,
|
||||
isNonNullable,
|
||||
KeyUtils,
|
||||
uniqueId,
|
||||
} from '../../utils'
|
||||
import type { TLShape, TLShapeConstructor, TLShapeModel } from '../shapes'
|
||||
@@ -92,94 +91,6 @@ export class TLApp<
|
||||
|
||||
Tools: TLToolConstructor<S, K>[] = []
|
||||
|
||||
initKeyboardShortcuts() {
|
||||
const ownShortcuts: TLShortcut<S, K>[] = [
|
||||
{
|
||||
keys: 'shift+0',
|
||||
fn: () => this.api.resetZoom(),
|
||||
},
|
||||
{
|
||||
keys: 'shift+1',
|
||||
fn: () => this.api.zoomToFit(),
|
||||
},
|
||||
{
|
||||
keys: 'shift+2',
|
||||
fn: () => this.api.zoomToSelection(),
|
||||
},
|
||||
{
|
||||
keys: 'mod+up',
|
||||
fn: () => this.api.setCollapsed(true),
|
||||
},
|
||||
{
|
||||
keys: 'mod+down',
|
||||
fn: () => this.api.setCollapsed(false),
|
||||
},
|
||||
{
|
||||
keys: 'mod+-',
|
||||
fn: () => this.api.zoomOut(),
|
||||
},
|
||||
{
|
||||
keys: 'mod+=',
|
||||
fn: () => this.api.zoomIn(),
|
||||
},
|
||||
{
|
||||
keys: 'mod+x',
|
||||
fn: () => this.cut(),
|
||||
},
|
||||
{
|
||||
keys: '[',
|
||||
fn: () => this.sendBackward(),
|
||||
},
|
||||
{
|
||||
keys: 'shift+[',
|
||||
fn: () => this.sendToBack(),
|
||||
},
|
||||
{
|
||||
keys: ']',
|
||||
fn: () => this.bringForward(),
|
||||
},
|
||||
{
|
||||
keys: 'shift+]',
|
||||
fn: () => this.bringToFront(),
|
||||
},
|
||||
{
|
||||
keys: 'mod+a',
|
||||
fn: () => {
|
||||
const { selectedTool } = this
|
||||
if (selectedTool.id !== 'select') {
|
||||
this.selectTool('select')
|
||||
}
|
||||
this.api.selectAll()
|
||||
},
|
||||
},
|
||||
{
|
||||
keys: 'mod+shift+s',
|
||||
fn: () => {
|
||||
this.saveAs()
|
||||
this.notify('saveAs', null)
|
||||
},
|
||||
},
|
||||
{
|
||||
keys: 'mod+shift+v',
|
||||
fn: (_, __, e) => {
|
||||
if (!this.editingShape) {
|
||||
e.preventDefault()
|
||||
this.paste(undefined, true)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
keys: ['del', 'backspace'],
|
||||
fn: () => {
|
||||
if (!this.editingShape) {
|
||||
this.api.deleteShapes()
|
||||
this.selectedTool.transition('idle')
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
/* --------------------- History -------------------- */
|
||||
|
||||
history = new TLHistory<S, K>(this)
|
||||
@@ -226,12 +137,6 @@ export class TLApp<
|
||||
return this
|
||||
}
|
||||
|
||||
saveAs = (): this => {
|
||||
// todo
|
||||
this.notify('saveAs', null)
|
||||
return this
|
||||
}
|
||||
|
||||
@computed get serialized(): TLDocumentModel<S> {
|
||||
return {
|
||||
// currentPageId: this.currentPageId,
|
||||
|
||||
@@ -163,14 +163,6 @@ export type TLSubscriptionEvent =
|
||||
event: 'persist'
|
||||
info: { replace: boolean }
|
||||
}
|
||||
| {
|
||||
event: 'save'
|
||||
info: null
|
||||
}
|
||||
| {
|
||||
event: 'saveAs'
|
||||
info: null
|
||||
}
|
||||
| {
|
||||
event: 'undo'
|
||||
info: null
|
||||
@@ -260,8 +252,6 @@ export interface TLCallbacks<
|
||||
> {
|
||||
onMount: TLCallback<S, K, R, 'mount'>
|
||||
onPersist: TLCallback<S, K, R, 'persist'>
|
||||
onSave: TLCallback<S, K, R, 'save'>
|
||||
onSaveAs: TLCallback<S, K, R, 'saveAs'>
|
||||
onError: TLCallback<S, K, R, 'error'>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user