From 1714d23ae82ebc3cf7e54f88486979cd85c214f1 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Sun, 25 Jan 2015 18:07:08 +0200 Subject: [PATCH 1/2] TinyMCE RTL in course bulk email --- common/lib/xmodule/xmodule/js/src/html/edit.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/html/edit.coffee b/common/lib/xmodule/xmodule/js/src/html/edit.coffee index 2e1b9a169d..29fe46c826 100644 --- a/common/lib/xmodule/xmodule/js/src/html/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/html/edit.coffee @@ -66,6 +66,8 @@ class @HTMLEditingDescriptor schema: "html5", # Necessary to preserve relative URLs to our images. convert_urls : false, + # Sniff UI direction from `.wrapper-view` in studio or `.window-wrap` in LMS + directionality: $(".wrapper-view, .window-wrap").prop('dir'), content_css : tiny_mce_css_links.join(", "), formats : { # tinyMCE does block level for code by default @@ -91,7 +93,7 @@ class @HTMLEditingDescriptor height: '400px', menubar: false, statusbar: false, - + # Necessary to avoid stripping of style tags. valid_children : "+body[style]", @@ -99,7 +101,7 @@ class @HTMLEditingDescriptor valid_elements: "*[*]", extended_valid_elements: "*[*]", invalid_elements: "", - + setup: @setupTinyMCE, # Cannot get access to tinyMCE Editor instance (for focusing) until after it is rendered. # The tinyMCE callback passes in the editor as a parameter. From 38db6e695dd1f7d31aafc37d30cc66dac8502163 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Tue, 27 Jan 2015 11:11:55 +0200 Subject: [PATCH 2/2] Giant fixups for the editors around the studio --- cms/static/sass/elements/_modal-window.scss | 5 +++-- cms/static/sass/views/_settings.scss | 15 +++++++++++++++ common/lib/xmodule/xmodule/css/editor/edit.scss | 12 +++++++----- .../xmodule/xmodule/js/src/problem/edit.coffee | 16 ++++++++-------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/cms/static/sass/elements/_modal-window.scss b/cms/static/sass/elements/_modal-window.scss index 4c8683c1c4..ac33a0e8a4 100644 --- a/cms/static/sass/elements/_modal-window.scss +++ b/cms/static/sass/elements/_modal-window.scss @@ -15,7 +15,8 @@ border-radius: ($baseline/5); background-color: $gray-l4; padding: 7px; - text-align: left; + @include text-align(left); + @include direction(); .modal-content { position: relative; @@ -214,7 +215,7 @@ .editor-modes { width: 48%; display: inline-block; - text-align: right; + @include text-align(right); .action-item { display: inline-block; diff --git a/cms/static/sass/views/_settings.scss b/cms/static/sass/views/_settings.scss index 273db8d2e1..9f91c780f5 100644 --- a/cms/static/sass/views/_settings.scss +++ b/cms/static/sass/views/_settings.scss @@ -2,6 +2,8 @@ // ==================== .view-settings { + @include text-align(left); + @include direction(); .content-primary, .content-supplementary { @include box-sizing(border-box); @@ -908,6 +910,19 @@ top: 4px; /* Vertical alignment for monospace font */ } + .CodeMirror-scroll { + @include margin-left(-30px); + @include margin-right(0); + + @include padding-left(30px); + @include padding-right(0); + } + + .CodeMirror-vscrollbar { + @include left(0); + @include right(auto); + } + // editor color changes just for JSON .CodeMirror-lines { diff --git a/common/lib/xmodule/xmodule/css/editor/edit.scss b/common/lib/xmodule/xmodule/css/editor/edit.scss index b6f73894b8..c31c9656f7 100644 --- a/common/lib/xmodule/xmodule/css/editor/edit.scss +++ b/common/lib/xmodule/xmodule/css/editor/edit.scss @@ -15,7 +15,7 @@ a { display: block; - float: left; + @include float(left); padding: 3px ($baseline/2) 7px; margin-left: 7px; border-radius: 2px; @@ -29,14 +29,16 @@ .editor-tabs { position: absolute; top: 10px; - right: 10px; + @include right(10px); + @include text-align(left); + @include direction(); li { - float: left; - margin-right: ($baseline/4); + @include float(left); + @include margin-right($baseline/4); &:last-child { - margin-right: 0; + @include margin-right(0); } } diff --git a/common/lib/xmodule/xmodule/js/src/problem/edit.coffee b/common/lib/xmodule/xmodule/js/src/problem/edit.coffee index 0ec8b3978a..378b142d6e 100644 --- a/common/lib/xmodule/xmodule/js/src/problem/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/problem/edit.coffee @@ -1,12 +1,12 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor # TODO really, these templates should come from or also feed the cheatsheet - @multipleChoiceTemplate : "( ) incorrect\n( ) incorrect\n(x) correct\n" - @checkboxChoiceTemplate: "[x] correct\n[ ] incorrect\n[x] correct\n" - @stringInputTemplate: "= answer\n" - @numberInputTemplate: "= answer +- 0.001%\n" - @selectTemplate: "[[incorrect, (correct), incorrect]]\n" - @headerTemplate: "Header\n=====\n" - @explanationTemplate: "[explanation]\nShort explanation\n[explanation]\n" + @multipleChoiceTemplate : "( ) #{gettext 'incorrect'}\n( ) #{gettext 'incorrect'}\n(x) #{gettext 'correct'}\n" + @checkboxChoiceTemplate: "[x] #{gettext 'correct'}\n[ ] incorrect\n[x] correct\n" + @stringInputTemplate: "= #{gettext 'answer'}\n" + @numberInputTemplate: "= #{gettext 'answer'} +- 0.001%\n" + @selectTemplate: "[[#{gettext 'incorrect'}, (#{gettext 'correct'}), #{gettext 'incorrect'}]]\n" + @headerTemplate: "#{gettext 'Header'}\n=====\n" + @explanationTemplate: "[explanation]\n#{gettext 'Short explanation'}\n[explanation]\n" constructor: (element) -> @element = element @@ -67,7 +67,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor ### confirmConversionToXml: -> # TODO: use something besides a JavaScript confirm dialog? - return confirm("If you use the Advanced Editor, this problem will be converted to XML and you will not be able to return to the Simple Editor Interface.\n\nProceed to the Advanced Editor and convert this problem to XML?") + return confirm(gettext "If you use the Advanced Editor, this problem will be converted to XML and you will not be able to return to the Simple Editor Interface.\n\nProceed to the Advanced Editor and convert this problem to XML?") ### Event listener for toolbar buttons (only possible when markdown editor is visible).