mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +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,
|
WordCount,
|
||||||
Attachment,
|
Attachment,
|
||||||
AlternateViewMode,
|
AlternateViewMode,
|
||||||
|
ParseToMarkdownAndPaste,
|
||||||
MaxShortcut
|
MaxShortcut
|
||||||
};
|
};
|
||||||
Q_ENUM(Shortcut)
|
Q_ENUM(Shortcut)
|
||||||
|
@ -223,7 +223,8 @@
|
|||||||
"WordCount" : "",
|
"WordCount" : "",
|
||||||
"Debug" : "F12",
|
"Debug" : "F12",
|
||||||
"Print" : "",
|
"Print" : "",
|
||||||
"ClearHighlights" : "Ctrl+G, Space"
|
"ClearHighlights" : "Ctrl+G, Space",
|
||||||
|
"ParseToMarkdownAndPaste" : "Ctrl+G, Ctrl+P"
|
||||||
},
|
},
|
||||||
"spell_check_auto_detect_language" : false,
|
"spell_check_auto_detect_language" : false,
|
||||||
"spell_check_default_dictionary" : "en_US",
|
"spell_check_default_dictionary" : "en_US",
|
||||||
|
@ -1021,6 +1021,8 @@ void MarkdownEditor::handleContextMenuEvent(QContextMenuEvent *p_event, bool *p_
|
|||||||
if (mimeData->hasHtml()) {
|
if (mimeData->hasHtml()) {
|
||||||
// Parse to Markdown and Paste.
|
// Parse to Markdown and Paste.
|
||||||
auto parsePasteAct = new QAction(tr("Parse to Markdown and Paste"), menu);
|
auto parsePasteAct = new QAction(tr("Parse to Markdown and Paste"), menu);
|
||||||
|
WidgetUtils::addActionShortcutText(parsePasteAct,
|
||||||
|
editorConfig.getShortcut(EditorConfig::Shortcut::ParseToMarkdownAndPaste));
|
||||||
connect(parsePasteAct, &QAction::triggered,
|
connect(parsePasteAct, &QAction::triggered,
|
||||||
this, &MarkdownEditor::parseToMarkdownAndPaste);
|
this, &MarkdownEditor::parseToMarkdownAndPaste);
|
||||||
WidgetUtils::insertActionAfter(menu, altPasteAct, parsePasteAct);
|
WidgetUtils::insertActionAfter(menu, altPasteAct, parsePasteAct);
|
||||||
@ -1069,11 +1071,24 @@ void MarkdownEditor::setupShortcuts()
|
|||||||
{
|
{
|
||||||
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
|
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
|
||||||
|
|
||||||
auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::AltPaste),
|
// Alt paste.
|
||||||
this);
|
{
|
||||||
if (shortcut) {
|
auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::Shortcut::AltPaste),
|
||||||
connect(shortcut, &QShortcut::activated,
|
this);
|
||||||
this, &MarkdownEditor::altPaste);
|
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