diff --git a/cms/static/js/html-editor.js b/cms/static/js/html-editor.js index 571a022911..3a4ab47172 100644 --- a/cms/static/js/html-editor.js +++ b/cms/static/js/html-editor.js @@ -33,6 +33,9 @@ function initHTMLEditor($editor, $prev) { image : '/static/img/visual-editor-image-icon.png', onclick : function() { $assetWidget = $($('#asset-library-widget').html()); + $assetWidget.find('.close-button').bind('click', closeAssetWidget); + $modalCover.unbind('click'); + $modalCover.bind('click', closeAssetWidget); $modalCover.css('z-index', '99999'); $('.insert-asset-button', $assetWidget).bind('click', { editor: ed }, insertAsset); $body.append($assetWidget); @@ -41,30 +44,30 @@ function initHTMLEditor($editor, $prev) { } }); }, 100); - + htmlEditor = CodeMirror.fromTextArea($editor.find('.html-box')[0], { lineWrapping: true, mode: 'text/html', lineNumbers: true }); - $(htmlEditor.getWrapperElement()).hide(); - $(htmlEditor.getWrapperElement()).bind('click', function() { - $(htmlEditor).focus(); - }); - - $editor.find('.save-button, .cancel-button').bind('click', updatePreview); + $editor.find('.save-button, .cancel-button').bind('click', updateHTMLPreview); } function insertAsset(e) { - $assetWidget.remove(); - $modalCover.css('z-index', '1000'); + closeAssetWidget(); var editor = e.data.editor; editor.focus(); editor.selection.setContent($(this).attr('data-markup')); } +function closeAssetWidget(e) { + $assetWidget.remove(); + $modalCover.css('z-index', '1000'); +} + function convertVisualToHTML() { + console.log('convert'); htmlEditor.setValue($visualEditor.html()); } @@ -72,6 +75,10 @@ function convertHTMLToVisual() { $visualEditor.html(htmlEditor.getValue()); } -function updatePreview() { - $htmlPreview.html($visualEditor.html()); +function updateHTMLPreview() { + if(currentEditor == htmlEditor) { + $htmlPreview.html(htmlEditor.getValue()); + } else { + $htmlPreview.html($visualEditor.html()); + } } \ No newline at end of file diff --git a/cms/static/js/speed-editor.js b/cms/static/js/speed-editor.js index b2a49ff6bb..f310e86cac 100644 --- a/cms/static/js/speed-editor.js +++ b/cms/static/js/speed-editor.js @@ -84,6 +84,7 @@ function setFocus(e) { } function onSimpleEditorUpdate() { + console.log('update'); updatePreview(); updateXML(); } diff --git a/cms/static/sass/_assets.scss b/cms/static/sass/_assets.scss index f09fc4d083..3a04f16021 100644 --- a/cms/static/sass/_assets.scss +++ b/cms/static/sass/_assets.scss @@ -111,7 +111,8 @@ display: block; &.widget { - position: absolute; + position: fixed; + top: 40px; left: 50%; z-index: 99999; width: 900px; @@ -190,6 +191,14 @@ th { padding: 5px 20px; } + + th a { + color: #3c3c3c; + } + + .upload-form { + display: none; + } } table { @@ -246,7 +255,7 @@ } .insert-col { - width: 80px; + width: 100px; } .insert-asset-button { diff --git a/cms/static/sass/_graphics.scss b/cms/static/sass/_graphics.scss index 097da8e5ba..a1a423db48 100644 --- a/cms/static/sass/_graphics.scss +++ b/cms/static/sass/_graphics.scss @@ -317,7 +317,18 @@ background: url(../img/problem-settings-icon.png) no-repeat; } - +.sort-icon { + font-size: 7px; + vertical-align: middle; + + &.down:before { + content: '▼'; + } + + &.up:before { + content: '▲'; + } +} diff --git a/cms/static/sass/_unit.scss b/cms/static/sass/_unit.scss index 19799b5239..dc39096ac7 100644 --- a/cms/static/sass/_unit.scss +++ b/cms/static/sass/_unit.scss @@ -384,15 +384,14 @@ position: relative; } - textarea { - display: none; - } - .CodeMirror { + display: none; position: absolute; top: 47px; width: 100%; height: 378px; + background: #fff; + color: #3c3c3c; @include box-sizing(border-box); } diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 135c080638..79efd555c9 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -20,7 +20,6 @@ e.preventDefault(); $('.editor-tabs .current').removeClass('current'); $(this).addClass('current'); - console.log($(this).attr('data-tab')); switch($(this).attr('data-tab')) { case 'simple': currentEditor = simpleEditor; @@ -34,6 +33,7 @@ $(simpleEditor.getWrapperElement()).hide(); $(xmlEditor.getWrapperElement()).show(); $(xmlEditor).focus(); + xmlEditor.refresh(); break; case 'visual': currentEditor = visualEditor; @@ -43,10 +43,11 @@ break; case 'html': currentEditor = htmlEditor; - convertVisualToHTML(); $('table.mceToolbar').hide(); $(htmlEditor.getWrapperElement()).show(); $(htmlEditor).focus(); + convertVisualToHTML(); + htmlEditor.refresh(); break; } } @@ -62,16 +63,33 @@ + +
| - | Name | -Date Added | +Name | +Date Added |
|---|