mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
feature/add_shortcuts_paste_to_md (#2277)
* feature/add_shortcuts_paste_to_md * feature/add_shortcuts_paste_to_md * submodule update * adj
This commit is contained in:
parent
0f635fba7d
commit
e47b813b69
@ -65,6 +65,7 @@ namespace vnotex
|
||||
WordCount,
|
||||
Attachment,
|
||||
AlternateViewMode,
|
||||
ParseToMarkdownAndPaste,
|
||||
MaxShortcut
|
||||
};
|
||||
Q_ENUM(Shortcut)
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user