New CodeMirror default theme on dark mode
parent
54e9c4a4b7
commit
519d5d7b5c
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue