Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File Layout ane registrasiin :
- <?php
- $this->registerJsFile('/template/ckeditor/ckeditor.js', ['position' => \yii\web\View::POS_END]);
- $CKEditor = "
- if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
- CKEDITOR.tools.enableHtml5Elements( document );
- CKEDITOR.config.height = 150;
- CKEDITOR.config.width = 'auto';
- var initSample = ( function() {
- var wysiwygareaAvailable = isWysiwygareaAvailable(),
- isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
- return function() {
- var editorElement = CKEDITOR.document.getById( 'editor' );
- if ( wysiwygareaAvailable ) {
- CKEDITOR.replace( 'editor' );
- } else {
- editorElement.setAttribute( 'contenteditable', 'true' );
- CKEDITOR.inline( 'editor' );
- }
- };
- function isWysiwygareaAvailable() {
- if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
- return true;
- }
- return !!CKEDITOR.plugins.get( 'wysiwygarea' );
- }
- })();
- initSample();
- ";
- $this->registerJS($CKEditor);
- ?>
- Lalu di view ane panggil :
- <?= $form->field($model, 'description')->textArea(['autocomplete'=>'off', 'class'=>'form-control', 'id' => 'editor'])->label(false) ?>
Advertisement
Add Comment
Please, Sign In to add comment