浏览代码

removing support for the obsolete keypress event

Falko Schindler 2 年之前
父节点
当前提交
4a49b6473a
共有 3 个文件被更改,包括 1 次插入4 次删除
  1. 0 1
      nicegui/elements/keyboard.js
  2. 1 2
      nicegui/elements/keyboard.py
  3. 0 1
      nicegui/events.py

+ 0 - 1
nicegui/elements/keyboard.js

@@ -16,7 +16,6 @@ Vue.component("keyboard", {
         };
         };
         if (evt instanceof KeyboardEvent) {
         if (evt instanceof KeyboardEvent) {
           if (evt.repeat && !this.$props.jp_props.options.repeating) return;
           if (evt.repeat && !this.$props.jp_props.options.repeating) return;
-          // https://developer.mozilla.org/en-US/docs/Web/Events/keydown   keyup, keypress
           e["key_data"] = {
           e["key_data"] = {
             action: event,
             action: event,
             altKey: evt.altKey,
             altKey: evt.altKey,

+ 1 - 2
nicegui/elements/keyboard.py

@@ -11,7 +11,7 @@ CustomView.use(__file__)
 class KeyboardView(CustomView):
 class KeyboardView(CustomView):
 
 
     def __init__(self, on_key: Callable, repeating: bool):
     def __init__(self, on_key: Callable, repeating: bool):
-        super().__init__('keyboard', active_js_events=['keydown', 'keyup', 'keypress'], repeating=repeating)
+        super().__init__('keyboard', active_js_events=['keydown', 'keyup'], repeating=repeating)
         self.allowed_events = ['keyboardEvent']
         self.allowed_events = ['keyboardEvent']
         self.style = 'display: none'
         self.style = 'display: none'
         self.initialize(temp=False, on_keyboardEvent=on_key)
         self.initialize(temp=False, on_keyboardEvent=on_key)
@@ -39,7 +39,6 @@ class Keyboard(Element):
 
 
         try:
         try:
             action = KeyboardAction(
             action = KeyboardAction(
-                keypress=msg.key_data.action == 'keypress',
                 keydown=msg.key_data.action == 'keydown',
                 keydown=msg.key_data.action == 'keydown',
                 keyup=msg.key_data.action == 'keyup',
                 keyup=msg.key_data.action == 'keyup',
                 repeat=msg.key_data.repeat,
                 repeat=msg.key_data.repeat,

+ 0 - 1
nicegui/events.py

@@ -45,7 +45,6 @@ class ValueChangeEventArguments(EventArguments):
 
 
 @dataclass
 @dataclass
 class KeyboardAction:
 class KeyboardAction:
-    keypress: bool
     keydown: bool
     keydown: bool
     keyup: bool
     keyup: bool
     repeat: bool
     repeat: bool