Sha256: f14939530e8869c80e6e462d68aeb0d829eab772749f8f533d05c23273c711c2
Contents?: true
Size: 1.93 KB
Versions: 11
Compression:
Stored size: 1.93 KB
Contents
<% self.class.include RailsAdminImageManager::Engine.routes.url_helpers %> window.addQueryString = function ( url, params ) { var queryString = []; if (!params) return url; else { for (var i in params) queryString.push(i + "=" + encodeURIComponent( params[i])); } return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" ); } if (!CKEDITOR.plugins.get( 'imageManager')) { CKEDITOR.plugins.add( 'imageManager', { init: function( editor ) { var openManager = function(ele){ var params = {}; if (ele != null && ele.$.getAttribute('data-image-id')) { params.selectImage = ele.$.getAttribute('data-image-id'); } params.CKEditor = editor.name; params.CKEditorFuncNum = editor._.insertImagefn; var url = addQueryString('<%= image_manager_index_path %>', params); editor.popup(url, 1105, 500); } editor._.insertImagefn = CKEDITOR.tools.addFunction(function(src, id, title){ this.insertHtml('<img src="' + src + '" data-image-id="' + id + '" alt="'+title+'" />'); }, editor); editor.ui.addButton( 'imageManager', { label: 'Ajouter une image', command: 'insertManagerImage', icon: "<%= asset_path 'rails_admin_image_manager/image.png' %>" }); editor.on( 'doubleclick', function(evt) { var element = evt.data.element; if (element.is('img') && !element.data('cke-realelement') && !element.isReadOnly()) { editor.execCommand('insertManagerImage'); } evt.preventDefault(); }); editor.addCommand( 'insertManagerImage', { exec: function(editor) { var sel = editor.getSelection(); openManager(sel.getSelectedElement()) } }); } }); // CKEDITOR.plugins.contextMenu.removeAll() CKEDITOR.config.removePlugins = 'liststyle,tabletools,contextmenu'; CKEDITOR.config.extraPlugins = 'imageManager'; }
Version data entries
11 entries across 11 versions & 1 rubygems