From 239d378f2d5fcbade78898fce93dbb3b943b88df Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 18 Nov 2013 23:11:05 +0000 Subject: [PATCH] Tweaked ace mode --- public/res/extensions/spellCheck.js | 2 +- public/res/libs/ace_mode_highlight_rules.js | 14 +++++++------- public/res/providers/gplusProvider.js | 4 ++-- public/res/styles/main.less | 17 +++++++++++------ public/res/themes/night.less | 6 +++--- public/res/themes/school.less | 7 ++++--- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/public/res/extensions/spellCheck.js b/public/res/extensions/spellCheck.js index fc946a3a..f32b7a1e 100644 --- a/public/res/extensions/spellCheck.js +++ b/public/res/extensions/spellCheck.js @@ -59,7 +59,7 @@ define([ } var token = tokens.shift(); var words = []; - if (!/code|code_block|reference|markup\.underline/.test(token.type)) { + if (!/code|code_block|link|reference|string|keyword|tag|markup\.underline/.test(token.type)) { token.value.replace(wordRegExp, function(word, offset) { words.push({ value: word, diff --git a/public/res/libs/ace_mode_highlight_rules.js b/public/res/libs/ace_mode_highlight_rules.js index e60158e4..36bddb39 100644 --- a/public/res/libs/ace_mode_highlight_rules.js +++ b/public/res/libs/ace_mode_highlight_rules.js @@ -81,8 +81,8 @@ var MarkdownHighlightRules = function() { regex : "\\$\\$|\\\\\\\\\\[|\\\\\\\\\\\\\\\\\\(", next : "mathblock" }, { // LaTeX block - token : "keyword", - regex : "\\\\?\\\\begin\\{[a-z]*\\*?\\}", + token : ["keyword", "text"], + regex : "(\\\\?\\\\begin)(\\{[a-z]*\\*?\\})", next : "latexblock" }, { include : "basic" @@ -96,13 +96,13 @@ var MarkdownHighlightRules = function() { token : "code", regex : "(`+)(.*?[^`])(\\1)" }, { // reference - token : ["text", "reference", "text", "markup.underline", "description", "text"], + token : ["text", "reference", "text", "link", "description", "text"], regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$" }, { // link by reference - token : ["text", "description", "text", "markup.underline", "text"], + token : ["text", "markup.underline", "text", "reference", "text"], regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])" }, { // link by url - token : ["text", "description", "text", "markup.underline", "string", "text"], + token : ["text", "markup.underline", "text", "link", "description", "text"], regex : "(\\[)"+ "(\\[[^\\]]*\\]|[^\\[\\]]*)"+ "(\\]\\([ \\t]*)"+ @@ -186,8 +186,8 @@ var MarkdownHighlightRules = function() { } ], "latexblock" : [{ - token : "keyword", - regex : "\\\\?\\\\end\\{[a-z]*\\*?\\}", + token : ["keyword", "text"], + regex : "(\\\\?\\\\end)(\\{[a-z]*\\*?\\})", next : "start" }, { include : "latex" diff --git a/public/res/providers/gplusProvider.js b/public/res/providers/gplusProvider.js index f1bbd326..252adf1b 100644 --- a/public/res/providers/gplusProvider.js +++ b/public/res/providers/gplusProvider.js @@ -16,8 +16,8 @@ define([ var result; _.find(doc.thumbnails, function(thumbnail) { var found = false; - thumbnail.url.replace(/(.*\/s)\d.*?(\/[^\/]+)/, function(match, sub1, sub2) { - result = sub1 + size + sub2; + thumbnail.url.replace(/^(.*[\/=]s)\d.*?(\/[^\/]+)?$/, function(match, sub1, sub2) { + result = sub1 + size + (sub2 || ''); found = true; }); return found; diff --git a/public/res/styles/main.less b/public/res/styles/main.less index 1563d1ce..342eb096 100644 --- a/public/res/styles/main.less +++ b/public/res/styles/main.less @@ -18,9 +18,9 @@ @secondary-bg-light: lighten(@secondary-bg, 7%); @secondary-bg-dark: darken(@secondary-bg, 7%); @primary-color: #333; -@primary-color-light: lighten(@primary-color, 13%); -@primary-color-lighter: lighten(@primary-color, 20%); -@primary-color-lightest: lighten(@primary-color, 35%); +@primary-color-light: lighten(@primary-color, 12.5%); +@primary-color-lighter: lighten(@primary-color, 25%); +@primary-color-lightest: lighten(@primary-color, 37.5%); @primary-color-inv: #fff; @bg-navbar-hover: @primary-bg-lighter; @error-border: #ff8661; @@ -972,7 +972,7 @@ ul,ol { *****************************/ .ace_editor { - color: @primary-color-light; + color: @primary-color-lighter; } .ace-tm { @@ -996,7 +996,7 @@ ul,ol { } .ace_markup.ace_list { - color: @primary-color-lightest; + color: @primary-color; } .ace_constant.ace_language { @@ -1051,13 +1051,18 @@ ul,ol { } .ace_description { - color: @primary-color-lighter; + color: @primary-color-lightest; } .ace_constant { color: @primary-color-light; } + .ace_comment { + color: fade(@primary-color-lighter, 50%); + font-style: italic; + } + .ace_marker-layer .misspelled { position: absolute; z-index: -2; diff --git a/public/res/themes/night.less b/public/res/themes/night.less index decb1b45..2abc945c 100644 --- a/public/res/themes/night.less +++ b/public/res/themes/night.less @@ -8,9 +8,9 @@ @secondary-bg-light: darken(@secondary-bg, 7%); @secondary-bg-dark: lighten(@secondary-bg, 7%); @primary-color: #fff; -@primary-color-light: darken(@primary-color, 13%); -@primary-color-lighter: darken(@primary-color, 20%); -@primary-color-lightest: darken(@primary-color, 35%); +@primary-color-light: darken(@primary-color, 12.5%); +@primary-color-lighter: darken(@primary-color, 25%); +@primary-color-lightest: darken(@primary-color, 37.5%); @primary-color-inv: #fff; @disabled-color: #999; @panel-button-color: #777; diff --git a/public/res/themes/school.less b/public/res/themes/school.less index 74fbd835..885cd297 100644 --- a/public/res/themes/school.less +++ b/public/res/themes/school.less @@ -9,9 +9,6 @@ @navbar-default-bg: darken(@board-color, 2%); @bg-navbar-hover: lighten(@board-color, 4%); @primary-color: @blue-ink; -@primary-color-light: lighten(@primary-color, 13%); -@primary-color-lighter: lighten(@primary-color, 20%); -@primary-color-lightest: lighten(@primary-color, 35%); @primary-bg: lighten(@board-border-color, 16%); @primary-bg-light: lighten(@board-border-color, 20%); @primary-bg-lighter: lighten(@board-border-color, 24%); @@ -77,6 +74,10 @@ .ace_code_block { color: @green-ink; } + + .ace_comment { + color: @green-ink; + } } h1, h2, h3, h4, h5, h6 {