Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143)

pull/6453/head^2
Aleksander Machniak 5 years ago
parent e2bd4548ed
commit 094da1e653

@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143)
RELEASE 1.4.2 RELEASE 1.4.2
------------- -------------
- Add support for PHPUnit 6 and 7 (#6870) - Add support for PHPUnit 6 and 7 (#6870)

@ -27,6 +27,11 @@
.mce-panel { .mce-panel {
border-color: @color-input-border; border-color: @color-input-border;
} }
&.focused {
border-color: @color-input-border-focus !important;
box-shadow: 0 0 0 .2rem @color-input-border-focus-shadow !important;
}
} }
.mce-top-part::before, .mce-top-part::before,
@ -904,11 +909,6 @@ html.touch .mce-grid td {
#composebody_ifr { #composebody_ifr {
min-height: 30em; min-height: 30em;
} }
& > .mce-tinymce.focused {
border-color: @color-input-border-focus;
box-shadow: 0 0 0 .2rem @color-input-border-focus-shadow !important;
}
} }

@ -60,14 +60,6 @@
</div> </div>
</div> </div>
<roundcube:endif /> <roundcube:endif />
<roundcube:if condition="!in_array('htmleditor', (array)config:dont_override)" />
<div class="form-group row hidden">
<label for="editor-selector" class="col-form-label col-6"><roundcube:label name="editortype" /></label>
<div class="col-6">
<roundcube:object name="editorSelector" id="editor-selector" editorid="composebody" noform="true" tabindex="2" />
</div>
</div>
<roundcube:endif />
</div> </div>
</div> </div>
</div> </div>
@ -215,6 +207,9 @@
<div id="composebodycontainer"> <div id="composebodycontainer">
<label for="composebody" class="voice"><roundcube:label name="arialabelmessagebody" /></label> <label for="composebody" class="voice"><roundcube:label name="arialabelmessagebody" /></label>
<roundcube:object name="composeBody" id="composebody" form="form" cols="70" rows="20" class="form-control" tabindex="1" /> <roundcube:object name="composeBody" id="composebody" form="form" cols="70" rows="20" class="form-control" tabindex="1" />
<roundcube:if condition="!in_array('htmleditor', (array)config:dont_override)" />
<roundcube:object name="editorSelector" id="editor-selector" editorid="composebody" noform="true" class="hidden" />
<roundcube:endif />
</div> </div>
</form> </form>
<div class="formbuttons"> <div class="formbuttons">

@ -235,7 +235,7 @@ function rcube_elastic_ui()
// Image upload widget // Image upload widget
$('.image-upload').each(function() { image_upload_input(this); }); $('.image-upload').each(function() { image_upload_input(this); });
// Add HTML/Plain tabs (switch) on top of textarea with TinyMCE editor // Add HTML/Plain switcher on top of textarea with TinyMCE editor
$('textarea[data-html-editor]').each(function() { html_editor_init(this); }); $('textarea[data-html-editor]').each(function() { html_editor_init(this); });
$('#dragmessage-menu,#dragcontact-menu').each(function() { $('#dragmessage-menu,#dragcontact-menu').each(function() {
@ -1351,7 +1351,7 @@ function rcube_elastic_ui()
function tinymce_init(o) function tinymce_init(o)
{ {
var onload = [], var onload = [],
is_editor = $('#' + o.id).is('[data-html-editor]'); is_editor = $('#' + o.id).parent().is('.html-editor');
// Enable autoresize plugin // Enable autoresize plugin
o.config.plugins += ' autoresize'; o.config.plugins += ' autoresize';
@ -3655,7 +3655,7 @@ function rcube_elastic_ui()
function html_editor_init(obj) function html_editor_init(obj)
{ {
// Here we support two structures // Here we support two structures
// 1. <div><textarea></textarea><select name="editorSelector"></div> // 1. <div><textarea></textarea><select class="hidden"></div>
// 2. <tr><td><td><td><textarea></textarea></td></tr> // 2. <tr><td><td><td><textarea></textarea></td></tr>
// <tr><td><td><td><input type="checkbox"></td></tr> // <tr><td><td><td><input type="checkbox"></td></tr>
@ -3682,9 +3682,12 @@ function rcube_elastic_ui()
is_table = true; is_table = true;
} }
else { else {
sw = $('[name="editorSelector"]', obj.form); sw = editor.next('select.hidden');
} }
// make the textarea autoresizeable
textarea_autoresize_init(editor);
// sanity check // sanity check
if (sw.length != 1) { if (sw.length != 1) {
return; return;
@ -3707,9 +3710,6 @@ function rcube_elastic_ui()
// Modify the textarea cell to use 100% width // Modify the textarea cell to use 100% width
parent.addClass('col-sm-12'); parent.addClass('col-sm-12');
} }
// make the textarea autoresizeable
textarea_autoresize_init(editor);
}; };
/** /**

Loading…
Cancel
Save