Thomas Bruederli
2014-06-16 23c00eee86f1a1af9fa74bc9daf30c8d33ba33f0
program/js/editor.js
@@ -40,7 +40,7 @@
      selector: '#' + ($('#' + id).is('.mce_editor') ? id : 'fake-editor-id'),
      theme: 'modern',
      language: config.lang,
      content_css: config.skin_path + '/editor_content.css?v2',
      content_css: 'program/js/tinymce/roundcube/content.css?v1',
      menubar: false,
      statusbar: false,
      toolbar_items_size: 'small',
@@ -84,7 +84,7 @@
      accessibility_focus: false,
      file_browser_callback: function(name, url, type, win) { ref.file_browser_callback(name, url, type); },
      // @todo: support more than image (types: file, image, media)
      file_browser_callback_types: 'image'
      file_browser_callback_types: 'image media'
    });
  }
@@ -165,6 +165,24 @@
        node.tabIndex = textarea.tabIndex;
      if (focus)
        this.editor.getBody().focus();
      // find :prev and :next elements to get focus when tabbing away
      if (textarea.tabIndex > 0) {
        var x = null,
          editor = this.editor,
          tabfocus_elements = [':prev',':next'],
          el = tinymce.DOM.select('*[tabindex='+textarea.tabIndex+']:not(iframe)');
        tinymce.each(el, function(e, i) { if (e.id == editor.id) { x = i; return false; } });
        if (x !== null) {
          if (el[x-1] && el[x-1].id) {
            tabfocus_elements[0] = el[x-1].id;
          }
          if (el[x+1] && el[x+1].id) {
            tabfocus_elements[1] = el[x+1].id;
          }
          editor.settings.tabfocus_elements = tabfocus_elements.join(',');
        }
      }
    }
  };
@@ -582,9 +600,25 @@
      return;
    }
    if (file.mimetype.startsWith('image/')) {
    var rx, img_src;
    switch (rcmail.env.file_browser_type) {
      case 'image':
        rx = /^image\//i;
        break;
      case 'media':
        rx = /^video\//i;
        img_src = 'program/js/tinymce/roundcube/video.png';
        break;
      default:
        return;
    }
    if (rx.test(file.mimetype)) {
      var href = rcmail.env.comm_path+'&_id='+rcmail.env.compose_id+'&_action=display-attachment&_file='+file_id,
        img = $('<img>').attr({title: file.name, src: href + '&_thumbnail=1'});
        img = $('<img>').attr({title: file.name, src: img_src ? img_src : href + '&_thumbnail=1'});
      return $('<li>').data('url', href)
        .append($('<span class="img">').append(img))