diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f9a691eb..c95681920 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## 1.2.0
- added more German translation
+- added bold and italic formatting helpers
+ - Ctrl + B formats the selected text bold
+ - Ctrl + I formats the selected text italic
## 1.1.9
- fixed a problem with continuous list editing where text from the previous
diff --git a/SHORTCUTS.md b/SHORTCUTS.md
index cbcf658e0..9dbdb3e22 100644
--- a/SHORTCUTS.md
+++ b/SHORTCUTS.md
@@ -44,8 +44,10 @@ Important Shortcuts
- Ctrl + Alt + Down does the same
- Ctrl + L opens a dialog to add a link to an other note or an URL (also works on selected text)
- Ctrl + T inserts the current date in ISO 8601 format
-- Ctrl + I inserts an image (the image will be copied to the `media` folder in the current notes folder)
+- Ctrl + ⇧ + I inserts an image (the image will be copied to the `media` folder in the current notes folder)
- Ctrl + ⇧ + C inserts a code block at the current position
+- Ctrl + B formats the selected text bold
+- Ctrl + I formats the selected text italic
- Tab indents the selected text (also works on multiple lines)
- ⇧ + Tab un-indents the selected text
- Tab after an unordered list character indents the list item
@@ -106,8 +108,10 @@ Important Shortcuts
- ⌘ + Opt + Down does the same
- ⌘ + L opens a dialog to add a link to an other note or an URL (also works on selected text)
- ⌘ + T inserts the current date in ISO 8601 format
-- ⌘ + I inserts an image (the image will be copied to the `media` folder in the current notes folder)
+- ⌘ + ⇧ + I inserts an image (the image will be copied to the `media` folder in the current notes folder)
- ⌘ + ⇧ + C inserts a code block at the current position
+- ⌘ + B formats the selected text bold
+- ⌘ + I formats the selected text italic
- Tab indents the selected text (also works on multiple lines)
- ⇧ + Tab un-indents the selected text
- Tab after an unordered list character indents the list item
diff --git a/src/breeze-qownnotes.qrc b/src/breeze-qownnotes.qrc
index bf3abdcbf..f70703a1e 100644
--- a/src/breeze-qownnotes.qrc
+++ b/src/breeze-qownnotes.qrc
@@ -56,5 +56,7 @@
icons/breeze-qownnotes/16x16/document-open.svgicons/breeze-qownnotes/16x16/code-context.svgicons/breeze-qownnotes/16x16/zoom-original.svg
+ icons/breeze-qownnotes/16x16/format-text-bold.svg
+ icons/breeze-qownnotes/16x16/format-text-italic.svg
diff --git a/src/icons/breeze-qownnotes/16x16/format-text-bold.svg b/src/icons/breeze-qownnotes/16x16/format-text-bold.svg
new file mode 100644
index 000000000..0b6ea1077
--- /dev/null
+++ b/src/icons/breeze-qownnotes/16x16/format-text-bold.svg
@@ -0,0 +1,121 @@
+
+
+
+
diff --git a/src/icons/breeze-qownnotes/16x16/format-text-italic.svg b/src/icons/breeze-qownnotes/16x16/format-text-italic.svg
new file mode 100644
index 000000000..7ae89f26d
--- /dev/null
+++ b/src/icons/breeze-qownnotes/16x16/format-text-italic.svg
@@ -0,0 +1,132 @@
+
+
+
+
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 31181d461..ac5791748 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3346,3 +3346,39 @@ void MainWindow::on_actionShow_note_in_file_manager_triggered()
{
Utils::Misc::openFolderSelect(currentNote.fullNoteFilePath());
}
+
+/**
+ * Inserts a bold block at the current cursor position
+ */
+void MainWindow::on_actionFormat_text_bold_triggered()
+{
+ QMarkdownTextEdit* textEdit = activeNoteTextEdit();
+ QTextCursor c = textEdit->textCursor();
+ QString selectedText = textEdit->textCursor().selectedText();
+
+ if (selectedText.isEmpty()) {
+ c.insertText("****");
+ c.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, 2);
+ textEdit->setTextCursor(c);
+ } else {
+ c.insertText("**" + selectedText + "**");
+ }
+}
+
+/**
+ * Inserts a italic block at the current cursor position
+ */
+void MainWindow::on_actionFormat_text_italic_triggered()
+{
+ QMarkdownTextEdit* textEdit = activeNoteTextEdit();
+ QTextCursor c = textEdit->textCursor();
+ QString selectedText = textEdit->textCursor().selectedText();
+
+ if (selectedText.isEmpty()) {
+ c.insertText("**");
+ c.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor);
+ textEdit->setTextCursor(c);
+ } else {
+ c.insertText("*" + selectedText + "*");
+ }
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 2d6d896eb..d4087b0aa 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -203,6 +203,10 @@ private slots:
void on_actionShow_note_in_file_manager_triggered();
+ void on_actionFormat_text_bold_triggered();
+
+ void on_actionFormat_text_italic_triggered();
+
private:
Ui::MainWindow *ui;
QSplitter *mainSplitter;
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 042750c0b..9361ba43f 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -333,6 +333,9 @@ p, li { white-space: pre-wrap; }
+
+
+
@@ -757,7 +760,7 @@ p, li { white-space: pre-wrap; }
Insert image (the image will be copied to the `media` folder in the current notes folder)
- Ctrl+I
+ Ctrl+Shift+I
@@ -962,6 +965,30 @@ p, li { white-space: pre-wrap; }
Alt+Shift+F
+
+
+
+ :/icons/breeze-qownnotes/16x16/format-text-bold.svg:/icons/breeze-qownnotes/16x16/format-text-bold.svg
+
+
+ Format text &bold
+
+
+ Ctrl+B
+
+
+
+
+
+ :/icons/breeze-qownnotes/16x16/format-text-italic.svg:/icons/breeze-qownnotes/16x16/format-text-italic.svg
+
+
+ Format text &italic
+
+
+ Ctrl+I
+
+
@@ -972,8 +999,8 @@ p, li { white-space: pre-wrap; }
-
+