Merge pull request #2687 from aignatov-bio/ai-sci-4775-small-improvments-for-tinymce-tables

Add tables to TinyMce and small table improvements [SCI-4775]
This commit is contained in:
aignatov-bio 2020-06-29 09:52:03 +02:00 committed by GitHub
commit bde548227b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View file

@ -65,17 +65,18 @@ var TinyMCE = (function() {
function initImageToolBar(editor) { function initImageToolBar(editor) {
var editorIframe = $('#' + editor.id).prev().find('.mce-edit-area iframe'); var editorIframe = $('#' + editor.id).prev().find('.mce-edit-area iframe');
editorIframe.contents().find('head').append('<style type="text/css">' var primaryColor = '#104da9';
+ 'img::-moz-selection{background:0 0}' editorIframe.contents().find('head').append(`<style type="text/css">
+ 'img::selection{background:0 0}' img::-moz-selection{background:0 0}
+ '.mce-content-body img[data-mce-selected]{outline:2px solid #37a0d9}' img::selection{background:0 0}
+ '.mce-content-body div.mce-resizehandle{background:transparent;border-color:transparent;box-sizing:border-box;height:10px;width:10px}' .mce-content-body img[data-mce-selected]{outline:2px solid ${primaryColor}}
+ '.mce-content-body div.mce-resizehandle:hover{background:transparent}' .mce-content-body div.mce-resizehandle{background:transparent;border-color:transparent;box-sizing:border-box;height:10px;width:10px}
+ '.mce-content-body div#mceResizeHandlenw{border-left: 2px solid #37a0d9; border-top: 2px solid #37a0d9}' .mce-content-body div.mce-resizehandle:hover{background:transparent}
+ '.mce-content-body div#mceResizeHandlene{border-right: 2px solid #37a0d9; border-top: 2px solid #37a0d9}' .mce-content-body div#mceResizeHandlenw{border-left: 2px solid ${primaryColor}; border-top: 2px solid ${primaryColor}}
+ '.mce-content-body div#mceResizeHandlesw{border-left: 2px solid #37a0d9; border-bottom: 2px solid #37a0d9}' .mce-content-body div#mceResizeHandlene{border-right: 2px solid ${primaryColor}; border-top: 2px solid ${primaryColor}}
+ '.mce-content-body div#mceResizeHandlese{border-right: 2px solid #37a0d9; border-bottom: 2px solid #37a0d9}' .mce-content-body div#mceResizeHandlesw{border-left: 2px solid ${primaryColor}; border-bottom: 2px solid ${primaryColor}}
+ '</style>'); .mce-content-body div#mceResizeHandlese{border-right: 2px solid ${primaryColor}; border-bottom: 2px solid ${primaryColor}}
</style>`);
} }
function makeItDirty(editor) { function makeItDirty(editor) {
@ -117,7 +118,7 @@ var TinyMCE = (function() {
$(selector).closest('.form-group') $(selector).closest('.form-group')
.before('<div class="tinymce-placeholder" style="height:' + tinyMceInitSize + 'px"></div>'); .before('<div class="tinymce-placeholder" style="height:' + tinyMceInitSize + 'px"></div>');
tinyMceContainer.addClass('hidden'); tinyMceContainer.addClass('hidden');
plugins = 'custom_image_toolbar autosave autoresize customimageuploader link advlist codesample autolink lists charmap hr anchor searchreplace wordcount visualblocks visualchars insertdatetime nonbreaking save directionality paste textcolor colorpicker textpattern placeholder'; plugins = 'custom_image_toolbar table autosave autoresize customimageuploader link advlist codesample autolink lists charmap hr anchor searchreplace wordcount visualblocks visualchars insertdatetime nonbreaking save directionality paste textcolor colorpicker textpattern placeholder';
if (typeof (MarvinJsEditor) !== 'undefined') plugins += ' marvinjsplugin'; if (typeof (MarvinJsEditor) !== 'undefined') plugins += ' marvinjsplugin';
if (textAreaObject.data('objectType') === 'step' if (textAreaObject.data('objectType') === 'step'
@ -129,8 +130,8 @@ var TinyMCE = (function() {
cache_suffix: '?v=4.9.10', // This suffix should be changed any time library is updated cache_suffix: '?v=4.9.10', // This suffix should be changed any time library is updated
selector: selector, selector: selector,
convert_urls: false, convert_urls: false,
menubar: 'file edit view insert format', menubar: 'file edit view insert format table',
toolbar: 'undo redo restoredraft | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | forecolor backcolor | customimageuploader marvinjsplugin | codesample', toolbar: 'undo redo restoredraft | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table | link | forecolor backcolor | customimageuploader marvinjsplugin | codesample',
plugins: plugins, plugins: plugins,
autoresize_bottom_margin: 20, autoresize_bottom_margin: 20,
codesample_languages: [ codesample_languages: [

View file

@ -66,7 +66,7 @@
} }
.mce-widget.mce-btn { .mce-widget.mce-btn {
border-color: $color-white !important; border-color: transparent !important;
&:not(.mce-active):hover, &:not(.mce-active):hover,
&:not(.mce-active):active { &:not(.mce-active):active {

View file

@ -149,9 +149,8 @@
.mce-container-body.mce-abs-layout { .mce-container-body.mce-abs-layout {
background: $brand-primary; background: $brand-primary;
border-radius: 5px 5px 0 0;
position: relative; position: relative;
top: -45px; top: -10px;
.mce-container, .mce-container,
.mce-widget { .mce-widget {

View file

@ -299,7 +299,7 @@ class Constants
WHITELISTED_ATTRIBUTES = [ WHITELISTED_ATTRIBUTES = [
'href', 'src', 'width', 'height', 'alt', 'cite', 'datetime', 'title', 'href', 'src', 'width', 'height', 'alt', 'cite', 'datetime', 'title',
'class', 'name', 'xml:lang', 'abbr', 'style', 'target', :data 'class', 'name', 'xml:lang', 'abbr', 'style', 'target', :data, 'border'
].freeze ].freeze
WHITELISTED_CSS_ATTRIBUTES = { WHITELISTED_CSS_ATTRIBUTES = {