diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index 25eefc93c..79e9a16e8 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -286,7 +286,7 @@ @cp_admin-last-bg: lighten(@cryptpad_color_orange, 25%); // Code -@cp_preview-bg: @cryptpad_color_white; +@cp_preview-bg: @cryptpad_color_light_grey; @cp_preview-fg: @cryptpad_text_col; // Debug diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 34be688f0..607043e0e 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -123,7 +123,7 @@ @cp_sidebar-hint: @cryptpad_color_hint_grey; // Drive -@cp_drive-bg: @cp_sidebar_right-bg; +@cp_drive-bg: @cp_sidebar-right-bg; @cp_drive-fg: @cp_sidebar-right-fg; @cp_drive-header-fg: @cryptpad_color_dark_grey; @cp_drive-icon-hover: @cryptpad_color_grey; diff --git a/www/code/app-code.less b/www/code/app-code.less index c21a63582..138741919 100644 --- a/www/code/app-code.less +++ b/www/code/app-code.less @@ -11,6 +11,7 @@ flex-flow: column; max-height: 100%; min-height: auto; + background-color: @cp_preview-bg; #cp-app-code-container { display: inline-flex; diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index a1c0958a9..98a260c23 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -379,10 +379,12 @@ define([ exp.configureTheme = function (Common, cb) { /* Remember the user's last choice of theme using localStorage */ - var themeKey = ['codemirror', 'theme']; + var isDark = window.CryptPad_theme === "dark"; + var themeKey = ['codemirror', isDark ? 'themedark' : 'theme']; + var defaultTheme = isDark ? 'ansuz' : 'default'; var todo = function (err, lastTheme) { - lastTheme = lastTheme || 'default'; + lastTheme = lastTheme || defaultTheme; var options = []; Themes.forEach(function (l) { options.push({ diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 61a7ad23d..5ad3d1dc8 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -249,6 +249,7 @@ define([ editor.refresh(); } }; + cm.configureTheme(common, function () {}); SFCodeMirror.mkIndentSettings(editor, framework._.cpNfInner.metadataMgr); editor.on('change', function () { var val = editor.getValue(); diff --git a/www/poll/inner.js b/www/poll/inner.js index e3e6e4ef9..101c89e7e 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -17,6 +17,7 @@ define([ '/common/common-ui-elements.js', '/common/hyperscript.js', '/customize/messages.js', + '/common/sframe-common-codemirror.js', 'cm/lib/codemirror', '/common/test.js', @@ -48,6 +49,7 @@ define([ UIElements, h, Messages, + SFCodeMirror, CMeditor, Test) { @@ -1330,12 +1332,13 @@ define([ APP.$comments = $('#cp-app-poll-comments-list'); APP.$addComment = $('#cp-app-poll-comments-add'); - APP.editor = CMeditor.fromTextArea(APP.$description[0], { - lineNumbers: true, - lineWrapping: true, - styleActiveLine : true, - mode: "markdown", - }); + var cm = SFCodeMirror.create("gfm", CMeditor, APP.$description[0]); + var editor = APP.editor = cm.editor; + editor.setOption('lineNumbers', true); + editor.setOption('lineWrapping', true); + editor.setOption('styleActiveLine', true); + editor.setOption('readOnly', false); + cm.configureTheme(common, function () {}); APP.$descriptionPublished.click(function (e) { if (!e.target) { return; } diff --git a/www/profile/inner.js b/www/profile/inner.js index 236576bfd..0f0d8e2b8 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -16,6 +16,7 @@ define([ '/customize/messages.js', '/customize/application_config.js', '/bower_components/marked/marked.min.js', + '/common/sframe-common-codemirror.js', 'cm/lib/codemirror', 'cm/mode/markdown/markdown', @@ -44,6 +45,7 @@ define([ Messages, AppConfig, Marked, + SFCodeMirror, CodeMirror ) { @@ -438,12 +440,13 @@ define([ ]); $block.append(div); - var editor = APP.editor = CodeMirror.fromTextArea(text, { - lineNumbers: true, - lineWrapping: true, - styleActiveLine : true, - mode: "markdown", - }); + var cm = SFCodeMirror.create("gfm", CodeMirror, text); + var editor = APP.editor = cm.editor; + editor.setOption('lineNumbers', true); + editor.setOption('lineWrapping', true); + editor.setOption('styleActiveLine', true); + editor.setOption('readOnly', false); + cm.configureTheme(common, function () {}); var markdownTb = common.createMarkdownToolbar(editor); $(code).prepend(markdownTb.toolbar);