mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-13 15:27:30 +08:00
Text edit input behavior fixed
This commit is contained in:
@@ -11,8 +11,10 @@ export default class IKeyboardShortcut extends IInput {
|
||||
#activationKeys
|
||||
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options.listenOnFocus = true
|
||||
options.activateAnyKey ??= false
|
||||
options.activationKeys ??= []
|
||||
options.listenOnFocus ??= true
|
||||
options.unlistenOnTextEdit ??= true
|
||||
if (!(options.activationKeys instanceof Array)) {
|
||||
options.activationKeys = [options.activationKeys]
|
||||
}
|
||||
@@ -42,12 +44,14 @@ export default class IKeyboardShortcut extends IInput {
|
||||
/** @param {KeyboardEvent} e */
|
||||
this.keyDownHandler = e => {
|
||||
if (
|
||||
self.#activationKeys.some(keyEntry =>
|
||||
this.options.activateAnyKey
|
||||
|| self.#activationKeys.some(keyEntry =>
|
||||
wantsShift(keyEntry) == e.shiftKey
|
||||
&& wantsCtrl(keyEntry) == e.ctrlKey
|
||||
&& wantsAlt(keyEntry) == e.altKey
|
||||
&& Configuration.Keys[keyEntry.Key] == e.code
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
if (options.consumeEvent) {
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
@@ -60,13 +64,15 @@ export default class IKeyboardShortcut extends IInput {
|
||||
/** @param {KeyboardEvent} e */
|
||||
this.keyUpHandler = e => {
|
||||
if (
|
||||
self.#activationKeys.some(keyEntry =>
|
||||
this.options.activateAnyKey
|
||||
|| self.#activationKeys.some(keyEntry =>
|
||||
keyEntry.bShift && e.key == "Shift"
|
||||
|| keyEntry.bCtrl && e.key == "Control"
|
||||
|| keyEntry.bAlt && e.key == "Alt"
|
||||
|| keyEntry.bCmd && e.key == "Meta"
|
||||
|| Configuration.Keys[keyEntry.Key] == e.code
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
if (options.consumeEvent) {
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@ export default class KeyboardCanc extends IKeyboardShortcut {
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options = {
|
||||
...options,
|
||||
activationKeys: Configuration.deleteNodesKeyboardKey
|
||||
}
|
||||
options.activationKeys = Configuration.deleteNodesKeyboardKey
|
||||
super(target, blueprint, options)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ export default class KeyboardEnableZoom extends IKeyboardShortcut {
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options = {
|
||||
...options,
|
||||
activationKeys: Configuration.enableZoomIn
|
||||
}
|
||||
options.activationKeys = Configuration.enableZoomIn
|
||||
super(target, blueprint, options)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ export default class KeyboardSelectAll extends IKeyboardShortcut {
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options = {
|
||||
...options,
|
||||
activationKeys: Configuration.selectAllKeyboardKey
|
||||
}
|
||||
options.activationKeys = Configuration.selectAllKeyboardKey
|
||||
super(target, blueprint, options)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user