Sha256: e599eabb324371f41b300b98b961c3a08e56227f409eb195c95674135d6cfcab
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
/* * rmce_uploadr app main javascript * * should be loaded after tiny_mce.js and jquery.js */ // when DOM is loaded $(function(){ // we're looking mainly for images that have data-src-original attribute set $("[data-src-original]").click(function(){ var editor = tinyMCEPopup.editor; // Fixes crash in Safari if (tinymce.isWebKit) { editor.getWin().focus(); } // TODO: add widht, height and other stuff var imgParams = { src: uploadrCdnHost + $(this).attr('data-src-original') }; // get original selection, an image already inserted in the editor's main area var original = editor.selection.getNode(); // check if that's really an image and replace it with the new one if (original && original.nodeName == 'IMG') { editor.dom.setAttribs(original, imgParams); // otherwise just insert a new image } else { editor.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1}); editor.dom.setAttribs('__mce_tmp', imgParams); editor.dom.setAttrib('__mce_tmp', 'id', ''); editor.undoManager.add(); } // close ourselves, i.e. the popup tinyMCEPopup.close(); }); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rmce_uploadr-0.0.3 | lib/rmce_uploadr/public/javascripts/rmce_uploadr.js |