Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CkEditor-Embed-Plugins
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bolt Extensions
CkEditor-Embed-Plugins
Commits
f7df1f10
Commit
f7df1f10
authored
Apr 10, 2019
by
Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ckeditor-plugins.js
parent
b2334288
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
65 deletions
+31
-65
ckeditor-plugins.js
web/js/ckeditor-plugins.js
+31
-65
No files found.
web/js/ckeditor-plugins.js
View file @
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
$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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment