| 1 |
<?php |
| 2 |
class Element_CKEditor extends Element_Textarea { |
| 3 |
protected $basic; |
| 4 |
|
| 5 |
function renderJS() { |
| 6 |
echo 'CKEDITOR.replace("', $this->attributes["id"], '"'; |
| 7 |
if(!empty($this->basic)) |
| 8 |
echo ', { toolbar: "Basic" }'; |
| 9 |
echo ');'; |
| 10 |
|
| 11 |
$ajax = $this->form->getAjax(); |
| 12 |
$id = $this->form->getID(); |
| 13 |
if(!empty($ajax)) { |
| 14 |
echo <<<JS |
| 15 |
jQuery("#$id").bind("submit", function() { |
| 16 |
CKEDITOR.instances["{$this->attributes["id"]}"].updateElement(); |
| 17 |
}); |
| 18 |
JS; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
function getJSFiles() { |
| 23 |
return array( |
| 24 |
$this->form->getResourcesPath() . "/ckeditor/ckeditor.js" |
| 25 |
); |
| 26 |
} |
| 27 |
} |
| 28 |
|