+
a {
+ .opened-files div.title:hover > a,
+ .opened-files div.title > a:hover {
display: block;
&:hover {
color: var(--primary);
@@ -267,6 +276,9 @@
display: flex;
flex-direction: column;
}
+ .default-cursor {
+ cursor: default;
+ }
.opened-files .opened-files-list {
max-height: 200px;
overflow: auto;
diff --git a/src/renderer/config.js b/src/renderer/config.js
new file mode 100644
index 00000000..caa5fd19
--- /dev/null
+++ b/src/renderer/config.js
@@ -0,0 +1,10 @@
+export const THEME_LINK_ID = 'ag-theme'
+export const COMMON_STYLE_ID = 'ag-common-style'
+
+export const DEFAULT_EDITOR_FONT_FAMILY = '"Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif'
+export const DEFAULT_CODE_FONT_FAMILY = '"DejaVu Sans Mono", "Source Code Pro", "Droid Sans Mono", monospace'
+export const DEFAULT_STYLE = {
+ codeFontFamily: DEFAULT_CODE_FONT_FAMILY,
+ codeFontSize: '14px',
+ theme: 'light'
+}
diff --git a/src/renderer/store/preferences.js b/src/renderer/store/preferences.js
index 020e0ca4..e30d0fda 100644
--- a/src/renderer/store/preferences.js
+++ b/src/renderer/store/preferences.js
@@ -6,6 +6,8 @@ const state = {
theme: 'light',
editorFontFamily: 'Open Sans',
fontSize: '16px',
+ codeFontFamily: 'DejaVu Sans Mono',
+ codeFontSize: '14px',
lineHeight: 1.6,
lightColor: '#303133', // color in light theme
darkColor: 'rgb(217, 217, 217)', // color in dark theme
@@ -16,6 +18,7 @@ const state = {
autoPairMarkdownSyntax: true,
autoPairQuote: true,
tabSize: 4,
+ hideQuickInsertHint: false,
// edit modes (they are not in preference.md, but still put them here)
typewriter: false, // typewriter mode
focus: false, // focus mode
diff --git a/src/renderer/util/theme.js b/src/renderer/util/theme.js
new file mode 100644
index 00000000..4f18643c
--- /dev/null
+++ b/src/renderer/util/theme.js
@@ -0,0 +1,45 @@
+import { THEME_LINK_ID, COMMON_STYLE_ID, DEFAULT_CODE_FONT_FAMILY } from '../config'
+
+export const addThemeStyle = theme => {
+ const href = process.env.NODE_ENV !== 'production'
+ ? `./src/muya/themes/${theme}.css`
+ : `./static/themes/${theme}.css`
+
+ let link = document.querySelector(`#${THEME_LINK_ID}`)
+ if (!link) {
+ link = document.createElement('link')
+ link.setAttribute('rel', 'stylesheet')
+ link.id = THEME_LINK_ID
+ document.head.appendChild(link)
+ }
+ link.href = href
+}
+
+export const addCommonStyle = style => {
+ const { codeFontFamily, codeFontSize } = style
+ let sheet = document.querySelector(`#${COMMON_STYLE_ID}`)
+ if (!sheet) {
+ sheet = document.createElement('style')
+ sheet.id = COMMON_STYLE_ID
+ document.head.appendChild(sheet)
+ }
+ sheet.innerHTML = `
+span code,
+td code,
+th code,
+code,
+code[class*="language-"],
+.CodeMirror,
+pre.ag-paragraph {
+font-family: ${codeFontFamily}, ${DEFAULT_CODE_FONT_FAMILY};
+font-size: ${codeFontSize};
+}
+`
+}
+
+// Append common sheet and theme at the end of head - order is important.
+export const addStyles = style => {
+ const { theme } = style
+ addThemeStyle(theme)
+ addCommonStyle(style)
+}
diff --git a/static/preference.md b/static/preference.md
index 55bd4bc5..8c325bdb 100755
--- a/static/preference.md
+++ b/static/preference.md
@@ -16,12 +16,15 @@ Edit and save to update preferences. You can only change the JSON below!
{
"fontSize": "16px",
"editorFontFamily": "Open Sans",
+ "codeFontFamily": "DejaVu Sans Mono",
+ "codeFontSize": "14px",
"lightColor": "#303133",
"darkColor": "rgb(217, 217, 217)",
"lineHeight": "1.6",
"theme": "light",
"autoSave": false,
"aidou": false,
+ "hideQuickInsertHint": false,
"preferLooseListItem": true,
"bulletListMarker": "-",
"autoPairBracket": true,