Generates control's HTML element.
public getControl ( ) : Nette\Utils\Html | ||
Résultat | Nette\Utils\Html |
/** * @return \Nette\Utils\Html */ public function getControl() { $control = parent::getControl(); $control->class[] = 'editor-input ckeditor'; $control->data('novalidate', ''); return $control; }
/** * Generates control"s HTML element. * @return Html */ public function getControl() { $container = Html::el(); $container->add(parent::getControl()->style("width: 100%;")); $script = Html::el(); if ($this->type == 'min') { $script->setHtml('<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> <script type="text/javascript"> CKEDITOR.replace( "' . $this->getHtmlId() . '", { toolbar : [ { name: "clipboard", items : [ "Cut","Copy","PasteText","-","Undo","Redo" ] }, { name: "basicstyles", items : [ "Bold","Italic","-","RemoveFormat" ] } , { name: "document", items : [ "Source" ] }, ], filebrowserBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Connector=/ckeditor/filemanager/connectors/php/connector.php", filebrowserImageBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=/ckeditor/filemanager/connectors/php/connector.php", filebrowserFlashBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=/ckeditor/filemanager/connectors/php/connector.php" }); </script> '); } else { $script->setHtml('<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> <script type="text/javascript"> CKEDITOR.replace( "' . $this->getHtmlId() . '", { toolbar : [ { name: "clipboard", items : [ "Cut","Copy","PasteText","-","Undo","Redo" ] }, { name: "basicstyles", items : [ "Bold","Italic","Strike","Subscript","Superscript","-","RemoveFormat" ] } , { name: "insert", items : [ "Image","Youtube","Table","HorizontalRule" ] }, { name: "styles", items : [ "Styles","Format","Font","FontSize","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyRight" ] }, { name: "paragraph", items : [ "NumberedList","BulletedList","-","Outdent","Indent","-","Blockquote" ] }, { name: "links", items : [ "Link","Unlink","Anchor" ] }, { name: "colors", items : [ "TextColor","BGColor" ] }, { name: "document", items : [ "Source" ] }, ], filebrowserBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Connector=/ckeditor/filemanager/connectors/php/connector.php", filebrowserImageBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=/ckeditor/filemanager/connectors/php/connector.php", filebrowserFlashBrowseUrl : "/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=/ckeditor/filemanager/connectors/php/connector.php", extraAllowedContent: "a span" }); </script> '); } $container->add($script); return $container; }
/** * @return \Nette\Utils\Html */ public function getControl() { $control = parent::getControl(); $control->appendAttribute('class', ['editor-input', 'ckeditor']); return $control; }