mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-14 11:17:57 +01:00
Fix key bugs.
This commit is contained in:
parent
267dbfc9c1
commit
817215514b
@ -35,7 +35,7 @@ const mapId = 'welcome';
|
|||||||
const options: EditorOptions = {
|
const options: EditorOptions = {
|
||||||
zoom: 0.8,
|
zoom: 0.8,
|
||||||
locked: false,
|
locked: false,
|
||||||
mapTitle: "Develop Mindnap",
|
mapTitle: "Develop WiseMapping",
|
||||||
mode: 'edition-owner',
|
mode: 'edition-owner',
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
enableKeyboardEvents: true
|
enableKeyboardEvents: true
|
||||||
|
@ -36,7 +36,7 @@ const persistence = new LocalStorageManager('samples/{id}.wxml', false);
|
|||||||
const options: EditorOptions = {
|
const options: EditorOptions = {
|
||||||
zoom: 0.8,
|
zoom: 0.8,
|
||||||
locked: false,
|
locked: false,
|
||||||
mapTitle: "Develop Mindnap",
|
mapTitle: "Develop WiseMapping",
|
||||||
mode: 'viewonly',
|
mode: 'viewonly',
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
enableKeyboardEvents: true
|
enableKeyboardEvents: true
|
||||||
|
@ -268,29 +268,18 @@ class DesignerKeyboard extends Keyboard {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const excludes = ['esc', 'escape', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12'];
|
const excludes = ['Escape', 'F1', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12'];
|
||||||
|
|
||||||
$(document).on('keypress', (event) => {
|
$(document).on('keypress', (event) => {
|
||||||
let keyCode: number;
|
|
||||||
|
|
||||||
if (DesignerKeyboard.isDisabled()) {
|
if (DesignerKeyboard.isDisabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Firefox doesn't skip special keys for keypress event...
|
// Firefox doesn't skip special keys for keypress event...
|
||||||
if (event.key && excludes.includes(event.key.toLowerCase())) {
|
if (excludes.includes(event.code)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Sometimes Firefox doesn't contain keyCode value
|
|
||||||
if (event.key && event.keyCode === 0) {
|
|
||||||
keyCode = event.charCode;
|
|
||||||
} else {
|
|
||||||
keyCode = event.keyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const jq: any = $;
|
if (['Enter', 'Capslock'].indexOf(event.code) === -1) {
|
||||||
const specialKey = jq.hotkeys.specialKeys[keyCode];
|
|
||||||
if (['enter', 'capslock'].indexOf(specialKey) === -1 && !jq.hotkeys.shiftNums[keyCode]) {
|
|
||||||
const nodes = designer.getModel().filterSelectedTopics();
|
const nodes = designer.getModel().filterSelectedTopics();
|
||||||
if (nodes.length > 0) {
|
if (nodes.length > 0) {
|
||||||
// If a modifier is press, the key selected must be ignored.
|
// If a modifier is press, the key selected must be ignored.
|
||||||
|
Loading…
Reference in New Issue
Block a user