first commit
This commit is contained in:
BIN
libraries/ckeditor/plugins/cmsstaticcontainer/images/icon.png
Normal file
BIN
libraries/ckeditor/plugins/cmsstaticcontainer/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
101
libraries/ckeditor/plugins/cmsstaticcontainer/plugin.js
Normal file
101
libraries/ckeditor/plugins/cmsstaticcontainer/plugin.js
Normal file
@@ -0,0 +1,101 @@
|
||||
CKEDITOR.plugins.add( 'cmsstaticcontainer',
|
||||
{
|
||||
init: function( editor )
|
||||
{
|
||||
CKEDITOR.dialog.add( 'cmsStaticContainerDialog', function ( editor )
|
||||
{
|
||||
return {
|
||||
title : 'Dodaj zawartość statyczną do artykułu',
|
||||
minWidth : 400,
|
||||
minHeight : 200,
|
||||
resizable: CKEDITOR.DIALOG_RESIZE_NONE,
|
||||
contents :
|
||||
[
|
||||
{
|
||||
id : 'tab1',
|
||||
label : 'Kontener statyczny',
|
||||
elements :
|
||||
[
|
||||
{
|
||||
type : 'text',
|
||||
id : 'staticcontainer',
|
||||
label : 'Kontener statyczny:',
|
||||
validate : CKEDITOR.dialog.validate.notEmpty( "Kontener statyczny nie może być pusty." ),
|
||||
commit: function( element )
|
||||
{
|
||||
var staticcontainer = this.getValue();
|
||||
if ( staticcontainer )
|
||||
element.setText( staticcontainer );
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'button',
|
||||
hidden : true,
|
||||
id : 'id0',
|
||||
label : editor.lang.common.browseServer,
|
||||
filebrowser :
|
||||
{
|
||||
action : 'Browse',
|
||||
url: '/admin/scontainers/ckeditor_list/',
|
||||
onSelect : function( text )
|
||||
{
|
||||
var dialog = this.getDialog();
|
||||
dialog.getContentElement( 'tab1', 'staticcontainer' ).setValue( text );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
onShow: function()
|
||||
{
|
||||
var selection = editor.getSelection();
|
||||
var selector = selection.getStartElement();
|
||||
var element;
|
||||
|
||||
if ( selector ) {
|
||||
element = selector.getAscendant( 'p', true );
|
||||
}
|
||||
|
||||
if ( !element || element.getName() != 'p' )
|
||||
{
|
||||
element = editor.document.createElement( 'p' );
|
||||
if( selection ) {
|
||||
element.setText(selection.getSelectedText());
|
||||
}
|
||||
this.insertMode = true;
|
||||
}
|
||||
else {
|
||||
this.insertMode = false;
|
||||
}
|
||||
|
||||
this.element = element;
|
||||
|
||||
|
||||
this.setupContent(this.element);
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var dialog = this;
|
||||
var anchorElement = this.element;
|
||||
|
||||
this.commitContent(this.element);
|
||||
|
||||
if(this.insertMode) {
|
||||
editor.insertElement(this.element);
|
||||
}
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
editor.addCommand( 'cmsStaticContainerDialog',new CKEDITOR.dialogCommand( 'cmsStaticContainerDialog' ) );
|
||||
|
||||
editor.ui.addButton( 'cmsstaticcontainer',
|
||||
{
|
||||
label: 'Dodaj zawartość statyczną do artykułu',
|
||||
command: 'cmsStaticContainerDialog',
|
||||
icon: this.path + 'images/icon.png'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
Reference in New Issue
Block a user