Commit f1819d8d by Frédéric

Merge remote-tracking branch 'origin/master'

parents a5fd2429 f7df1f10
$( document ).ready(function() {
$('.filebrowser').each(function (index, value) {
$(this).click(function (e) {
var $that = $(this);
$.get('/bolt/directory/getdirectory/', function( data ) {
if(data.directoryName) {
var name = $that.attr('name');
$that.hide();
$that.parent().append('<div class="'+name+'"></div>');
var $tree = $('.'+name)
.on('loaded.jstree', function() {
var item = getItemFromPath($that.val(), data);
$tree.jstree('select_node', item.id);
})
.jstree(
{
'core' : {
'data' : data.directoryName
}
}
);
if (typeof CKEDITOR !== 'undefined') {
CKEDITOR.dtd.$removeEmpty['span'] = false;
}
jQuery(document).ready(function ($) {
var CKEDITORPluginExtras = false;
if (typeof(CKEDITOR) != 'undefined') {
//CKEDITOR.plugins.addExternal('fontawesome', '/extensions/mycompany/customckeditor/plugins/fontawesome/', 'plugin.js');
//CKEDITOR.plugins.addExternal('dialog', '/extensions/vendor/mycompany/customckeditor/plugins/dialog/', 'plugin.js');
CKEDITOR.plugins.addExternal('colordialog', '/extensions/vendor/mycompany/customckeditor/plugins/colordialog/', 'plugin.js');
CKEDITOR.on('instanceReady', function (event, instance) {
if (CKEDITORPluginExtras) {
return;
}
$(document).on('dblclick', '.'+name+' a',function (e) {
var node = $(e.target).closest("li");
var id = node[0].id;
var config = event.editor.config,
name;
var item = getItemFromId(id, data);
if(item.path) {
$that.val(item.path);
}
console.log('config', config);
$('.'+name).remove();
$that.show();
});
}
});
});
});
//config.extraPlugins = '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];
}
}
/*config.toolbar.push(
{ name: 'insert', items: [ 'FontAwesome' ] }
);*/
return item;
}
config.extraPlugins += (config.extraPlugins ? ',' : '') + 'widget,dialog,colordialog';
/**
* Get Item from Path
* @param path
* @param data
* @returns {{}}
*/
function getItemFromPath(path, data) {
var item = {};
for(var index in data.directoryName) {
if(data.directoryName[index].path == path) {
item = data.directoryName[index];
for (name in CKEDITOR.instances) {
if (CKEDITOR.instances.hasOwnProperty(name)) {
CKEDITOR.instances[name].destroy();
CKEDITOR.replace(name, config);
}
}
}
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