Commit f7df1f10 by Simon

Update ckeditor-plugins.js

parent b2334288
$( document ).ready(function() { if (typeof CKEDITOR !== 'undefined') {
$('.filebrowser').each(function (index, value) { CKEDITOR.dtd.$removeEmpty['span'] = false;
$(this).click(function (e) { }
jQuery(document).ready(function ($) {
var $that = $(this); var CKEDITORPluginExtras = false;
$.get('/bolt/directory/getdirectory/', function( data ) {
if(data.directoryName) { if (typeof(CKEDITOR) != 'undefined') {
var name = $that.attr('name'); //CKEDITOR.plugins.addExternal('fontawesome', '/extensions/mycompany/customckeditor/plugins/fontawesome/', 'plugin.js');
$that.hide(); //CKEDITOR.plugins.addExternal('dialog', '/extensions/vendor/mycompany/customckeditor/plugins/dialog/', 'plugin.js');
$that.parent().append('<div class="'+name+'"></div>'); CKEDITOR.plugins.addExternal('colordialog', '/extensions/vendor/mycompany/customckeditor/plugins/colordialog/', 'plugin.js');
var $tree = $('.'+name)
.on('loaded.jstree', function() { CKEDITOR.on('instanceReady', function (event, instance) {
var item = getItemFromPath($that.val(), data); if (CKEDITORPluginExtras) {
$tree.jstree('select_node', item.id); return;
}) }
.jstree(
{
'core' : {
'data' : data.directoryName
}
}
);
$(document).on('dblclick', '.'+name+' a',function (e) { var config = event.editor.config,
var node = $(e.target).closest("li"); name;
var id = node[0].id;
var item = getItemFromId(id, data); console.log('config', config);
if(item.path) {
$that.val(item.path);
}
$('.'+name).remove(); //config.extraPlugins = 'fontawesome';
$that.show();
});
}
});
});
});
/** /*config.toolbar.push(
* Get Item from ID { name: 'insert', items: [ 'FontAwesome' ] }
* @param id );*/
* @param data
* @returns {{}}
*/
function getItemFromId(id, data) {
var item = {};
for(var index in data.directoryName) {
if(data.directoryName[index].id == id) {
item = data.directoryName[index];
}
}
return item; config.extraPlugins += (config.extraPlugins ? ',' : '') + 'widget,dialog,colordialog';
}
/** for (name in CKEDITOR.instances) {
* Get Item from Path if (CKEDITOR.instances.hasOwnProperty(name)) {
* @param path CKEDITOR.instances[name].destroy();
* @param data CKEDITOR.replace(name, config);
* @returns {{}} }
*/
function getItemFromPath(path, data) {
var item = {};
for(var index in data.directoryName) {
if(data.directoryName[index].path == path) {
item = data.directoryName[index];
} }
}
return item; CKEDITORPluginExtras = true;
});
} }
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment