Skip to content
Code-Schnipsel Gruppen Projekte
Commit 5753c97c erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

new editor class api

Übergeordneter 312bac64
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
@CHARSET "UTF-8"; @CHARSET "UTF-8";
.cke_dialog_contents .qui-button { .control-editor,
background: none repeat scroll 0 0 #EDEDED; .control-editor-container {
border: medium none;
border-radius: 3px;
box-shadow: 0 0 2px #999999;
color: #606060;
cursor: pointer;
float: left; float: left;
line-height: 30px; height: 100%;
margin: 0 5px; width: 100%;
padding: 0 10px;
position: relative;
transition: all 0.2s ease 0s;
} }
.cke_dialog_contents .qui-button-active, .control-editor-container {
.cke_dialog_contents .qui-button:active, overflow: hidden;
.cke_dialog_contents .qui-button:hover {
background: #0069B4;
color: #FFFFFF;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
} }
.cke_dialog_contents .qui-button:hover span { /*.cke_dialog_contents .qui-button {*/
color: #FFFFFF; /*background: none repeat scroll 0 0 #EDEDED;*/
} /*border: medium none;*/
/*border-radius: 3px;*/
/*box-shadow: 0 0 2px #999999;*/
/*color: #606060;*/
/*cursor: pointer;*/
/*float: left;*/
/*line-height: 30px;*/
/*margin: 0 5px;*/
/*padding: 0 10px;*/
/*position: relative;*/
/*transition: all 0.2s ease 0s;*/
/*}*/
.cke_dialog_contents [class^="icon-"], /*.cke_dialog_contents .qui-button-active,*/
.cke_dialog_contents [class*=" icon-"] { /*.cke_dialog_contents .qui-button:active,*/
font-family: FontAwesome; /*.cke_dialog_contents .qui-button:hover {*/
font-style: normal; /*background: #0069B4;*/
font-weight: normal; /*color: #FFFFFF;*/
text-decoration: inherit;
} /*box-shadow: none;*/
/*-moz-box-shadow: none;*/
/*-webkit-box-shadow: none;*/
/*}*/
/*.cke_dialog_contents .qui-button:hover span {*/
/*color: #FFFFFF;*/
/*}*/
/*.cke_dialog_contents [class^="icon-"],*/
/*.cke_dialog_contents [class*=" icon-"] {*/
/*font-family: FontAwesome;*/
/*font-style: normal;*/
/*font-weight: normal;*/
/*text-decoration: inherit;*/
/*}*/
...@@ -33,13 +33,14 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -33,13 +33,14 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
Type : 'package/quiqqer/ckeditor4/bin/Editor', Type : 'package/quiqqer/ckeditor4/bin/Editor',
Binds : [ Binds : [
'$onDestroy', '$onLoad',
'$onDraw', '$onDestroy',
'$onSetContent', '$onSetContent',
'$onGetContent', '$onGetContent',
'$onDrop', '$onDrop',
'$onAddCSS', '$onResize',
'$onInstanceReadyListener' '$onAddCSS',
'$onInstanceReadyListener'
], ],
initialize : function(Manager, options) initialize : function(Manager, options)
...@@ -49,8 +50,9 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -49,8 +50,9 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
this.$cssFiles = {}; this.$cssFiles = {};
this.addEvents({ this.addEvents({
onLoad : this.$onLoad,
onResize : this.$onResize,
onDestroy : this.$onDestroy, onDestroy : this.$onDestroy,
onDraw : this.$onDraw,
onSetContent : this.$onSetContent, onSetContent : this.$onSetContent,
onGetContent : this.$onGetContent, onGetContent : this.$onGetContent,
onDrop : this.$onDrop, onDrop : this.$onDrop,
...@@ -58,45 +60,63 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -58,45 +60,63 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
}); });
}, },
/**
* Editor onLoad Event
* if the editor is to be drawn and inserted
*
* @param {Object} data - Editor data
*/
$onLoad : function(data)
{
var self = this;
// load CKEDITOR
require([ URL_OPT_DIR +'bin/package-ckeditor4/ckeditor.js' ], function()
{
window.CKEDITOR.on('instanceReady', self.$onInstanceReadyListener );
self.$loadInstance( data );
});
},
/** /**
* Load the CKEditor Instance into an Textarea or DOMNode Element * Load the CKEditor Instance into an Textarea or DOMNode Element
* *
* @param {HTMLElement} Container * @param {Object} data - Editor settings data
* @param {Object} Editor - controls/editors/Editor
*/ */
loadInstance : function(Container, Editor) $loadInstance : function(data)
{ {
if ( typeof window.CKEDITOR === 'undefined' ) { if ( typeof window.CKEDITOR === 'undefined' ) {
return; return;
} }
var self = this, var self = this,
Instance = Container; Container = this.getContainer(),
Textarea = false,
size = Container.getSize();
if ( !Container.getElement( 'textarea' ) ) if ( !Container.getElement( 'textarea' ) )
{ {
var size = Container.getSize(); Textarea = new Element('textarea', {
Instance = new Element('textarea', {
id : this.getId(), id : this.getId(),
styles : { styles : {
height : size.y, height : size.y,
width : size.x - 20 width : size.x
} }
}).inject( Container ); }).inject( Container );
} }
if ( Instance.nodeName != 'TEXTAREA' ) { if ( !Textarea ) {
Instance = Instance.getElement( 'textarea' ); Textarea = Container.getElement( 'textarea' );
} }
var instance = Instance.get( 'id' ); var instance = Textarea.get( 'id' );
if ( window.CKEDITOR.instances[ instance ] ) { if ( window.CKEDITOR.instances[ instance ] ) {
window.CKEDITOR.instances[ instance ].destroy( true ); window.CKEDITOR.instances[ instance ].destroy( true );
} }
Editor.setAttribute( 'instancename', instance ); self.setAttribute( 'instancename', instance );
// http://docs.ckeditor.com/#!/guide/dev_howtos_dialog_windows // http://docs.ckeditor.com/#!/guide/dev_howtos_dialog_windows
window.CKEDITOR.on( 'dialogDefinition', function( ev ) window.CKEDITOR.on( 'dialogDefinition', function( ev )
...@@ -105,77 +125,93 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -105,77 +125,93 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
self.$linkDialog( ev ); self.$linkDialog( ev );
}); });
this.getButtons(function(buttons)
{
// parse the buttons for the ckeditor
var b, g, i, len, blen, glen, group, items,
buttonEntry, lineEntry, groupEntry;
var lines = buttons.lines || [], // parse the buttons for the ckeditor
toolbar = []; var b, g, i, len, blen, glen, group, items,
buttonEntry, lineEntry, groupEntry;
var buttons = data.toolbar,
lines = buttons.lines || [],
toolbar = [];
for ( i = 0, len = lines.length; i < len; i++ ) for ( i = 0, len = lines.length; i < len; i++ )
{
items = [];
lineEntry = lines[ i ];
// groups
for ( g = 0, glen = lineEntry.length; g < glen; g++ )
{ {
items = []; group = [];
lineEntry = lines[ i ]; groupEntry = lineEntry[ g ];
// groups // buttons
for ( g = 0, glen = lineEntry.length; g < glen; g++ ) for ( b = 0, blen = groupEntry.length; b < blen; b++ )
{ {
group = []; buttonEntry = groupEntry[ b ];
groupEntry = lineEntry[ g ];
// buttons if ( buttonEntry.type == 'seperator' )
for ( b = 0, blen = groupEntry.length; b < blen; b++ )
{ {
buttonEntry = groupEntry[ b ]; group.push( '-' );
continue;
if ( buttonEntry.type == 'seperator' )
{
group.push( '-' );
continue;
}
group.push( buttonEntry.button );
} }
toolbar.push( group ); group.push( buttonEntry.button );
} }
toolbar.push( '/' ); toolbar.push( group );
} }
var height = Instance.getSize().y - 140, toolbar.push( '/' );
width = Instance.getSize().x + 20; }
if ( self.getAttribute( 'width' ) ) { var height = size.y,
width = self.getAttribute( 'width' ); width = size.x;
}
if ( self.getAttribute( 'height' ) ) { if ( self.getAttribute( 'width' ) ) {
height = self.getAttribute( 'height' ) - 140; width = self.getAttribute( 'width' );
} }
if ( self.getAttribute( 'height' ) ) {
height = self.getAttribute( 'height' );
}
var zIndex = QUIElements.getComputedZIndex( Container ); var zIndex = QUIElements.getComputedZIndex( Container );
window.CKEDITOR.replace(instance, { // parse styles to fckedit styles
language : Locale.getCurrent(), var entry, styles = [];
baseHref : URL_DIR,
basePath : URL_DIR,
height : height,
width : width,
toolbar : toolbar,
allowedContent : true, for ( i = 0, len = data.styles.length; i < len; i++ )
extraAllowedContent : 'div(*)[*]{*}, iframe(*)[*]{*}', {
entry = data.styles[ i ];
contentsCss : Object.keys( self.$cssFiles ), styles.push({
bodyClass : self.getAttribute( 'bodyClass' ), name : entry.text,
// plugins : CKEDITOR_NEXGAM_PLUGINS, element : entry.element,
// templates_files : [URL_OPT_DIR +'base/bin/pcsgEditorPlugins/templates.php'], attributes : entry.attributes
baseFloatZIndex : zIndex
}); });
}
window.CKEDITOR.replace(instance, {
language : Locale.getCurrent(),
baseHref : URL_DIR,
basePath : URL_DIR,
height : height,
width : width,
toolbar : toolbar,
allowedContent : true,
extraAllowedContent : 'div(*)[*]{*}, iframe(*)[*]{*}',
stylesSet : styles,
contentsCss : data.cssFiles,
bodyClass : data.bodyClass,
// plugins : CKEDITOR_NEXGAM_PLUGINS,
// templates_files : [URL_OPT_DIR +'base/bin/pcsgEditorPlugins/templates.php'],
baseFloatZIndex : zIndex
//extraPlugins : 'panel,button,menu,floatpanel,menubutton,htmlbuttons'
}); });
}, },
/** /**
...@@ -201,66 +237,13 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -201,66 +237,13 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
delete window.CKEDITOR.instances[ Instance.name ]; delete window.CKEDITOR.instances[ Instance.name ];
window.CKEDITOR.removeListener( 'instanceReady', this.$onInstanceReadyListener ); window.CKEDITOR.removeListener(
'instanceReady',
this.$onInstanceReadyListener
);
} }
}, },
/**
* Editor onDraw Event
* if the editor is to be drawn
*
* @param {HTMLElement} Container
* @param {Object} Editor - controls/editors/Editor
*/
$onDraw : function(Container, Editor)
{
var self = this;
// load CKEDITOR
require([ URL_OPT_DIR +'bin/package-ckeditor4/ckeditor.js' ], function()
{
/*
CKEDITOR.editorConfig = function( config ) {
config.language = 'fr';
config.uiColor = '#AADC6E';
};
*/
// CKEditor aufbauen
// CKEDITOR_BASEPATH = URL_DIR;
/*
CKEDITOR_NEXGAM_TOOLBAR = [
{ name: 'clipboard', items : [ 'Source', ,'Maximize', '-','pcsg_short', 'Templates','-', 'Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'basicstyles', items : [ 'Bold','Italic', 'Underline', 'Strike','-','Subscript','Superscript','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList' ] },
{ name: 'pcsg', items : [ 'pcsg_image','-', 'pcsg_link', 'pcsg_unlink' ] },
{ name: 'blocks', items : [ 'Format', 'pcsg_youtube' ] }
];
CKEDITOR_NEXGAM_PLUGINS = '' +
'basicstyles,blockquote,button,clipboard,contextmenu,div,elementspath,enterkey,entities,find,' +
'font,format,indent,justify,keystrokes,list,liststyle,maximize,pastefromword,' +
'pastetext,removeformat,showblocks,showborders,sourcearea,stylescombo,' +
'table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc,pcsg_image,pcsg_link,pcsg_short,pcsg_youtube';
CKEDITOR_NEXGAM_CSS = [
URL_USR_DIR +"bin/nexgam3/css/reset.css",
URL_USR_DIR +"bin/nexgam3/css/style.css",
URL_USR_DIR +"bin/nexgam3/css/wysiwyg.css",
URL_USR_DIR +"bin/nexgam3/css/images.css",
URL_USR_DIR +"bin/nexgam3/css/review.css"
];
CKEDITOR_NEXGAM_BODY_CLASS = 'content left content-inner-container wysiwyg';
*/
window.CKEDITOR.on('instanceReady', self.$onInstanceReadyListener );
Editor.loadInstance( Container, Editor );
});
},
/** /**
* event : instance ready * event : instance ready
* @param instance * @param instance
...@@ -274,12 +257,31 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ ...@@ -274,12 +257,31 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
return; return;
} }
// resize the editor
var Container = this.getContainer(),
containerSize = Container.getSize();
// fckeditor resize, setHeight is sooooooooooo mysterious
instance.editor.resize( containerSize.x, containerSize.y );
this.setInstance( instance.editor ); this.setInstance( instance.editor );
this.fireEvent( 'loaded', [ this, instance.editor ] ); this.fireEvent( 'loaded', [ this, instance.editor ] );
instance.editor.focus(); instance.editor.focus();
}, },
/**
* event : on resize
*/
$onResize : function()
{
var Container = this.getContainer(),
Instance = this.getInstance(),
containerSize = Container.getSize();
Instance.resize( containerSize.x, containerSize.y );
},
/** /**
* Editor onSetContent Event * Editor onSetContent Event
* *
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren