diff --git a/src/core/editorconfig.h b/src/core/editorconfig.h index 27df0dcd..70dade79 100644 --- a/src/core/editorconfig.h +++ b/src/core/editorconfig.h @@ -65,6 +65,7 @@ namespace vnotex WordCount, Attachment, AlternateViewMode, + ParseToMarkdownAndPaste, MaxShortcut }; Q_ENUM(Shortcut) diff --git a/src/data/core/vnotex.json b/src/data/core/vnotex.json index e78d2391..0273b1bd 100644 --- a/src/data/core/vnotex.json +++ b/src/data/core/vnotex.json @@ -223,7 +223,8 @@ "WordCount" : "", "Debug" : "F12", "Print" : "", - "ClearHighlights" : "Ctrl+G, Space" + "ClearHighlights" : "Ctrl+G, Space", + "ParseToMarkdownAndPaste" : "Ctrl+G, Ctrl+P" }, "spell_check_auto_detect_language" : false, "spell_check_default_dictionary" : "en_US", diff --git a/src/widgets/editors/markdowneditor.cpp b/src/widgets/editors/markdowneditor.cpp index e2a3c301..e443b534 100644 --- a/src/widgets/editors/markdowneditor.cpp +++ b/src/widgets/editors/markdowneditor.cpp @@ -1021,6 +1021,8 @@ void MarkdownEditor::handleContextMenuEvent(QContextMenuEvent *p_event, bool *p_ if (mimeData->hasHtml()) { // Parse to Markdown and Paste. auto parsePasteAct = new QAction(tr("Parse to Markdown and Paste"), menu); + WidgetUtils::addActionShortcutText(parsePasteAct, + editorConfig.getShortcut(EditorConfig::Shortcut::ParseToMarkdownAndPaste)); connect(parsePasteAct, &QAction::triggered, this, &MarkdownEditor::parseToMarkdownAndPaste); WidgetUtils::insertActionAfter(menu, altPasteAct, parsePasteAct); @@ -1069,11 +1071,24 @@ void MarkdownEditor::setupShortcuts() { const auto &editorConfig = ConfigMgr::getInst().getEditorConfig(); - auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::AltPaste), - this); - if (shortcut) { - connect(shortcut, &QShortcut::activated, - this, &MarkdownEditor::altPaste); + // Alt paste. + { + auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::AltPaste), + this); + if (shortcut) { + connect(shortcut, &QShortcut::activated, + this, &MarkdownEditor::altPaste); + } + } + + // Parse to Markdown and Paste. + { + auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::ParseToMarkdownAndPaste), + this); + if (shortcut) { + connect(shortcut, &QShortcut::activated, + this, &MarkdownEditor::parseToMarkdownAndPaste); + } } }