mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 18:43:58 +00:00
fixed command palette
This commit is contained in:
@@ -163,7 +163,7 @@
|
|||||||
on:clickOutside={() => {
|
on:clickOutside={() => {
|
||||||
$visibleCommandPalette = null;
|
$visibleCommandPalette = null;
|
||||||
}}
|
}}
|
||||||
data-testid='CommandPalette_main'
|
data-testid="CommandPalette_main"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="overlay"
|
class="overlay"
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ export default function registerCommand(command: GlobalCommand) {
|
|||||||
[command.id]: {
|
[command.id]: {
|
||||||
text:
|
text:
|
||||||
isDefferedTranslationResult(command.category) || isDefferedTranslationResult(command.name)
|
isDefferedTranslationResult(command.category) || isDefferedTranslationResult(command.name)
|
||||||
? () => `${_tval(command.category)}: ${_tval(command.name)}`
|
? {
|
||||||
|
_transCallback: () => `${_tval(command.category)}: ${_tval(command.name)}`,
|
||||||
|
}
|
||||||
: `${command.category}: ${command.name}`,
|
: `${command.category}: ${command.name}`,
|
||||||
...command,
|
...command,
|
||||||
enabled: !testEnabled,
|
enabled: !testEnabled,
|
||||||
|
|||||||
@@ -84,8 +84,9 @@ export function _t(key: string, options: TranslateOptions): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type DefferedTranslationResult = {
|
export type DefferedTranslationResult = {
|
||||||
_transKey: string;
|
_transKey?: string;
|
||||||
_transOptions: TranslateOptions;
|
_transOptions?: TranslateOptions;
|
||||||
|
_transCallback?: () => string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function __t(key: string, options: TranslateOptions): DefferedTranslationResult {
|
export function __t(key: string, options: TranslateOptions): DefferedTranslationResult {
|
||||||
@@ -100,6 +101,10 @@ export function _tval(x: string | DefferedTranslationResult): string {
|
|||||||
if (typeof x?._transKey === 'string') {
|
if (typeof x?._transKey === 'string') {
|
||||||
return _t(x._transKey, x._transOptions);
|
return _t(x._transKey, x._transOptions);
|
||||||
}
|
}
|
||||||
|
if (typeof x?._transCallback === 'function') {
|
||||||
|
return x._transCallback();
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDefferedTranslationResult(
|
export function isDefferedTranslationResult(
|
||||||
|
|||||||
Reference in New Issue
Block a user