mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-10-20 00:17:55 +00:00
fix: share filtered shortcut bindings with the Web matcher
Pass the active platform config to JavaScript at startup and after settings changes, preserving unsupported saved bindings in local storage. Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -993,10 +993,17 @@ class RustdeskImpl {
|
||||
}
|
||||
|
||||
// Tell the JS-side matcher (flutter/web/js/src/shortcut_matcher.ts) to
|
||||
// re-read its bindings from LocalStorage. Mirrors the native call which
|
||||
// refreshes the Rust matcher's in-memory cache.
|
||||
// use the same platform-filtered bindings as the Flutter matcher, while
|
||||
// keeping unsupported saved bindings in LocalStorage.
|
||||
void mainReloadKeyboardShortcuts({dynamic hint}) {
|
||||
js.context.callMethod('reloadShortcuts', []);
|
||||
final config = ShortcutModel.config(active: true);
|
||||
js.context.callMethod('reloadShortcuts', [
|
||||
jsonEncode({
|
||||
'enabled': config.enabled,
|
||||
'pass_through': config.passThrough,
|
||||
'bindings': config.bindings,
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
// Web has no Rust at runtime, so the defaults seed comes from the
|
||||
@@ -1263,6 +1270,7 @@ class RustdeskImpl {
|
||||
ShortcutModel.onWebTriggered(action);
|
||||
}
|
||||
};
|
||||
mainReloadKeyboardShortcuts();
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user