Commit f1819d8d by Frédéric

Merge remote-tracking branch 'origin/master'

parents a5fd2429 f7df1f10
$( 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 CKEDITORPluginExtras = false;
var $that = $(this); if (typeof(CKEDITOR) != 'undefined') {
$.get('/bolt/directory/getdirectory/', function( data ) { //CKEDITOR.plugins.addExternal('fontawesome', '/extensions/mycompany/customckeditor/plugins/fontawesome/', 'plugin.js');
if(data.directoryName) { //CKEDITOR.plugins.addExternal('dialog', '/extensions/vendor/mycompany/customckeditor/plugins/dialog/', 'plugin.js');
var name = $that.attr('name'); CKEDITOR.plugins.addExternal('colordialog', '/extensions/vendor/mycompany/customckeditor/plugins/colordialog/', 'plugin.js');
$that.hide();
$that.parent().append('<div class="'+name+'"></div>'); CKEDITOR.on('instanceReady', function (event, instance) {
var $tree = $('.'+name) if (CKEDITORPluginExtras) {
.on('loaded.jstree', function() { return;
var item = getItemFromPath($that.val(), data);
$tree.jstree('select_node', item.id);
})
.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) { //config.extraPlugins = 'fontawesome';
$that.val(item.path);
}
$('.'+name).remove(); /*config.toolbar.push(
$that.show(); { name: 'insert', items: [ 'FontAwesome' ] }
}); );*/
}
});
});
});
/**
* Get Item from ID
* @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