New: Can add more js when creating editor.

This commit is contained in:
Laurent Destailleur 2012-03-22 00:09:05 +01:00
parent e0a89592bf
commit 05ff0c7f0b

View File

@ -138,10 +138,11 @@ class DolEditor
* Output edit area inside the HTML stream. * Output edit area inside the HTML stream.
* Output depends on this->tool (fckeditor, ckeditor, texatrea, ...) * Output depends on this->tool (fckeditor, ckeditor, texatrea, ...)
* *
* @param int $noprint 1=Return HTML string instead of printing it to output * @param int $noprint 1=Return HTML string instead of printing it to output
* @param string $morejs Add more js. For example: "editor.on( \'saveSnapshot\', function(e) { alert(\'ee\'); });"
* @return void * @return void
*/ */
function Create($noprint=0) function Create($noprint=0,$morejs='')
{ {
global $conf; global $conf;
@ -172,7 +173,7 @@ class DolEditor
$out.= '<script type="text/javascript"> $out.= '<script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
/* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */ /* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
CKEDITOR.replace(\''.$this->htmlname.'\', editor=CKEDITOR.replace(\''.$this->htmlname.'\',
{ {
customConfig : \''.dol_buildpath('/theme/'.$conf->theme.'/ckeditor/config.js',1).'\', customConfig : \''.dol_buildpath('/theme/'.$conf->theme.'/ckeditor/config.js',1).'\',
toolbar: \''.$this->toolbarname.'\', toolbar: \''.$this->toolbarname.'\',
@ -218,9 +219,9 @@ class DolEditor
filebrowserImageWindowHeight : \'500\''; filebrowserImageWindowHeight : \'500\'';
} }
$out.= ' $out.= '
}); });';
$out.= $morejs;
}); $out.= '});
</script>'; </script>';
} }
} }