Clear page / clear document state shortcut
This commit is contained in:
parent
9ded94945f
commit
5443b10c1d
2 changed files with 13 additions and 6 deletions
|
@ -136,7 +136,13 @@ export default function useKeyboardEvents() {
|
||||||
}
|
}
|
||||||
case 'Backspace': {
|
case 'Backspace': {
|
||||||
if (metaKey(e)) {
|
if (metaKey(e)) {
|
||||||
state.send('RESET_PAGE', info)
|
if (e.shiftKey) {
|
||||||
|
if (window.confirm('Reset document and state?')) {
|
||||||
|
state.send('RESET_DOCUMENT_STATE', info)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
state.send('FORCE_CLEARED_PAGE', info)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.send('DELETED', info)
|
state.send('DELETED', info)
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ const state = createState({
|
||||||
// Network-Related
|
// Network-Related
|
||||||
// RT_LOADED_ROOM: [
|
// RT_LOADED_ROOM: [
|
||||||
// 'clearRoom',
|
// 'clearRoom',
|
||||||
// { if: 'hasRoom', do: ['clearDocument', 'connectToRoom'] },
|
// { if: 'hasRoom', do: ['resetDocumentState', 'connectToRoom'] },
|
||||||
// ],
|
// ],
|
||||||
// RT_UNLOADED_ROOM: ['clearRoom', 'clearDocument'],
|
// RT_UNLOADED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||||
// RT_DISCONNECTED_ROOM: ['clearRoom', 'clearDocument'],
|
// RT_DISCONNECTED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||||
// RT_CREATED_SHAPE: 'addRtShape',
|
// RT_CREATED_SHAPE: 'addRtShape',
|
||||||
// RT_CHANGED_STATUS: 'setRtStatus',
|
// RT_CHANGED_STATUS: 'setRtStatus',
|
||||||
// RT_DELETED_SHAPE: 'deleteRtShape',
|
// RT_DELETED_SHAPE: 'deleteRtShape',
|
||||||
|
@ -177,7 +177,7 @@ const state = createState({
|
||||||
// MOVED_POINTER: { secretlyDo: 'sendRtCursorMove' },
|
// MOVED_POINTER: { secretlyDo: 'sendRtCursorMove' },
|
||||||
// Client
|
// Client
|
||||||
RESIZED_WINDOW: 'resetPageState',
|
RESIZED_WINDOW: 'resetPageState',
|
||||||
RESET_PAGE: 'resetPage',
|
RESET_DOCUMENT_STATE: 'resetDocumentState',
|
||||||
TOGGLED_READ_ONLY: 'toggleReadOnly',
|
TOGGLED_READ_ONLY: 'toggleReadOnly',
|
||||||
LOADED_FONTS: 'resetShapes',
|
LOADED_FONTS: 'resetShapes',
|
||||||
USED_PEN_DEVICE: 'enablePenLock',
|
USED_PEN_DEVICE: 'enablePenLock',
|
||||||
|
@ -215,6 +215,7 @@ const state = createState({
|
||||||
unlessAny: ['isReadOnly', 'isInSession'],
|
unlessAny: ['isReadOnly', 'isInSession'],
|
||||||
do: ['updateStyles', 'applyStylesToSelection'],
|
do: ['updateStyles', 'applyStylesToSelection'],
|
||||||
},
|
},
|
||||||
|
FORCE_CLEARED_PAGE: ['selectAll', 'deleteSelection'],
|
||||||
CLEARED_PAGE: {
|
CLEARED_PAGE: {
|
||||||
unlessAny: ['isReadOnly', 'isInSession'],
|
unlessAny: ['isReadOnly', 'isInSession'],
|
||||||
if: 'hasSelection',
|
if: 'hasSelection',
|
||||||
|
@ -1184,7 +1185,7 @@ const state = createState({
|
||||||
clearRoom(data) {
|
clearRoom(data) {
|
||||||
data.room = undefined
|
data.room = undefined
|
||||||
},
|
},
|
||||||
clearDocument(data) {
|
resetDocumentState(data) {
|
||||||
data.document.id = uniqueId()
|
data.document.id = uniqueId()
|
||||||
|
|
||||||
const newId = 'page1'
|
const newId = 'page1'
|
||||||
|
|
Loading…
Reference in a new issue