From 84e5adc199bc6a1ce742892c1937221f48aff139 Mon Sep 17 00:00:00 2001 From: Juliano Penna Date: Mon, 29 Jan 2024 22:35:36 -0300 Subject: [PATCH] chore: translate commands (#687) * feat: translate commands descriptions * feat: allow for commands without description --- documentation/translation.md | 2 +- lib/l10n/intl_en.arb | 68 ++- lib/l10n/intl_pt_BR.arb | 70 ++- .../convert_to_paragraph_command.dart | 1 + .../base_component/indent_command.dart | 1 + .../base_component/outdent_command.dart | 1 + .../table_block_component/table_commands.dart | 23 +- .../todo_list_command_shortcut.dart | 1 + .../shortcuts/command/arrow_down_command.dart | 4 + .../shortcuts/command/arrow_left_command.dart | 8 +- .../command/arrow_right_command.dart | 8 +- .../shortcuts/command/arrow_up_command.dart | 4 + .../shortcuts/command/backspace_command.dart | 1 + .../shortcuts/command/copy_command.dart | 1 + .../shortcuts/command/cut_command.dart | 1 + .../shortcuts/command/delete_command.dart | 1 + .../shortcuts/command/end_command.dart | 1 + .../shortcuts/command/escape_command.dart | 1 + .../command/find_replace_command.dart | 2 + .../shortcuts/command/home_command.dart | 1 + .../shortcuts/command/markdown_commands.dart | 5 + .../shortcuts/command/open_link_command.dart | 1 + .../shortcuts/command/open_links_command.dart | 1 + .../shortcuts/command/page_down_command.dart | 1 + .../shortcuts/command/page_up_command.dart | 1 + .../shortcuts/command/paste_command.dart | 2 + .../command/remove_line_command.dart | 1 + .../command/remove_word_command.dart | 2 + .../shortcuts/command/select_all_command.dart | 1 + .../command/show_link_menu_command.dart | 1 + .../command/toggle_colors_command.dart | 2 + .../shortcuts/command/undo_redo_command.dart | 2 + .../shortcuts/command_shortcut_event.dart | 7 +- .../selection_menu/selection_menu_widget.dart | 6 +- lib/src/l10n/intl/messages_en.dart | 122 +++- lib/src/l10n/intl/messages_pt-BR.dart | 122 +++- lib/src/l10n/intl/messages_pt-PT.dart | 20 - lib/src/l10n/l10n.dart | 568 +++++++++++++++++- .../shortcut_event/shortcut_event_test.dart | 1 + 39 files changed, 958 insertions(+), 108 deletions(-) diff --git a/documentation/translation.md b/documentation/translation.md index d9929eed..d84f462a 100644 --- a/documentation/translation.md +++ b/documentation/translation.md @@ -49,7 +49,7 @@ class _HomePageState extends State { void toggleLocale() { final locale = Intl.getCurrentLocale(); - if (locale == 'en_US') { + if (locale.startsWith('en')) { // Change to the locale you want to test AppFlowyEditorLocalizations.load(const Locale('pt', 'BR')); } else { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 0c3b38af..9873f5ec 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -119,12 +119,64 @@ "textAlignLeft": "Align Left", "textAlignCenter": "Align Center", "textAlignRight": "Align Right", - "cmdDontAddNewLineInTableCell": "Don't add new line in table cell", - "cmdMoveToLeftCellIfItsAtStartOfCurrentCell": "Move to left cell if its at start of current cell", - "cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": "Move to right cell if its at the end of current cell", - "cmdMoveToUpCellAtSameOffset": "Move to up cell at same offset", - "cmdMoveToDownCellAtSameOffset": "Move to down cell at same offset", - "cmdNavigateAroundTheCellsAtSameOffset": "Navigate around the cells at same offset", - "cmdNavigateAroundTheCellsAtSameOffsetInReverse": "Navigate around the cells at same offset in reverse", - "cmdStopAtTheBeginningOfTheCell": "Stop at the beginning of the cell" + "cmdConvertToLink": "Convert to link", + "cmdConvertToParagraph": "convert to paragraph", + "cmdCopySelection": "Copy selection", + "cmdCutSelection": "Cut selection", + "cmdDeleteLeft": "Delete character to the left", + "cmdDeleteLineLeft": "Delete to beginning of line", + "cmdDeleteRight": "Delete character to the right", + "cmdDeleteWordLeft": "delete word at left", + "cmdDeleteWordRight": "delete word at right", + "cmdExitEditing": "exit editing mode", + "cmdIndent": "indent", + "cmdMoveCursorBottom": "move cursor to the bottom", + "cmdMoveCursorBottomSelect": "Select all until end of file", + "cmdMoveCursorDown": "move cursor down", + "cmdMoveCursorDownSelect": "Select downward", + "cmdMoveCursorLeft": "move cursor left", + "cmdMoveCursorLeftSelect": "Select left", + "cmdMoveCursorLineEnd": "move cursor to the end of line", + "cmdMoveCursorLineEndSelect": "Select to end of line", + "cmdMoveCursorLineStart": "move cursor to start of line", + "cmdMoveCursorLineStartSelect": "Select to start of line", + "cmdMoveCursorRight": "move cursor right", + "cmdMoveCursorRightSelect": "Select right", + "cmdMoveCursorTop": "move cursor to the top", + "cmdMoveCursorTopSelect": "Select all until start of file", + "cmdMoveCursorUp": "move cursor up", + "cmdMoveCursorUpSelect": "Select upward", + "cmdMoveCursorWordLeft": "move cursor to word on the left", + "cmdMoveCursorWordLeftSelect": "Select word to the left", + "cmdMoveCursorWordRight": "move cursor to word on the right", + "cmdMoveCursorWordRightSelect": "Select word to the right", + "cmdOpenFind": "Open Find", + "cmdOpenFindAndReplace": "Open Find and Replace", + "cmdOpenLink": "open link", + "cmdOpenLinks": "open links", + "cmdOutdent": "outdent", + "cmdPasteContent": "paste content", + "cmdPasteContentAsPlainText": "paste content as plain text", + "cmdRedo": "redo", + "cmdScrollPageDown": "scroll page down", + "cmdScrollPageUp": "scroll page up", + "cmdScrollToBottom": "scroll to bottom", + "cmdScrollToTop": "scroll to top", + "cmdSelectAll": "select all", + "cmdTableLineBreak": "Table: add line break", + "cmdTableMoveToDownCellAtSameOffset": "Move to down cell at same offset", + "cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": "Move to left cell if its at start of current cell", + "cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": "Move to right cell if its at the end of current cell", + "cmdTableMoveToUpCellAtSameOffset": "Move to up cell at same offset", + "cmdTableNavigateCells": "Navigate around the cells at same offset", + "cmdTableNavigateCellsReverse": "Navigate around the cells at same offset in reverse", + "cmdTableStopAtTheBeginningOfTheCell": "Stop at the beginning of the cell", + "cmdToggleBold": "toggle bold", + "cmdToggleCode": "toggle code", + "cmdToggleHighlight": "toggle highlight", + "cmdToggleItalic": "toggle italic", + "cmdToggleStrikethrough": "toggle strikethrough", + "cmdToggleTodoList": "toggle the todo list", + "cmdToggleUnderline": "toggle underline", + "cmdUndo": "undo" } diff --git a/lib/l10n/intl_pt_BR.arb b/lib/l10n/intl_pt_BR.arb index 84f96aa7..fbc57442 100644 --- a/lib/l10n/intl_pt_BR.arb +++ b/lib/l10n/intl_pt_BR.arb @@ -21,14 +21,66 @@ "chooseImage": "Selecionar imagem", "clearHighlightColor": "Limpar cor de destaque", "closeFind": "Fechar", - "cmdDontAddNewLineInTableCell": "Não adicionar nova linha na célula", - "cmdMoveToDownCellAtSameOffset": "Mover para a célula abaixo na mesma posição", - "cmdMoveToLeftCellIfItsAtStartOfCurrentCell": "Mover para a célula à esquerda se estiver no início da célula atual", - "cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": "Mover para a célula à direita se estiver no final da célula atual", - "cmdMoveToUpCellAtSameOffset": "Mover para a célula acima na mesma posição", - "cmdNavigateAroundTheCellsAtSameOffset": "Navegar pelas células na mesma posição", - "cmdNavigateAroundTheCellsAtSameOffsetInReverse": "Navegar pelas células na mesma posição (reverso)", - "cmdStopAtTheBeginningOfTheCell": "Parar no início da célula", + "cmdConvertToLink": "Converter para link", + "cmdConvertToParagraph": "converter para parágrafo", + "cmdCopySelection": "Copiar seleção", + "cmdCutSelection": "Cortar seleção", + "cmdDeleteLeft": "Deletar caractere à esquerda", + "cmdDeleteLineLeft": "Deletar até o início da linha", + "cmdDeleteRight": "Deletar caractere à direita", + "cmdDeleteWordLeft": "Deletar palavra à esquerda", + "cmdDeleteWordRight": "Deletar palavra à direita", + "cmdExitEditing": "sair do modo de edição", + "cmdIndent": "indentar", + "cmdMoveCursorBottom": "mover cursor para o final do arquivo", + "cmdMoveCursorBottomSelect": "Selecionar tudo até o final do arquivo", + "cmdMoveCursorDown": "mover cursor para baixo", + "cmdMoveCursorDownSelect": "Selecionar para baixo", + "cmdMoveCursorLeft": "mover cursor para a esquerda", + "cmdMoveCursorLeftSelect": "Selecionar à esquerda", + "cmdMoveCursorLineEnd": "mover cursor para o final da linha", + "cmdMoveCursorLineEndSelect": "Selecionar até o final da linha", + "cmdMoveCursorLineStart": "mover cursor para o início da linha", + "cmdMoveCursorLineStartSelect": "Selecionar até o início da linha", + "cmdMoveCursorRight": "mover cursor para a direita", + "cmdMoveCursorRightSelect": "Selecionar à direita", + "cmdMoveCursorTop": "mover cursor para o topo", + "cmdMoveCursorTopSelect": "Selecionar tudo até o início do arquivo", + "cmdMoveCursorUp": "mover cursor para cima", + "cmdMoveCursorUpSelect": "Selecionar para cima", + "cmdMoveCursorWordLeft": "mover cursor para a palavra à esquerda", + "cmdMoveCursorWordLeftSelect": "Selecionar palavra à esquerda", + "cmdMoveCursorWordRight": "mover cursor para a palavra à direita", + "cmdMoveCursorWordRightSelect": "Selecionar palavra à direita", + "cmdOpenFind": "Abrir Localizar", + "cmdOpenFindAndReplace": "Abrir Localizar e Substituir", + "cmdOpenLink": "abrir link", + "cmdOpenLinks": "abrir links", + "cmdOutdent": "desindentar", + "cmdPasteContent": "colar conteúdo", + "cmdPasteContentAsPlainText": "colar conteúdo como texto simples", + "cmdRedo": "refazer", + "cmdScrollPageDown": "rolar página para baixo", + "cmdScrollPageUp": "rolar página para cima", + "cmdScrollToBottom": "rolar para o fim", + "cmdScrollToTop": "rolar para o topo", + "cmdSelectAll": "selecionar tudo", + "cmdTableLineBreak": "Não adicionar nova linha na célula", + "cmdTableMoveToDownCellAtSameOffset": "Mover para a célula abaixo na mesma posição", + "cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": "Mover para a célula à esquerda se estiver no início da célula atual", + "cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": "Mover para a célula à direita se estiver no final da célula atual", + "cmdTableMoveToUpCellAtSameOffset": "Mover para a célula acima na mesma posição", + "cmdTableNavigateCells": "Navegar pelas células na mesma posição", + "cmdTableNavigateCellsReverse": "Navegar pelas células na mesma posição (reverso)", + "cmdTableStopAtTheBeginningOfTheCell": "Parar no início da célula", + "cmdToggleBold": "alternar negrito", + "cmdToggleCode": "alternar código", + "cmdToggleHighlight": "alternar destaque", + "cmdToggleItalic": "alternar itálico", + "cmdToggleStrikethrough": "alternar tachado", + "cmdToggleTodoList": "alternar lista de tarefas", + "cmdToggleUnderline": "alternar sublinhado", + "cmdUndo": "desfazer", "colAddAfter": "Inserir à direita", "colAddBefore": "Inserir à esquerda", "colClear": "Limpar coluna", @@ -79,7 +131,6 @@ "linkText": "Texto", "linkTextHint": "Insira o rótulo", "listItemPlaceholder": "Item de lista", - "toDoPlaceholder": "Tarefa a fazer", "loading": "Carregando", "ltr": "Esquerda para Direita", "mobileHeading1": "Cabeçalho 1", @@ -122,6 +173,7 @@ "tint7": "Matiz 7", "tint8": "Matiz 8", "tint9": "Matiz 9", + "toDoPlaceholder": "Tarefa a fazer", "underline": "Sublinhar", "upload": "Enviar", "uploadImage": "Enviar", diff --git a/lib/src/editor/block_component/base_component/convert_to_paragraph_command.dart b/lib/src/editor/block_component/base_component/convert_to_paragraph_command.dart index ef03c983..f558e126 100644 --- a/lib/src/editor/block_component/base_component/convert_to_paragraph_command.dart +++ b/lib/src/editor/block_component/base_component/convert_to_paragraph_command.dart @@ -19,6 +19,7 @@ final convertibleBlockTypes = [ /// convert the current block to paragraph. final CommandShortcutEvent convertToParagraphCommand = CommandShortcutEvent( key: 'convert to paragraph', + getDescription: () => AppFlowyEditorL10n.current.cmdConvertToParagraph, command: 'backspace', handler: _convertToParagraphCommandHandler, ); diff --git a/lib/src/editor/block_component/base_component/indent_command.dart b/lib/src/editor/block_component/base_component/indent_command.dart index 04ea2e65..41201c4c 100644 --- a/lib/src/editor/block_component/base_component/indent_command.dart +++ b/lib/src/editor/block_component/base_component/indent_command.dart @@ -16,6 +16,7 @@ final indentableBlockTypes = { /// final CommandShortcutEvent indentCommand = CommandShortcutEvent( key: 'indent', + getDescription: () => AppFlowyEditorL10n.current.cmdIndent, command: 'tab', handler: _indentCommandHandler, ); diff --git a/lib/src/editor/block_component/base_component/outdent_command.dart b/lib/src/editor/block_component/base_component/outdent_command.dart index 69ac21ba..09c667ba 100644 --- a/lib/src/editor/block_component/base_component/outdent_command.dart +++ b/lib/src/editor/block_component/base_component/outdent_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent outdentCommand = CommandShortcutEvent( key: 'outdent', + getDescription: () => AppFlowyEditorL10n.current.cmdOutdent, command: 'shift+tab', handler: _outdentCommandHandler, ); diff --git a/lib/src/editor/block_component/table_block_component/table_commands.dart b/lib/src/editor/block_component/table_block_component/table_commands.dart index d9bcea73..0f8ca7c0 100644 --- a/lib/src/editor/block_component/table_block_component/table_commands.dart +++ b/lib/src/editor/block_component/table_block_component/table_commands.dart @@ -15,30 +15,31 @@ final List tableCommands = [ final CommandShortcutEvent _enterInTableCell = CommandShortcutEvent( key: 'Don\'t add new line in table cell', - getDescription: () => AppFlowyEditorL10n.current.cmdDontAddNewLineInTableCell, + getDescription: () => AppFlowyEditorL10n.current.cmdTableLineBreak, command: 'enter', handler: _enterInTableCellHandler, ); final CommandShortcutEvent _leftInTableCell = CommandShortcutEvent( key: 'Move to left cell if its at start of current cell', - getDescription: () => - AppFlowyEditorL10n.current.cmdMoveToLeftCellIfItsAtStartOfCurrentCell, + getDescription: () => AppFlowyEditorL10n + .current.cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell, command: 'arrow left', handler: _leftInTableCellHandler, ); final CommandShortcutEvent _rightInTableCell = CommandShortcutEvent( key: 'Move to right cell if its at the end of current cell', - getDescription: () => - AppFlowyEditorL10n.current.cmdMoveToRightCellIfItsAtTheEndOfCurrentCell, + getDescription: () => AppFlowyEditorL10n + .current.cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell, command: 'arrow right', handler: _rightInTableCellHandler, ); final CommandShortcutEvent _upInTableCell = CommandShortcutEvent( key: 'Move to up cell at same offset', - getDescription: () => AppFlowyEditorL10n.current.cmdMoveToUpCellAtSameOffset, + getDescription: () => + AppFlowyEditorL10n.current.cmdTableMoveToUpCellAtSameOffset, command: 'arrow up', handler: _upInTableCellHandler, ); @@ -46,23 +47,21 @@ final CommandShortcutEvent _upInTableCell = CommandShortcutEvent( final CommandShortcutEvent _downInTableCell = CommandShortcutEvent( key: 'Move to down cell at same offset', getDescription: () => - AppFlowyEditorL10n.current.cmdMoveToDownCellAtSameOffset, + AppFlowyEditorL10n.current.cmdTableMoveToDownCellAtSameOffset, command: 'arrow down', handler: _downInTableCellHandler, ); final CommandShortcutEvent _tabInTableCell = CommandShortcutEvent( key: 'Navigate around the cells at same offset', - getDescription: () => - AppFlowyEditorL10n.current.cmdNavigateAroundTheCellsAtSameOffset, + getDescription: () => AppFlowyEditorL10n.current.cmdTableNavigateCells, command: 'tab', handler: _tabInTableCellHandler, ); final CommandShortcutEvent _shiftTabInTableCell = CommandShortcutEvent( key: 'Navigate around the cells at same offset in reverse', - getDescription: () => - AppFlowyEditorL10n.current.cmdNavigateAroundTheCellsAtSameOffsetInReverse, + getDescription: () => AppFlowyEditorL10n.current.cmdTableNavigateCellsReverse, command: 'shift+tab', handler: _shiftTabInTableCellHandler, ); @@ -70,7 +69,7 @@ final CommandShortcutEvent _shiftTabInTableCell = CommandShortcutEvent( final CommandShortcutEvent _backSpaceInTableCell = CommandShortcutEvent( key: 'Stop at the beginning of the cell', getDescription: () => - AppFlowyEditorL10n.current.cmdStopAtTheBeginningOfTheCell, + AppFlowyEditorL10n.current.cmdTableStopAtTheBeginningOfTheCell, command: 'backspace', handler: _backspaceInTableCellHandler, ); diff --git a/lib/src/editor/block_component/todo_list_block_component/todo_list_command_shortcut.dart b/lib/src/editor/block_component/todo_list_block_component/todo_list_command_shortcut.dart index 234e7e3d..e0c3c50b 100644 --- a/lib/src/editor/block_component/todo_list_block_component/todo_list_command_shortcut.dart +++ b/lib/src/editor/block_component/todo_list_block_component/todo_list_command_shortcut.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; // toggle the todo list final CommandShortcutEvent toggleTodoListCommand = CommandShortcutEvent( key: 'toggle the todo list', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleTodoList, command: 'ctrl+enter', macOSCommand: 'cmd+enter', handler: _toggleTodoListCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/arrow_down_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/arrow_down_command.dart index acf3ebe0..7bcad389 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/arrow_down_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/arrow_down_command.dart @@ -19,6 +19,7 @@ final List arrowDownKeys = [ // move the cursor downward vertically final CommandShortcutEvent moveCursorDownCommand = CommandShortcutEvent( key: 'move the cursor downward', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorDown, command: 'arrow down', handler: _moveCursorDownCommandHandler, ); @@ -42,6 +43,7 @@ CommandShortcutEventHandler _moveCursorDownCommandHandler = (editorState) { /// move the cursor to the bottommost position of the document and select everything in between CommandShortcutEvent moveCursorBottomSelectCommand = CommandShortcutEvent( key: 'move cursor to end of file and select all', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorBottomSelect, command: 'ctrl+shift+arrow down', macOSCommand: 'cmd+shift+arrow down', handler: _moveCursorBottomSelectCommandHandler, @@ -73,6 +75,7 @@ CommandShortcutEventHandler _moveCursorBottomSelectCommandHandler = /// move the cursor to the bottommost position of the document CommandShortcutEvent moveCursorBottomCommand = CommandShortcutEvent( key: 'move cursor to end of file', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorBottom, command: 'ctrl+arrow down', macOSCommand: 'cmd+arrow down', handler: _moveCursorBottomCommandHandler, @@ -103,6 +106,7 @@ CommandShortcutEventHandler _moveCursorBottomCommandHandler = (editorState) { /// moves vertically down one line and selects everything between CommandShortcutEvent moveCursorDownSelectCommand = CommandShortcutEvent( key: 'move cursor down and select one line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorDownSelect, command: 'shift+arrow down', macOSCommand: 'shift+arrow down', handler: _moveCursorDownSelectCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/arrow_left_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/arrow_left_command.dart index 5abcf21b..be67f541 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/arrow_left_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/arrow_left_command.dart @@ -20,7 +20,8 @@ final List arrowLeftKeys = [ // arrow left key // move the cursor forward one character final CommandShortcutEvent moveCursorLeftCommand = CommandShortcutEvent( - key: 'move the cursor forward one character', + key: 'move the cursor backward one character', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLeft, command: 'arrow left', handler: _arrowLeftCommandHandler, ); @@ -42,6 +43,7 @@ CommandShortcutEventHandler _arrowLeftCommandHandler = (editorState) { // move the cursor to the beginning of the block final CommandShortcutEvent moveCursorToBeginCommand = CommandShortcutEvent( key: 'move the cursor at the start of line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineStart, command: 'home', macOSCommand: 'cmd+arrow left', handler: _moveCursorToBeginCommandHandler, @@ -64,6 +66,7 @@ CommandShortcutEventHandler _moveCursorToBeginCommandHandler = (editorState) { // move the cursor to the left word final CommandShortcutEvent moveCursorToLeftWordCommand = CommandShortcutEvent( key: 'move the cursor to the left word', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordLeft, command: 'ctrl+arrow left', macOSCommand: 'alt+arrow left', handler: _moveCursorToLeftWordCommandHandler, @@ -123,6 +126,7 @@ CommandShortcutEventHandler _moveCursorToLeftWordCommandHandler = final CommandShortcutEvent moveCursorLeftWordSelectCommand = CommandShortcutEvent( key: 'move the cursor to select the left word', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordLeftSelect, command: 'ctrl+shift+arrow left', macOSCommand: 'alt+shift+arrow left', handler: _moveCursorLeftWordSelectCommandHandler, @@ -157,6 +161,7 @@ CommandShortcutEventHandler _moveCursorLeftWordSelectCommandHandler = // selects only one character final CommandShortcutEvent moveCursorLeftSelectCommand = CommandShortcutEvent( key: 'move the cursor left select', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLeftSelect, command: 'shift+arrow left', handler: _moveCursorLeftSelectCommandHandler, ); @@ -185,6 +190,7 @@ CommandShortcutEventHandler _moveCursorLeftSelectCommandHandler = // final CommandShortcutEvent moveCursorBeginSelectCommand = CommandShortcutEvent( key: 'move cursor to select till start of line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineStartSelect, command: 'shift+home', macOSCommand: 'cmd+shift+arrow left', handler: _moveCursorBeginSelectCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/arrow_right_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/arrow_right_command.dart index 5e24e524..3d66ea3f 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/arrow_right_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/arrow_right_command.dart @@ -20,7 +20,8 @@ final List arrowRightKeys = [ // arrow right key // move the cursor backward one character final CommandShortcutEvent moveCursorRightCommand = CommandShortcutEvent( - key: 'move the cursor backward one character', + key: 'move the cursor forward one character', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorRight, command: 'arrow right', handler: _arrowRightCommandHandler, ); @@ -42,6 +43,7 @@ CommandShortcutEventHandler _arrowRightCommandHandler = (editorState) { // move the cursor to the end of the block final CommandShortcutEvent moveCursorToEndCommand = CommandShortcutEvent( key: 'move the cursor to the end of line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineEnd, command: 'end', macOSCommand: 'cmd+arrow right', handler: _moveCursorToEndCommandHandler, @@ -64,6 +66,7 @@ CommandShortcutEventHandler _moveCursorToEndCommandHandler = (editorState) { // move the cursor to the right word final CommandShortcutEvent moveCursorToRightWordCommand = CommandShortcutEvent( key: 'move the cursor to the right word', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordRight, command: 'ctrl+arrow right', macOSCommand: 'alt+arrow right', handler: _moveCursorToRightWordCommandHandler, @@ -127,6 +130,7 @@ CommandShortcutEventHandler _moveCursorToRightWordCommandHandler = final CommandShortcutEvent moveCursorRightWordSelectCommand = CommandShortcutEvent( key: 'move the cursor to select the right word', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorWordRightSelect, command: 'ctrl+shift+arrow right', macOSCommand: 'alt+shift+arrow right', handler: _moveCursorRightWordSelectCommandHandler, @@ -161,6 +165,7 @@ CommandShortcutEventHandler _moveCursorRightWordSelectCommandHandler = // selects only one character final CommandShortcutEvent moveCursorRightSelectCommand = CommandShortcutEvent( key: 'move the cursor right select', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorRightSelect, command: 'shift+arrow right', handler: _moveCursorRightSelectCommandHandler, ); @@ -189,6 +194,7 @@ CommandShortcutEventHandler _moveCursorRightSelectCommandHandler = // arrow right key + shift + ctrl or cmd final CommandShortcutEvent moveCursorEndSelectCommand = CommandShortcutEvent( key: 'move cursor to select till end of line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorLineEndSelect, command: 'shift+end', macOSCommand: 'cmd+shift+arrow right', handler: _moveCursorEndSelectCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/arrow_up_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/arrow_up_command.dart index 6035e39a..21d1eb06 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/arrow_up_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/arrow_up_command.dart @@ -19,6 +19,7 @@ final List arrowUpKeys = [ // move the cursor upward vertically final CommandShortcutEvent moveCursorUpCommand = CommandShortcutEvent( key: 'move the cursor upward', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorUp, command: 'arrow up', handler: _moveCursorUpCommandHandler, ); @@ -42,6 +43,7 @@ CommandShortcutEventHandler _moveCursorUpCommandHandler = (editorState) { /// move the cursor to the topmost position of the document and select everything in between final CommandShortcutEvent moveCursorTopSelectCommand = CommandShortcutEvent( key: 'move cursor to start of file and select all', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorTopSelect, command: 'ctrl+shift+arrow up', macOSCommand: 'cmd+shift+arrow up', handler: _moveCursorTopSelectCommandHandler, @@ -70,6 +72,7 @@ CommandShortcutEventHandler _moveCursorTopSelectCommandHandler = (editorState) { /// move the cursor to the topmost position of the document final CommandShortcutEvent moveCursorTopCommand = CommandShortcutEvent( key: 'move cursor to start of file', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorTop, command: 'ctrl+arrow up', macOSCommand: 'cmd+arrow up', handler: _moveCursorTopCommandHandler, @@ -100,6 +103,7 @@ CommandShortcutEventHandler _moveCursorTopCommandHandler = (editorState) { /// moves vertically down one line and selects everything between final CommandShortcutEvent moveCursorUpSelectCommand = CommandShortcutEvent( key: 'move cursor up and select one line', + getDescription: () => AppFlowyEditorL10n.current.cmdMoveCursorUpSelect, command: 'shift+arrow up', macOSCommand: 'shift+arrow up', handler: _moveCursorUpSelectCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/backspace_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/backspace_command.dart index 24001620..79464dc6 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/backspace_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/backspace_command.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent backspaceCommand = CommandShortcutEvent( key: 'backspace', + getDescription: () => AppFlowyEditorL10n.current.cmdDeleteLeft, command: 'backspace, shift+backspace', handler: _backspaceCommandHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/copy_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/copy_command.dart index c89ff028..c7251b27 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/copy_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/copy_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent copyCommand = CommandShortcutEvent( key: 'copy the selected content', + getDescription: () => AppFlowyEditorL10n.current.cmdCopySelection, command: 'ctrl+c', macOSCommand: 'cmd+c', handler: _copyCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/cut_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/cut_command.dart index 62182ccb..0296ac68 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/cut_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/cut_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent cutCommand = CommandShortcutEvent( key: 'cut the selected content', + getDescription: () => AppFlowyEditorL10n.current.cmdCutSelection, command: 'ctrl+x', macOSCommand: 'cmd+x', handler: _cutCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/delete_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/delete_command.dart index 6a121a7e..c43339c2 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/delete_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/delete_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent deleteCommand = CommandShortcutEvent( key: 'Delete Key', + getDescription: () => AppFlowyEditorL10n.current.cmdDeleteRight, command: 'delete', handler: _deleteCommandHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/end_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/end_command.dart index 4e174369..f959753a 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/end_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/end_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent endCommand = CommandShortcutEvent( key: 'scroll to the bottom of the document', + getDescription: () => AppFlowyEditorL10n.current.cmdScrollToBottom, command: 'ctrl+end', macOSCommand: 'end', handler: _endCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/escape_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/escape_command.dart index 0c95486c..73a5bd80 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/escape_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/escape_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent exitEditingCommand = CommandShortcutEvent( key: 'exit the editing mode', + getDescription: () => AppFlowyEditorL10n.current.cmdExitEditing, command: 'escape', handler: _exitEditingCommandHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/find_replace_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/find_replace_command.dart index b15e85f0..141e9170 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/find_replace_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/find_replace_command.dart @@ -76,6 +76,7 @@ CommandShortcutEvent openFindDialog({ }) => CommandShortcutEvent( key: 'show the find dialog', + getDescription: () => AppFlowyEditorL10n.current.cmdOpenFind, command: 'ctrl+f', macOSCommand: 'cmd+f', handler: (editorState) => _showFindAndReplaceDialog( @@ -93,6 +94,7 @@ CommandShortcutEvent openReplaceDialog({ }) => CommandShortcutEvent( key: 'show the find and replace dialog', + getDescription: () => AppFlowyEditorL10n.current.cmdOpenFindAndReplace, command: 'ctrl+h', macOSCommand: 'cmd+h', handler: (editorState) => _showFindAndReplaceDialog( diff --git a/lib/src/editor/editor_component/service/shortcuts/command/home_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/home_command.dart index d40ccaf0..1822de2d 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/home_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/home_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent homeCommand = CommandShortcutEvent( key: 'scroll to the top of the document', + getDescription: () => AppFlowyEditorL10n.current.cmdScrollToTop, command: 'ctrl+home', macOSCommand: 'home', handler: _homeCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/markdown_commands.dart b/lib/src/editor/editor_component/service/shortcuts/command/markdown_commands.dart index 336a023a..53f7cd8f 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/markdown_commands.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/markdown_commands.dart @@ -22,6 +22,7 @@ final List toggleMarkdownCommands = [ /// final CommandShortcutEvent toggleBoldCommand = CommandShortcutEvent( key: 'toggle bold', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleBold, command: 'ctrl+b', macOSCommand: 'cmd+b', handler: (editorState) => _toggleAttribute( @@ -32,6 +33,7 @@ final CommandShortcutEvent toggleBoldCommand = CommandShortcutEvent( final CommandShortcutEvent toggleItalicCommand = CommandShortcutEvent( key: 'toggle italic', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleItalic, command: 'ctrl+i', macOSCommand: 'cmd+i', handler: (editorState) => _toggleAttribute( @@ -42,6 +44,7 @@ final CommandShortcutEvent toggleItalicCommand = CommandShortcutEvent( final CommandShortcutEvent toggleUnderlineCommand = CommandShortcutEvent( key: 'toggle underline', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleUnderline, command: 'ctrl+u', macOSCommand: 'cmd+u', handler: (editorState) => _toggleAttribute( @@ -52,6 +55,7 @@ final CommandShortcutEvent toggleUnderlineCommand = CommandShortcutEvent( final CommandShortcutEvent toggleStrikethroughCommand = CommandShortcutEvent( key: 'toggle strikethrough', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleStrikethrough, command: 'ctrl+shift+s', macOSCommand: 'cmd+shift+s', handler: (editorState) => _toggleAttribute( @@ -62,6 +66,7 @@ final CommandShortcutEvent toggleStrikethroughCommand = CommandShortcutEvent( final CommandShortcutEvent toggleCodeCommand = CommandShortcutEvent( key: 'toggle code', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleCode, command: 'ctrl+e', macOSCommand: 'cmd+e', handler: (editorState) => _toggleAttribute( diff --git a/lib/src/editor/editor_component/service/shortcuts/command/open_link_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/open_link_command.dart index dd72aa29..b92545f5 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/open_link_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/open_link_command.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent openInlineLinkCommand = CommandShortcutEvent( key: 'open inline link', + getDescription: () => AppFlowyEditorL10n.current.cmdOpenLink, command: 'alt+enter', handler: _openInlineLink, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/open_links_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/open_links_command.dart index d5ef4bd2..d032a550 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/open_links_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/open_links_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent openLinksCommand = CommandShortcutEvent( key: 'open links', + getDescription: () => AppFlowyEditorL10n.current.cmdOpenLinks, command: 'alt+shift+enter', handler: _openLinksHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/page_down_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/page_down_command.dart index 9dd09e1b..644334ea 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/page_down_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/page_down_command.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent pageDownCommand = CommandShortcutEvent( key: 'scroll one page down', + getDescription: () => AppFlowyEditorL10n.current.cmdScrollPageDown, command: 'page down', handler: _pageUpCommandHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/page_up_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/page_up_command.dart index 04ac7eca..8d39ff9c 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/page_up_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/page_up_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent pageUpCommand = CommandShortcutEvent( key: 'scroll one page up', + getDescription: () => AppFlowyEditorL10n.current.cmdScrollPageUp, command: 'page up', handler: _pageUpCommandHandler, ); diff --git a/lib/src/editor/editor_component/service/shortcuts/command/paste_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/paste_command.dart index e474a39c..61335fd4 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/paste_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/paste_command.dart @@ -15,6 +15,7 @@ final List pasteCommands = [ /// final CommandShortcutEvent pasteCommand = CommandShortcutEvent( key: 'paste the content', + getDescription: () => AppFlowyEditorL10n.current.cmdPasteContent, command: 'ctrl+v', macOSCommand: 'cmd+v', handler: _pasteCommandHandler, @@ -23,6 +24,7 @@ final CommandShortcutEvent pasteCommand = CommandShortcutEvent( final CommandShortcutEvent pasteTextWithoutFormattingCommand = CommandShortcutEvent( key: 'paste the content as plain text', + getDescription: () => AppFlowyEditorL10n.current.cmdPasteContentAsPlainText, command: 'ctrl+shift+v', macOSCommand: 'cmd+shift+v', handler: _pasteTextWithoutFormattingCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/remove_line_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/remove_line_command.dart index 25eb2e7f..0c296040 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/remove_line_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/remove_line_command.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; final CommandShortcutEvent deleteLeftSentenceCommand = CommandShortcutEvent( key: 'delete the left line', + getDescription: () => AppFlowyEditorL10n.current.cmdDeleteLineLeft, command: 'ctrl+alt+backspace', macOSCommand: 'cmd+backspace', handler: _deleteLeftSentenceCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/remove_word_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/remove_word_command.dart index 58935855..79198290 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/remove_word_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/remove_word_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; final CommandShortcutEvent deleteLeftWordCommand = CommandShortcutEvent( key: 'delete the left word', + getDescription: () => AppFlowyEditorL10n.current.cmdDeleteWordLeft, command: 'ctrl+backspace', macOSCommand: 'alt+backspace', handler: _deleteLeftWordCommandHandler, @@ -16,6 +17,7 @@ final CommandShortcutEvent deleteLeftWordCommand = CommandShortcutEvent( final CommandShortcutEvent deleteRightWordCommand = CommandShortcutEvent( key: 'delete the right word', + getDescription: () => AppFlowyEditorL10n.current.cmdDeleteWordRight, command: 'ctrl+delete', macOSCommand: 'alt+delete', handler: _deleteRightWordCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/select_all_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/select_all_command.dart index b9b1f038..fb0eadaa 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/select_all_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/select_all_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent selectAllCommand = CommandShortcutEvent( key: 'select all the selectable content', + getDescription: () => AppFlowyEditorL10n.current.cmdSelectAll, command: 'ctrl+a', macOSCommand: 'cmd+a', handler: _selectAllCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/show_link_menu_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/show_link_menu_command.dart index 2a39667b..97174de9 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/show_link_menu_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/show_link_menu_command.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; /// - web final CommandShortcutEvent showLinkMenuCommand = CommandShortcutEvent( key: 'link menu', + getDescription: () => AppFlowyEditorL10n.current.cmdConvertToLink, command: 'ctrl+k', macOSCommand: 'cmd+k', handler: _showLinkMenu, diff --git a/lib/src/editor/editor_component/service/shortcuts/command/toggle_colors_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/toggle_colors_command.dart index 1e14836b..f1d92c77 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/toggle_colors_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/toggle_colors_command.dart @@ -28,6 +28,7 @@ class ToggleColorsStyle { final CommandShortcutEvent toggleHighlightCommand = CommandShortcutEvent( key: 'toggle highlight', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleHighlight, command: 'ctrl+shift+h', macOSCommand: 'cmd+shift+h', handler: (editorState) => _toggleHighlight( @@ -41,6 +42,7 @@ CommandShortcutEvent customToggleHighlightCommand({ }) => CommandShortcutEvent( key: 'toggle highlight', + getDescription: () => AppFlowyEditorL10n.current.cmdToggleHighlight, command: 'ctrl+shift+h', macOSCommand: 'cmd+shift+h', handler: (editorState) => _toggleHighlight(editorState, style: style), diff --git a/lib/src/editor/editor_component/service/shortcuts/command/undo_redo_command.dart b/lib/src/editor/editor_component/service/shortcuts/command/undo_redo_command.dart index 558ca92e..47d8f010 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command/undo_redo_command.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command/undo_redo_command.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; /// final CommandShortcutEvent undoCommand = CommandShortcutEvent( key: 'undo', + getDescription: () => AppFlowyEditorL10n.current.cmdUndo, command: 'ctrl+z', macOSCommand: 'cmd+z', handler: _undoCommandHandler, @@ -30,6 +31,7 @@ CommandShortcutEventHandler _undoCommandHandler = (editorState) { /// final CommandShortcutEvent redoCommand = CommandShortcutEvent( key: 'redo', + getDescription: () => AppFlowyEditorL10n.current.cmdRedo, command: 'ctrl+y,ctrl+shift+z', macOSCommand: 'cmd+shift+z', handler: _redoCommandHandler, diff --git a/lib/src/editor/editor_component/service/shortcuts/command_shortcut_event.dart b/lib/src/editor/editor_component/service/shortcuts/command_shortcut_event.dart index c13d7549..11b84a2d 100644 --- a/lib/src/editor/editor_component/service/shortcuts/command_shortcut_event.dart +++ b/lib/src/editor/editor_component/service/shortcuts/command_shortcut_event.dart @@ -11,7 +11,7 @@ class CommandShortcutEvent { required this.key, required this.command, required this.handler, - getDescription, + required String Function()? getDescription, String? windowsCommand, String? macOSCommand, String? linuxCommand, @@ -55,7 +55,8 @@ class CommandShortcutEvent { List get keybindings => _keybindings; List _keybindings = []; - String get description => _getDescription != null ? _getDescription!() : key; + String? get description => + _getDescription != null ? _getDescription!() : null; void updateCommand({ String? command, @@ -109,11 +110,13 @@ class CommandShortcutEvent { CommandShortcutEvent copyWith({ String? key, + String Function()? getDescription, String? command, CommandShortcutEventHandler? handler, }) { return CommandShortcutEvent( key: key ?? this.key, + getDescription: getDescription ?? _getDescription, command: command ?? this.command, handler: handler ?? this.handler, ); diff --git a/lib/src/editor/selection_menu/selection_menu_widget.dart b/lib/src/editor/selection_menu/selection_menu_widget.dart index e0a7476d..96ce418c 100644 --- a/lib/src/editor/selection_menu/selection_menu_widget.dart +++ b/lib/src/editor/selection_menu/selection_menu_widget.dart @@ -73,7 +73,7 @@ class SelectionMenuItem { } /// Creates a selection menu entry for inserting a [Node]. - /// [name] and [iconData] define the appearance within the selection menu. + /// [getName] and [iconData] define the appearance within the selection menu. /// /// The insert position is determined by the result of [replace] and /// [insertBefore] @@ -84,7 +84,7 @@ class SelectionMenuItem { /// [updateSelection] can be used to update the selection after the node /// has been inserted. factory SelectionMenuItem.node({ - required String name, + required String Function() getName, required IconData iconData, required List keywords, required Node Function(EditorState editorState, BuildContext context) @@ -99,7 +99,7 @@ class SelectionMenuItem { )? updateSelection, }) { return SelectionMenuItem( - getName: () => name, + getName: getName, icon: (editorState, onSelected, style) => Icon( iconData, color: onSelected diff --git a/lib/src/l10n/intl/messages_en.dart b/lib/src/l10n/intl/messages_en.dart index 043dda19..b9ddb025 100644 --- a/lib/src/l10n/intl/messages_en.dart +++ b/lib/src/l10n/intl/messages_en.dart @@ -55,26 +55,120 @@ class MessageLookup extends MessageLookupByLibrary { "clearHighlightColor": MessageLookupByLibrary.simpleMessage("Clear highlight color"), "closeFind": MessageLookupByLibrary.simpleMessage("Close"), - "cmdDontAddNewLineInTableCell": MessageLookupByLibrary.simpleMessage( - "Don\'t add new line in table cell"), - "cmdMoveToDownCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Move to down cell at same offset"), - "cmdMoveToLeftCellIfItsAtStartOfCurrentCell": + "cmdConvertToLink": + MessageLookupByLibrary.simpleMessage("Convert to link"), + "cmdConvertToParagraph": + MessageLookupByLibrary.simpleMessage("convert to paragraph"), + "cmdCopySelection": + MessageLookupByLibrary.simpleMessage("Copy selection"), + "cmdCutSelection": + MessageLookupByLibrary.simpleMessage("Cut selection"), + "cmdDeleteLeft": MessageLookupByLibrary.simpleMessage( + "Delete character to the left"), + "cmdDeleteLineLeft": + MessageLookupByLibrary.simpleMessage("Delete to beginning of line"), + "cmdDeleteRight": MessageLookupByLibrary.simpleMessage( + "Delete character to the right"), + "cmdDeleteWordLeft": + MessageLookupByLibrary.simpleMessage("delete word at left"), + "cmdDeleteWordRight": + MessageLookupByLibrary.simpleMessage("delete word at right"), + "cmdExitEditing": + MessageLookupByLibrary.simpleMessage("exit editing mode"), + "cmdIndent": MessageLookupByLibrary.simpleMessage("indent"), + "cmdMoveCursorBottom": + MessageLookupByLibrary.simpleMessage("move cursor to the bottom"), + "cmdMoveCursorBottomSelect": MessageLookupByLibrary.simpleMessage( + "Select all until end of file"), + "cmdMoveCursorDown": + MessageLookupByLibrary.simpleMessage("move cursor down"), + "cmdMoveCursorDownSelect": + MessageLookupByLibrary.simpleMessage("Select downward"), + "cmdMoveCursorLeft": + MessageLookupByLibrary.simpleMessage("move cursor left"), + "cmdMoveCursorLeftSelect": + MessageLookupByLibrary.simpleMessage("Select left"), + "cmdMoveCursorLineEnd": MessageLookupByLibrary.simpleMessage( + "move cursor to the end of line"), + "cmdMoveCursorLineEndSelect": + MessageLookupByLibrary.simpleMessage("Select to end of line"), + "cmdMoveCursorLineStart": MessageLookupByLibrary.simpleMessage( + "move cursor to start of line"), + "cmdMoveCursorLineStartSelect": + MessageLookupByLibrary.simpleMessage("Select to start of line"), + "cmdMoveCursorRight": + MessageLookupByLibrary.simpleMessage("move cursor right"), + "cmdMoveCursorRightSelect": + MessageLookupByLibrary.simpleMessage("Select right"), + "cmdMoveCursorTop": + MessageLookupByLibrary.simpleMessage("move cursor to the top"), + "cmdMoveCursorTopSelect": MessageLookupByLibrary.simpleMessage( + "Select all until start of file"), + "cmdMoveCursorUp": + MessageLookupByLibrary.simpleMessage("move cursor up"), + "cmdMoveCursorUpSelect": + MessageLookupByLibrary.simpleMessage("Select upward"), + "cmdMoveCursorWordLeft": MessageLookupByLibrary.simpleMessage( + "move cursor to word on the left"), + "cmdMoveCursorWordLeftSelect": + MessageLookupByLibrary.simpleMessage("Select word to the left"), + "cmdMoveCursorWordRight": MessageLookupByLibrary.simpleMessage( + "move cursor to word on the right"), + "cmdMoveCursorWordRightSelect": + MessageLookupByLibrary.simpleMessage("Select word to the right"), + "cmdOpenFind": MessageLookupByLibrary.simpleMessage("Open Find"), + "cmdOpenFindAndReplace": + MessageLookupByLibrary.simpleMessage("Open Find and Replace"), + "cmdOpenLink": MessageLookupByLibrary.simpleMessage("open link"), + "cmdOpenLinks": MessageLookupByLibrary.simpleMessage("open links"), + "cmdOutdent": MessageLookupByLibrary.simpleMessage("outdent"), + "cmdPasteContent": + MessageLookupByLibrary.simpleMessage("paste content"), + "cmdPasteContentAsPlainText": + MessageLookupByLibrary.simpleMessage("paste content as plain text"), + "cmdRedo": MessageLookupByLibrary.simpleMessage("redo"), + "cmdScrollPageDown": + MessageLookupByLibrary.simpleMessage("scroll page down"), + "cmdScrollPageUp": + MessageLookupByLibrary.simpleMessage("scroll page up"), + "cmdScrollToBottom": + MessageLookupByLibrary.simpleMessage("scroll to bottom"), + "cmdScrollToTop": MessageLookupByLibrary.simpleMessage("scroll to top"), + "cmdSelectAll": MessageLookupByLibrary.simpleMessage("select all"), + "cmdTableLineBreak": + MessageLookupByLibrary.simpleMessage("Table: add line break"), + "cmdTableMoveToDownCellAtSameOffset": + MessageLookupByLibrary.simpleMessage( + "Move to down cell at same offset"), + "cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": MessageLookupByLibrary.simpleMessage( "Move to left cell if its at start of current cell"), - "cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": + "cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": MessageLookupByLibrary.simpleMessage( "Move to right cell if its at the end of current cell"), - "cmdMoveToUpCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Move to up cell at same offset"), - "cmdNavigateAroundTheCellsAtSameOffset": + "cmdTableMoveToUpCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Navigate around the cells at same offset"), - "cmdNavigateAroundTheCellsAtSameOffsetInReverse": + "Move to up cell at same offset"), + "cmdTableNavigateCells": MessageLookupByLibrary.simpleMessage( + "Navigate around the cells at same offset"), + "cmdTableNavigateCellsReverse": MessageLookupByLibrary.simpleMessage( + "Navigate around the cells at same offset in reverse"), + "cmdTableStopAtTheBeginningOfTheCell": MessageLookupByLibrary.simpleMessage( - "Navigate around the cells at same offset in reverse"), - "cmdStopAtTheBeginningOfTheCell": MessageLookupByLibrary.simpleMessage( - "Stop at the beginning of the cell"), + "Stop at the beginning of the cell"), + "cmdToggleBold": MessageLookupByLibrary.simpleMessage("toggle bold"), + "cmdToggleCode": MessageLookupByLibrary.simpleMessage("toggle code"), + "cmdToggleHighlight": + MessageLookupByLibrary.simpleMessage("toggle highlight"), + "cmdToggleItalic": + MessageLookupByLibrary.simpleMessage("toggle italic"), + "cmdToggleStrikethrough": + MessageLookupByLibrary.simpleMessage("toggle strikethrough"), + "cmdToggleTodoList": + MessageLookupByLibrary.simpleMessage("toggle the todo list"), + "cmdToggleUnderline": + MessageLookupByLibrary.simpleMessage("toggle underline"), + "cmdUndo": MessageLookupByLibrary.simpleMessage("undo"), "colAddAfter": MessageLookupByLibrary.simpleMessage("Add after"), "colAddBefore": MessageLookupByLibrary.simpleMessage("Add before"), "colClear": MessageLookupByLibrary.simpleMessage("Clear Content"), diff --git a/lib/src/l10n/intl/messages_pt-BR.dart b/lib/src/l10n/intl/messages_pt-BR.dart index 66dd6e84..be9f8650 100644 --- a/lib/src/l10n/intl/messages_pt-BR.dart +++ b/lib/src/l10n/intl/messages_pt-BR.dart @@ -58,26 +58,122 @@ class MessageLookup extends MessageLookupByLibrary { "clearHighlightColor": MessageLookupByLibrary.simpleMessage("Limpar cor de destaque"), "closeFind": MessageLookupByLibrary.simpleMessage("Fechar"), - "cmdDontAddNewLineInTableCell": MessageLookupByLibrary.simpleMessage( + "cmdConvertToLink": + MessageLookupByLibrary.simpleMessage("Converter para link"), + "cmdConvertToParagraph": + MessageLookupByLibrary.simpleMessage("converter para parágrafo"), + "cmdCopySelection": + MessageLookupByLibrary.simpleMessage("Copiar seleção"), + "cmdCutSelection": + MessageLookupByLibrary.simpleMessage("Cortar seleção"), + "cmdDeleteLeft": MessageLookupByLibrary.simpleMessage( + "Deletar caractere à esquerda"), + "cmdDeleteLineLeft": MessageLookupByLibrary.simpleMessage( + "Deletar até o início da linha"), + "cmdDeleteRight": + MessageLookupByLibrary.simpleMessage("Deletar caractere à direita"), + "cmdDeleteWordLeft": + MessageLookupByLibrary.simpleMessage("Deletar palavra à esquerda"), + "cmdDeleteWordRight": + MessageLookupByLibrary.simpleMessage("Deletar palavra à direita"), + "cmdExitEditing": + MessageLookupByLibrary.simpleMessage("sair do modo de edição"), + "cmdIndent": MessageLookupByLibrary.simpleMessage("indentar"), + "cmdMoveCursorBottom": MessageLookupByLibrary.simpleMessage( + "mover cursor para o final do arquivo"), + "cmdMoveCursorBottomSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar tudo até o final do arquivo"), + "cmdMoveCursorDown": + MessageLookupByLibrary.simpleMessage("mover cursor para baixo"), + "cmdMoveCursorDownSelect": + MessageLookupByLibrary.simpleMessage("Selecionar para baixo"), + "cmdMoveCursorLeft": MessageLookupByLibrary.simpleMessage( + "mover cursor para a esquerda"), + "cmdMoveCursorLeftSelect": + MessageLookupByLibrary.simpleMessage("Selecionar à esquerda"), + "cmdMoveCursorLineEnd": MessageLookupByLibrary.simpleMessage( + "mover cursor para o final da linha"), + "cmdMoveCursorLineEndSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar até o final da linha"), + "cmdMoveCursorLineStart": MessageLookupByLibrary.simpleMessage( + "mover cursor para o início da linha"), + "cmdMoveCursorLineStartSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar até o início da linha"), + "cmdMoveCursorRight": + MessageLookupByLibrary.simpleMessage("mover cursor para a direita"), + "cmdMoveCursorRightSelect": + MessageLookupByLibrary.simpleMessage("Selecionar à direita"), + "cmdMoveCursorTop": + MessageLookupByLibrary.simpleMessage("mover cursor para o topo"), + "cmdMoveCursorTopSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar tudo até o início do arquivo"), + "cmdMoveCursorUp": + MessageLookupByLibrary.simpleMessage("mover cursor para cima"), + "cmdMoveCursorUpSelect": + MessageLookupByLibrary.simpleMessage("Selecionar para cima"), + "cmdMoveCursorWordLeft": MessageLookupByLibrary.simpleMessage( + "mover cursor para a palavra à esquerda"), + "cmdMoveCursorWordLeftSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar palavra à esquerda"), + "cmdMoveCursorWordRight": MessageLookupByLibrary.simpleMessage( + "mover cursor para a palavra à direita"), + "cmdMoveCursorWordRightSelect": MessageLookupByLibrary.simpleMessage( + "Selecionar palavra à direita"), + "cmdOpenFind": MessageLookupByLibrary.simpleMessage("Abrir Localizar"), + "cmdOpenFindAndReplace": MessageLookupByLibrary.simpleMessage( + "Abrir Localizar e Substituir"), + "cmdOpenLink": MessageLookupByLibrary.simpleMessage("abrir link"), + "cmdOpenLinks": MessageLookupByLibrary.simpleMessage("abrir links"), + "cmdOutdent": MessageLookupByLibrary.simpleMessage("desindentar"), + "cmdPasteContent": + MessageLookupByLibrary.simpleMessage("colar conteúdo"), + "cmdPasteContentAsPlainText": MessageLookupByLibrary.simpleMessage( + "colar conteúdo como texto simples"), + "cmdRedo": MessageLookupByLibrary.simpleMessage("refazer"), + "cmdScrollPageDown": + MessageLookupByLibrary.simpleMessage("rolar página para baixo"), + "cmdScrollPageUp": + MessageLookupByLibrary.simpleMessage("rolar página para cima"), + "cmdScrollToBottom": + MessageLookupByLibrary.simpleMessage("rolar para o fim"), + "cmdScrollToTop": + MessageLookupByLibrary.simpleMessage("rolar para o topo"), + "cmdSelectAll": MessageLookupByLibrary.simpleMessage("selecionar tudo"), + "cmdTableLineBreak": MessageLookupByLibrary.simpleMessage( "Não adicionar nova linha na célula"), - "cmdMoveToDownCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Mover para a célula abaixo na mesma posição"), - "cmdMoveToLeftCellIfItsAtStartOfCurrentCell": + "cmdTableMoveToDownCellAtSameOffset": + MessageLookupByLibrary.simpleMessage( + "Mover para a célula abaixo na mesma posição"), + "cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell": MessageLookupByLibrary.simpleMessage( "Mover para a célula à esquerda se estiver no início da célula atual"), - "cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": + "cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell": MessageLookupByLibrary.simpleMessage( "Mover para a célula à direita se estiver no final da célula atual"), - "cmdMoveToUpCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Mover para a célula acima na mesma posição"), - "cmdNavigateAroundTheCellsAtSameOffset": + "cmdTableMoveToUpCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Navegar pelas células na mesma posição"), - "cmdNavigateAroundTheCellsAtSameOffsetInReverse": - MessageLookupByLibrary.simpleMessage( - "Navegar pelas células na mesma posição (reverso)"), - "cmdStopAtTheBeginningOfTheCell": + "Mover para a célula acima na mesma posição"), + "cmdTableNavigateCells": MessageLookupByLibrary.simpleMessage( + "Navegar pelas células na mesma posição"), + "cmdTableNavigateCellsReverse": MessageLookupByLibrary.simpleMessage( + "Navegar pelas células na mesma posição (reverso)"), + "cmdTableStopAtTheBeginningOfTheCell": MessageLookupByLibrary.simpleMessage("Parar no início da célula"), + "cmdToggleBold": + MessageLookupByLibrary.simpleMessage("alternar negrito"), + "cmdToggleCode": + MessageLookupByLibrary.simpleMessage("alternar código"), + "cmdToggleHighlight": + MessageLookupByLibrary.simpleMessage("alternar destaque"), + "cmdToggleItalic": + MessageLookupByLibrary.simpleMessage("alternar itálico"), + "cmdToggleStrikethrough": + MessageLookupByLibrary.simpleMessage("alternar tachado"), + "cmdToggleTodoList": + MessageLookupByLibrary.simpleMessage("alternar lista de tarefas"), + "cmdToggleUnderline": + MessageLookupByLibrary.simpleMessage("alternar sublinhado"), + "cmdUndo": MessageLookupByLibrary.simpleMessage("desfazer"), "colAddAfter": MessageLookupByLibrary.simpleMessage("Inserir à direita"), "colAddBefore": diff --git a/lib/src/l10n/intl/messages_pt-PT.dart b/lib/src/l10n/intl/messages_pt-PT.dart index 373db006..88ac2dc6 100644 --- a/lib/src/l10n/intl/messages_pt-PT.dart +++ b/lib/src/l10n/intl/messages_pt-PT.dart @@ -27,26 +27,6 @@ class MessageLookup extends MessageLookupByLibrary { "bulletedList": MessageLookupByLibrary.simpleMessage("lista com marcadores"), "checkbox": MessageLookupByLibrary.simpleMessage("caixa de seleção"), - "cmdDontAddNewLineInTableCell": MessageLookupByLibrary.simpleMessage( - "Não adicionar nova linha na célula"), - "cmdMoveToDownCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Mover para a célula abaixo na mesma posição"), - "cmdMoveToLeftCellIfItsAtStartOfCurrentCell": - MessageLookupByLibrary.simpleMessage( - "Mover para a célula à esquerda se estiver no início da célula atual"), - "cmdMoveToRightCellIfItsAtTheEndOfCurrentCell": - MessageLookupByLibrary.simpleMessage( - "Mover para a célula à direita se estiver no final da célula atual"), - "cmdMoveToUpCellAtSameOffset": MessageLookupByLibrary.simpleMessage( - "Mover para a célula acima na mesma posição"), - "cmdNavigateAroundTheCellsAtSameOffset": - MessageLookupByLibrary.simpleMessage( - "Navegar pelas células na mesma posição"), - "cmdNavigateAroundTheCellsAtSameOffsetInReverse": - MessageLookupByLibrary.simpleMessage( - "Navegar pelas células na mesma posição (reverso)"), - "cmdStopAtTheBeginningOfTheCell": - MessageLookupByLibrary.simpleMessage("Parar no início da célula"), "embedCode": MessageLookupByLibrary.simpleMessage("Código embutido"), "heading1": MessageLookupByLibrary.simpleMessage("Cabeçalho 1"), "heading2": MessageLookupByLibrary.simpleMessage("Cabeçalho 2"), diff --git a/lib/src/l10n/l10n.dart b/lib/src/l10n/l10n.dart index d2e85da3..637f957b 100644 --- a/lib/src/l10n/l10n.dart +++ b/lib/src/l10n/l10n.dart @@ -1241,81 +1241,601 @@ class AppFlowyEditorLocalizations { ); } - /// `Don't add new line in table cell` - String get cmdDontAddNewLineInTableCell { + /// `Convert to link` + String get cmdConvertToLink { return Intl.message( - 'Don\'t add new line in table cell', - name: 'cmdDontAddNewLineInTableCell', + 'Convert to link', + name: 'cmdConvertToLink', desc: '', args: [], ); } - /// `Move to left cell if its at start of current cell` - String get cmdMoveToLeftCellIfItsAtStartOfCurrentCell { + /// `convert to paragraph` + String get cmdConvertToParagraph { return Intl.message( - 'Move to left cell if its at start of current cell', - name: 'cmdMoveToLeftCellIfItsAtStartOfCurrentCell', + 'convert to paragraph', + name: 'cmdConvertToParagraph', desc: '', args: [], ); } - /// `Move to right cell if its at the end of current cell` - String get cmdMoveToRightCellIfItsAtTheEndOfCurrentCell { + /// `Copy selection` + String get cmdCopySelection { return Intl.message( - 'Move to right cell if its at the end of current cell', - name: 'cmdMoveToRightCellIfItsAtTheEndOfCurrentCell', + 'Copy selection', + name: 'cmdCopySelection', desc: '', args: [], ); } - /// `Move to up cell at same offset` - String get cmdMoveToUpCellAtSameOffset { + /// `Cut selection` + String get cmdCutSelection { return Intl.message( - 'Move to up cell at same offset', - name: 'cmdMoveToUpCellAtSameOffset', + 'Cut selection', + name: 'cmdCutSelection', + desc: '', + args: [], + ); + } + + /// `Delete character to the left` + String get cmdDeleteLeft { + return Intl.message( + 'Delete character to the left', + name: 'cmdDeleteLeft', + desc: '', + args: [], + ); + } + + /// `Delete to beginning of line` + String get cmdDeleteLineLeft { + return Intl.message( + 'Delete to beginning of line', + name: 'cmdDeleteLineLeft', + desc: '', + args: [], + ); + } + + /// `Delete character to the right` + String get cmdDeleteRight { + return Intl.message( + 'Delete character to the right', + name: 'cmdDeleteRight', + desc: '', + args: [], + ); + } + + /// `delete word at left` + String get cmdDeleteWordLeft { + return Intl.message( + 'delete word at left', + name: 'cmdDeleteWordLeft', + desc: '', + args: [], + ); + } + + /// `delete word at right` + String get cmdDeleteWordRight { + return Intl.message( + 'delete word at right', + name: 'cmdDeleteWordRight', + desc: '', + args: [], + ); + } + + /// `exit editing mode` + String get cmdExitEditing { + return Intl.message( + 'exit editing mode', + name: 'cmdExitEditing', + desc: '', + args: [], + ); + } + + /// `indent` + String get cmdIndent { + return Intl.message( + 'indent', + name: 'cmdIndent', + desc: '', + args: [], + ); + } + + /// `move cursor to the bottom` + String get cmdMoveCursorBottom { + return Intl.message( + 'move cursor to the bottom', + name: 'cmdMoveCursorBottom', + desc: '', + args: [], + ); + } + + /// `Select all until end of file` + String get cmdMoveCursorBottomSelect { + return Intl.message( + 'Select all until end of file', + name: 'cmdMoveCursorBottomSelect', + desc: '', + args: [], + ); + } + + /// `move cursor down` + String get cmdMoveCursorDown { + return Intl.message( + 'move cursor down', + name: 'cmdMoveCursorDown', + desc: '', + args: [], + ); + } + + /// `Select downward` + String get cmdMoveCursorDownSelect { + return Intl.message( + 'Select downward', + name: 'cmdMoveCursorDownSelect', + desc: '', + args: [], + ); + } + + /// `move cursor left` + String get cmdMoveCursorLeft { + return Intl.message( + 'move cursor left', + name: 'cmdMoveCursorLeft', + desc: '', + args: [], + ); + } + + /// `Select left` + String get cmdMoveCursorLeftSelect { + return Intl.message( + 'Select left', + name: 'cmdMoveCursorLeftSelect', + desc: '', + args: [], + ); + } + + /// `move cursor to the end of line` + String get cmdMoveCursorLineEnd { + return Intl.message( + 'move cursor to the end of line', + name: 'cmdMoveCursorLineEnd', + desc: '', + args: [], + ); + } + + /// `Select to end of line` + String get cmdMoveCursorLineEndSelect { + return Intl.message( + 'Select to end of line', + name: 'cmdMoveCursorLineEndSelect', + desc: '', + args: [], + ); + } + + /// `move cursor to start of line` + String get cmdMoveCursorLineStart { + return Intl.message( + 'move cursor to start of line', + name: 'cmdMoveCursorLineStart', + desc: '', + args: [], + ); + } + + /// `Select to start of line` + String get cmdMoveCursorLineStartSelect { + return Intl.message( + 'Select to start of line', + name: 'cmdMoveCursorLineStartSelect', + desc: '', + args: [], + ); + } + + /// `move cursor right` + String get cmdMoveCursorRight { + return Intl.message( + 'move cursor right', + name: 'cmdMoveCursorRight', + desc: '', + args: [], + ); + } + + /// `Select right` + String get cmdMoveCursorRightSelect { + return Intl.message( + 'Select right', + name: 'cmdMoveCursorRightSelect', + desc: '', + args: [], + ); + } + + /// `move cursor to the top` + String get cmdMoveCursorTop { + return Intl.message( + 'move cursor to the top', + name: 'cmdMoveCursorTop', + desc: '', + args: [], + ); + } + + /// `Select all until start of file` + String get cmdMoveCursorTopSelect { + return Intl.message( + 'Select all until start of file', + name: 'cmdMoveCursorTopSelect', + desc: '', + args: [], + ); + } + + /// `move cursor up` + String get cmdMoveCursorUp { + return Intl.message( + 'move cursor up', + name: 'cmdMoveCursorUp', + desc: '', + args: [], + ); + } + + /// `Select upward` + String get cmdMoveCursorUpSelect { + return Intl.message( + 'Select upward', + name: 'cmdMoveCursorUpSelect', + desc: '', + args: [], + ); + } + + /// `move cursor to word on the left` + String get cmdMoveCursorWordLeft { + return Intl.message( + 'move cursor to word on the left', + name: 'cmdMoveCursorWordLeft', + desc: '', + args: [], + ); + } + + /// `Select word to the left` + String get cmdMoveCursorWordLeftSelect { + return Intl.message( + 'Select word to the left', + name: 'cmdMoveCursorWordLeftSelect', + desc: '', + args: [], + ); + } + + /// `move cursor to word on the right` + String get cmdMoveCursorWordRight { + return Intl.message( + 'move cursor to word on the right', + name: 'cmdMoveCursorWordRight', + desc: '', + args: [], + ); + } + + /// `Select word to the right` + String get cmdMoveCursorWordRightSelect { + return Intl.message( + 'Select word to the right', + name: 'cmdMoveCursorWordRightSelect', + desc: '', + args: [], + ); + } + + /// `Open Find` + String get cmdOpenFind { + return Intl.message( + 'Open Find', + name: 'cmdOpenFind', + desc: '', + args: [], + ); + } + + /// `Open Find and Replace` + String get cmdOpenFindAndReplace { + return Intl.message( + 'Open Find and Replace', + name: 'cmdOpenFindAndReplace', + desc: '', + args: [], + ); + } + + /// `open link` + String get cmdOpenLink { + return Intl.message( + 'open link', + name: 'cmdOpenLink', + desc: '', + args: [], + ); + } + + /// `open links` + String get cmdOpenLinks { + return Intl.message( + 'open links', + name: 'cmdOpenLinks', + desc: '', + args: [], + ); + } + + /// `outdent` + String get cmdOutdent { + return Intl.message( + 'outdent', + name: 'cmdOutdent', + desc: '', + args: [], + ); + } + + /// `paste content` + String get cmdPasteContent { + return Intl.message( + 'paste content', + name: 'cmdPasteContent', + desc: '', + args: [], + ); + } + + /// `paste content as plain text` + String get cmdPasteContentAsPlainText { + return Intl.message( + 'paste content as plain text', + name: 'cmdPasteContentAsPlainText', + desc: '', + args: [], + ); + } + + /// `redo` + String get cmdRedo { + return Intl.message( + 'redo', + name: 'cmdRedo', + desc: '', + args: [], + ); + } + + /// `scroll page down` + String get cmdScrollPageDown { + return Intl.message( + 'scroll page down', + name: 'cmdScrollPageDown', + desc: '', + args: [], + ); + } + + /// `scroll page up` + String get cmdScrollPageUp { + return Intl.message( + 'scroll page up', + name: 'cmdScrollPageUp', + desc: '', + args: [], + ); + } + + /// `scroll to bottom` + String get cmdScrollToBottom { + return Intl.message( + 'scroll to bottom', + name: 'cmdScrollToBottom', + desc: '', + args: [], + ); + } + + /// `scroll to top` + String get cmdScrollToTop { + return Intl.message( + 'scroll to top', + name: 'cmdScrollToTop', + desc: '', + args: [], + ); + } + + /// `select all` + String get cmdSelectAll { + return Intl.message( + 'select all', + name: 'cmdSelectAll', + desc: '', + args: [], + ); + } + + /// `Table: add line break` + String get cmdTableLineBreak { + return Intl.message( + 'Table: add line break', + name: 'cmdTableLineBreak', desc: '', args: [], ); } /// `Move to down cell at same offset` - String get cmdMoveToDownCellAtSameOffset { + String get cmdTableMoveToDownCellAtSameOffset { return Intl.message( 'Move to down cell at same offset', - name: 'cmdMoveToDownCellAtSameOffset', + name: 'cmdTableMoveToDownCellAtSameOffset', + desc: '', + args: [], + ); + } + + /// `Move to left cell if its at start of current cell` + String get cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell { + return Intl.message( + 'Move to left cell if its at start of current cell', + name: 'cmdTableMoveToLeftCellIfItsAtStartOfCurrentCell', + desc: '', + args: [], + ); + } + + /// `Move to right cell if its at the end of current cell` + String get cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell { + return Intl.message( + 'Move to right cell if its at the end of current cell', + name: 'cmdTableMoveToRightCellIfItsAtTheEndOfCurrentCell', + desc: '', + args: [], + ); + } + + /// `Move to up cell at same offset` + String get cmdTableMoveToUpCellAtSameOffset { + return Intl.message( + 'Move to up cell at same offset', + name: 'cmdTableMoveToUpCellAtSameOffset', desc: '', args: [], ); } /// `Navigate around the cells at same offset` - String get cmdNavigateAroundTheCellsAtSameOffset { + String get cmdTableNavigateCells { return Intl.message( 'Navigate around the cells at same offset', - name: 'cmdNavigateAroundTheCellsAtSameOffset', + name: 'cmdTableNavigateCells', desc: '', args: [], ); } /// `Navigate around the cells at same offset in reverse` - String get cmdNavigateAroundTheCellsAtSameOffsetInReverse { + String get cmdTableNavigateCellsReverse { return Intl.message( 'Navigate around the cells at same offset in reverse', - name: 'cmdNavigateAroundTheCellsAtSameOffsetInReverse', + name: 'cmdTableNavigateCellsReverse', desc: '', args: [], ); } /// `Stop at the beginning of the cell` - String get cmdStopAtTheBeginningOfTheCell { + String get cmdTableStopAtTheBeginningOfTheCell { return Intl.message( 'Stop at the beginning of the cell', - name: 'cmdStopAtTheBeginningOfTheCell', + name: 'cmdTableStopAtTheBeginningOfTheCell', + desc: '', + args: [], + ); + } + + /// `toggle bold` + String get cmdToggleBold { + return Intl.message( + 'toggle bold', + name: 'cmdToggleBold', + desc: '', + args: [], + ); + } + + /// `toggle code` + String get cmdToggleCode { + return Intl.message( + 'toggle code', + name: 'cmdToggleCode', + desc: '', + args: [], + ); + } + + /// `toggle highlight` + String get cmdToggleHighlight { + return Intl.message( + 'toggle highlight', + name: 'cmdToggleHighlight', + desc: '', + args: [], + ); + } + + /// `toggle italic` + String get cmdToggleItalic { + return Intl.message( + 'toggle italic', + name: 'cmdToggleItalic', + desc: '', + args: [], + ); + } + + /// `toggle strikethrough` + String get cmdToggleStrikethrough { + return Intl.message( + 'toggle strikethrough', + name: 'cmdToggleStrikethrough', + desc: '', + args: [], + ); + } + + /// `toggle the todo list` + String get cmdToggleTodoList { + return Intl.message( + 'toggle the todo list', + name: 'cmdToggleTodoList', + desc: '', + args: [], + ); + } + + /// `toggle underline` + String get cmdToggleUnderline { + return Intl.message( + 'toggle underline', + name: 'cmdToggleUnderline', + desc: '', + args: [], + ); + } + + /// `undo` + String get cmdUndo { + return Intl.message( + 'undo', + name: 'cmdUndo', desc: '', args: [], ); diff --git a/test/service/shortcut_event/shortcut_event_test.dart b/test/service/shortcut_event/shortcut_event_test.dart index 98a24589..28d78101 100644 --- a/test/service/shortcut_event/shortcut_event_test.dart +++ b/test/service/shortcut_event/shortcut_event_test.dart @@ -16,6 +16,7 @@ void main() async { test('redefine shortcut event command', () { final shortcutEvent = CommandShortcutEvent( key: 'Sample', + getDescription: () => 'Sample', command: 'cmd+shift+alt+ctrl+a', handler: (editorState) { return KeyEventResult.handled;