mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-23 20:32:14 +09:00
#1087 확장 컴포넌트 플러그인 개선
- richcombo에서 menubutton으로 변경 - 콘텐츠 영역에서 더블 클릭 시 컴포넌트의 element를 찾는 로직 개선 - 확장 컴포넌트의 아이콘 표시
This commit is contained in:
parent
c473c345bb
commit
bb4ecd14d2
1 changed files with 52 additions and 30 deletions
|
|
@ -3,52 +3,74 @@
|
|||
* @modifier XpressEngine <developers@xpressengine.com>
|
||||
*/
|
||||
CKEDITOR.plugins.add('xe_component', {
|
||||
requires: 'richcombo',
|
||||
requires: 'menubutton',
|
||||
icons: 'xe_component',
|
||||
|
||||
init: function(editor) {
|
||||
var config=editor.config;
|
||||
var items = {};
|
||||
|
||||
editor.addMenuGroup('xe_component');
|
||||
|
||||
var openSelectComponent = function() {
|
||||
window.editorPrevSrl = config.xe_editor_sequence;
|
||||
openComponent(this.name, config.xe_editor_sequence);
|
||||
};
|
||||
|
||||
for(var key in config.xe_component_arrays) {
|
||||
var component_name = key;
|
||||
var component_title = config.xe_component_arrays[key];
|
||||
|
||||
items[component_name] = {
|
||||
label: component_title,
|
||||
group: 'xe_component',
|
||||
icon : request_uri + 'modules/editor/components/' + component_name + '/component_icon.gif',
|
||||
onClick: openSelectComponent
|
||||
};
|
||||
}
|
||||
|
||||
editor.addMenuItems( items );
|
||||
|
||||
editor.ui.add('xe_component', CKEDITOR.UI_MENUBUTTON, {
|
||||
label: '추가 기능', // @TODO lang
|
||||
modes: {
|
||||
wysiwyg: 1
|
||||
},
|
||||
onMenu: function() {
|
||||
var active = {};
|
||||
|
||||
for(var p in items)
|
||||
{
|
||||
active[p] = CKEDITOR.TRISTATE_OFF;
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'doubleclick', function( evt ) {
|
||||
var element = evt.data.element;
|
||||
var editor_component = element.getAttribute('editor_component');
|
||||
window.editorPrevNode = element.$;
|
||||
|
||||
if(!editor_component && element.is('img')) {
|
||||
while(!editor_component && element) {
|
||||
editor_component = element.getAttribute('editor_component');
|
||||
if(editor_component) {
|
||||
window.editorPrevNode = element.$;
|
||||
} else {
|
||||
element = element.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
if(!editor_component && element && element.is('img')) {
|
||||
editor_component = 'image_link';
|
||||
}
|
||||
|
||||
if(editor_component)
|
||||
{
|
||||
if(editor_component) {
|
||||
evt.cancel();
|
||||
window.openComponent(editor_component, config.xe_editor_sequence);
|
||||
}
|
||||
});
|
||||
|
||||
editor.ui.addRichCombo('Xe_component', {
|
||||
label: '확장기능', // @TODO: lang
|
||||
title: 'Extension Components',
|
||||
panel: {
|
||||
css: [CKEDITOR.skin.getPath('editor')].concat(config.contentsCss),
|
||||
multiSelect: false
|
||||
},
|
||||
init: function(){
|
||||
this.startGroup('Extension Components');
|
||||
for(var key in config.xe_component_arrays){
|
||||
var component_name=key;
|
||||
var component_title=config.xe_component_arrays[key];
|
||||
this.add(component_name, component_title, component_title);
|
||||
}
|
||||
},
|
||||
onClick: function(value){
|
||||
if(typeof openComponent=='function'){
|
||||
if(config.xe_editor_sequence)
|
||||
{
|
||||
window.editorPrevSrl = config.xe_editor_sequence;
|
||||
openComponent(value, config.xe_editor_sequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue