1. Go to this page and download the library: Download kartik-v/yii2-editors library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kartik-v / yii2-editors example snippets
// on your view layout file
use kartik\icons\FontAwesomeAsset;
FontAwesomeAsset::register($this);
use kartik\editors\Summernote;
// Usage with ActiveForm and model and default settings
echo $form->field($model, 'content')->widget(Summernote::class, [
'options' => ['placeholder' => 'Edit your blog content here...']
]);
// With model & without ActiveForm and default settings
echo Summernote::widget([
'model' => $model,
'attribute' => 'html_content',
]);
// Without model and setting advanced custom widget configuration options
echo Summernote::widget([
'name' => 'blog_post',
'value' => '',
'useKrajeeStyle' => true,
'useKrajeePresets' => true,
'enableFullScreen' => true,
'enableCodeView' => false,
'enableHelp' => false,
'enableHintEmojis' => true,
'hintMentions' => ['jayden', 'sam', 'alvin', 'david']
]);
use kartik\editors\Codemirror;
// Usage with ActiveForm and model and default settings
echo $form->field($model, 'program_code')->widget(Codemirror::class, [
'preset' => Codemirror::PRESET_PHP,
'options' => ['placeholder' => 'Edit your code here...']
]);
// With model & without ActiveForm and default settings
echo Codemirror::widget([
'model' => $model,
'attribute' => 'json_code',
'preset' => Codemirror::PRESET_JSON,
]);
// Without model and setting advanced custom widget configuration options
echo Codemirror::widget([
'name' => 'js_code',
'value' => '',
'preset' => Codemirror::PRESET_JS,
'useKrajeePresets' => true,
'libraries' => [
'addon/display/placeholder.js',
'addon/fold/xml-fold.js',
'addon/edit/matchbrackets.js',
'addon/edit/matchtags.js',
'addon/selection/active-line.js',
'addon/selection/selection-pointer.js',
],
'pluginOptions' => [
'modes' => ['xml', 'javascript', 'css'],
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.