Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: enable h1 (fixes streetwriters/notesnook#386 and streetwriters/notesnook#224)

thecodrr08d2040075b9
diff --git a/apps/web/package.json b/apps/web/package.json
index 1179de3bf..030e838d9 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -12,7 +12,7 @@
"@notesnook/crypto": "^1.0.0",
"@notesnook/desktop": "file:desktop",
"@rebass/forms": "^4.0.6",
- "@streetwriters/tinymce-plugins": "^1.5.12",
+ "@streetwriters/tinymce-plugins": "^1.5.14",
"@tinymce/tinymce-react": "^3.13.0",
"async-mutex": "^0.3.2",
"axios": "^0.21.4",
diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.css
index 9d1e0c9a3..587b45258 100644
--- a/apps/web/src/components/editor/editor.css
+++ b/apps/web/src/components/editor/editor.css
@@ -389,6 +389,7 @@ table thead {
COLLAPSIBLE HEADERS
*/
+.editorScroll h1::before,
.editorScroll h2::before,
.editorScroll h3::before,
.editorScroll h4::before,
@@ -412,6 +413,7 @@ table thead {
border: none;
}
+.editorScroll:hover h1::before,
.editorScroll:hover h2::before,
.editorScroll:hover h3::before,
.editorScroll:hover h4::before,
@@ -420,6 +422,10 @@ table thead {
opacity: 1;
}
+.mce-content-body h1::before {
+ margin-bottom: -2px;
+}
+
.mce-content-body h2::before {
margin-bottom: -5px;
}
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 83bf6c28d..1cc3b299b 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -32,6 +32,8 @@ function editorSetContent(editor, content) {
editor.setHTML(content);
updateWordCount(editor);
+
+ editor.focus();
}
function updateWordCount(editor) {
diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.js
index f5d2f894b..c0a918a5e 100644
--- a/apps/web/src/components/editor/tinymce.js
+++ b/apps/web/src/components/editor/tinymce.js
@@ -54,6 +54,7 @@ const markdownPatterns = [
{ start: "**", end: "**", format: "bold" },
{ start: "~~", end: "~~", format: "strikethrough" },
{ start: "`", end: "`", cmd: "mceInsertInlineCode" },
+ { start: "# ", format: "h1" },
{ start: "## ", format: "h2" },
{ start: "### ", format: "h3" },
{ start: "#### ", format: "h4" },
@@ -237,7 +238,7 @@ function TinyMCE(props) {
toolbar_mode: "scrolling",
},
block_formats:
- "Paragraph=p; Header 2=h2; Header 3=h3; Header 4=h4; Header 5=h5; Header 6=h6; Code=pre",
+ "Paragraph=p; Header 1=h1; Header 2=h2; Header 3=h3; Header 4=h4; Header 5=h5; Header 6=h6; Code=pre",
textpattern_patterns: markdownPatterns,
placeholder: placeholder || "Start writing your note here...",
target_list: false,