diff options
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 15 | ||||
-rw-r--r-- | program/js/editor.js | 31 | ||||
-rw-r--r-- | program/js/googiespell.js | 12 | ||||
-rw-r--r-- | program/js/tinymce/roundcube/content.css | 4 |
4 files changed, 37 insertions, 25 deletions
diff --git a/program/js/app.js b/program/js/app.js index 5d799c278..31544abf0 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3319,7 +3319,7 @@ function rcube_webmail() if (!this.gui_objects.messageform) return false; - var i, input_from = $("[name='_from']"), + var i, pos, input_from = $("[name='_from']"), input_to = $("[name='_to']"), input_subject = $("input[name='_subject']"), input_message = $("[name='_message']").get(0), @@ -3353,12 +3353,19 @@ function rcube_webmail() } if (!html_mode) { - this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); + pos = this.env.top_posting ? 0 : input_message.value.length; + this.set_caret_pos(input_message, pos); + // add signature according to selected identity // if we have HTML editor, signature is added in callback if (input_from.prop('type') == 'select-one') { this.change_identity(input_from[0]); } + + // scroll to the bottom of the textarea (#1490114) + if (pos) { + $(input_message).scrollTop(input_message.scrollHeight); + } } // check for locally stored compose data @@ -3652,7 +3659,7 @@ function rcube_webmail() this.save_response = function() { // show dialog to enter a name and to modify the text to be saved - var buttons = {}, text = this.editor.get_content(true, true), + var buttons = {}, text = this.editor.get_content({selection: true, format: 'text', nosig: true}), html = '<form class="propform">' + '<div class="prop block"><label>' + this.get_label('responsename') + '</label>' + '<input type="text" name="name" id="ffresponsename" size="40" /></div>' + @@ -3840,7 +3847,7 @@ function rcube_webmail() if (val = $('[name="_' + hash_fields[i] + '"]').val()) str += val + ':'; - str += this.editor.get_content(); + str += this.editor.get_content({refresh: false}); if (this.env.attachments) for (id in this.env.attachments) diff --git a/program/js/editor.js b/program/js/editor.js index 0facfd948..3c10ad881 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -40,7 +40,7 @@ function rcube_text_editor(config, id) selector: '#' + ($('#' + id).is('.mce_editor') ? id : 'fake-editor-id'), theme: 'modern', language: config.lang, - content_css: 'program/js/tinymce/roundcube/content.css?v1', + content_css: 'program/js/tinymce/roundcube/content.css?v2', menubar: false, statusbar: false, toolbar_items_size: 'small', @@ -391,29 +391,33 @@ function rcube_text_editor(config, id) }; // get selected text (if no selection returns all text) from the editor - this.get_content = function(selected, plain) + this.get_content = function(args) { - // apply spellcheck changes if spell checker is active - this.spellcheck_stop(); + var sigstart, ed = this.editor, text = '', strip = false, + defaults = {refresh: true, selection: false, nosig: false, format: 'html'}; + + args = $.extend(defaults, args); - var sigstart, ed = this.editor, - format = plain ? 'text' : 'html', - text = '', strip = false; + // apply spellcheck changes if spell checker is active + if (args.refresh) { + this.spellcheck_stop(); + } // get selected text from tinymce editor if (ed) { ed.getWin().focus(); // correct focus in IE & Chrome - if (selected) - text = ed.selection.getContent({format: format}); + if (args.selection) + text = ed.selection.getContent({format: args.format}); if (!text) { - text = ed.getContent({format: format}); - strip = true; + text = ed.getContent({format: args.format}); + // @todo: strip signature in html mode + strip = args.format == 'text'; } } // get selected text from compose textarea else if (ed = rcube_find_object(this.id)) { - if (selected && $(ed).is(':focus')) { + if (args.selection && $(ed).is(':focus')) { text = rcmail.get_input_selection(ed).text; } @@ -424,7 +428,8 @@ function rcube_text_editor(config, id) } // strip off signature - if (strip) { + // @todo: make this optional + if (strip && args.nosig) { sigstart = text.indexOf('-- \n'); if (sigstart > 0) { text = text.substring(0, sigstart); diff --git a/program/js/googiespell.js b/program/js/googiespell.js index 707efd165..8c17508dd 100644 --- a/program/js/googiespell.js +++ b/program/js/googiespell.js @@ -312,7 +312,9 @@ this.prepare = function(ignore, no_indicator) this.ignore = ignore; this.hideLangWindow(); - if ($(this.text_area).val() == '' || ignore) { + var area = $(this.text_area); + + if (area.val() == '' || ignore) { if (!this.custom_no_spelling_error) this.flashNoSpellingErrorState(); else @@ -321,7 +323,7 @@ this.prepare = function(ignore, no_indicator) return; } - this.createEditLayer(this.text_area.offsetWidth, this.text_area.offsetHeight); + this.createEditLayer(area.width(), area.height()); this.createErrorWindow(); $('body').append(this.error_window); @@ -331,7 +333,7 @@ this.prepare = function(ignore, no_indicator) if (this.main_controller) $(this.spell_span).unbind('click'); - this.orginal_text = $(this.text_area).val(); + this.orginal_text = area.val(); }; this.parseResult = function(r_text) @@ -674,10 +676,10 @@ this.createEditLayer = function(width, height) { this.edit_layer = document.createElement('div'); $(this.edit_layer).addClass('googie_edit_layer').attr('id', 'googie_edit_layer') - .width('auto').height(height); + .width(width).height(height); if (this.text_area.nodeName.toLowerCase() != 'input' || $(this.text_area).val() == '') { - $(this.edit_layer).css('overflow', 'auto').height(height-4); + $(this.edit_layer).css('overflow', 'auto'); } else { $(this.edit_layer).css('overflow', 'hidden'); } diff --git a/program/js/tinymce/roundcube/content.css b/program/js/tinymce/roundcube/content.css index 67480ab77..0ad246ea0 100644 --- a/program/js/tinymce/roundcube/content.css +++ b/program/js/tinymce/roundcube/content.css @@ -7,9 +7,7 @@ body, td, pre { body { background-color: #FFFFFF; - margin-left: 4px; - margin-right: 4px; - margin-top: 2px; + margin: 4px; } div.pre { |