/** * ckeditor Lite WYSIWYG Editor - display the editor * * @param string The name of the editor area * @param string The content of the field * @param string The name of the form field * @param string The width of the editor area * @param string The height of the editor area * @param int The number of columns for the editor area * @param int The number of rows for the editor area * @param mixed Can be boolean or array. */ function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null) { // Load modal popup behavior JHTML::_('behavior.modal', 'a.modal-button'); // initialise $error varable $errors = ''; static $loaded; if (empty($id)) { $id = $name; } if (!$width) { $width = "100%"; } if (!$height) { $height = "350px"; } $skin = $this->params->get('skin'); if ($skin == 'kama' && $width == '100%') { $width = '99%'; } $arributes = array("rows" => $row, 'cols' => $col, "style" => "width:{$width};height:{$height}"); if (!$loaded) { /* Generate the Output */ $this->params->set('editorname', $id); if (!$this->params->get('hheight', '')) { $this->params->set('hheight', $height); } if (!$this->params->get('wwidth', '')) { $this->params->set('wwidth', $width); } $javascript = JCKJavascriptHelper::getHeadJavascript($this->params, $errors, $return_script); $javascript->addToHead(); $loaded = JCKOutput::fixId($id); if (!$return_script) { return; } //Here we will use JFCKJavascript output to screen //html element as well jckimport('ckeditor.htmlwriter.helper'); return $errors . JCKHtmlwriterHelper::EditorTextArea($id, $name, $content, $buttons, $this, $arributes, $asset, $author); } //end if return JCKHtmlwriter::TextArea($id, $name, $content, $arributes) . '<script>window.addDomReadyEvent.add( function(){ CKEDITOR.on("instanceReady",function(evt) { if(evt.editor.name == "' . $loaded . '") { var editor = CKEDITOR.replace( "' . JCKOutput::fixId($id) . '", CKEDITOR.instances["' . $loaded . '"].config ); var xtdbuttons = CKEDITOR.document.getById("editor-xtd-buttons"); if(xtdbuttons) { buttonsHtml = xtdbuttons.getOuterHtml().replace(/' . $loaded . '/g,"' . JCKOutput::fixId($id) . '"); var buttonsElement = CKEDITOR.dom.element.createFromHtml(buttonsHtml); editor.container.getParent().append(buttonsElement); var elements = buttonsElement.getElementsByTag("a"); for(i= 0; i < elements.count();i++) { //override mootools model click event if(elements.getItem(i).hasClass("modal-button")) { (function() { var el = $(elements.getItem(i).$); el.addEvent("click", function(e) { new Event(e).stop(); SqueezeBox.fromElement(el, { parse: "rel" }); }); })(); } } } } }) });</script>'; }