Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMirror implementation for source #167

Open
NickGoodwind opened this issue May 26, 2022 · 0 comments
Open

CodeMirror implementation for source #167

NickGoodwind opened this issue May 26, 2022 · 0 comments

Comments

@NickGoodwind
Copy link

Hi, I've been trying to add Codemirror to the widget by implementing the instruction provided both on Imperavi website and Redactor Manual v10 but to no avail.

This is the code included in the widget:

<?= $form->field($model, 'description')->widget(Widget::class, [ 'settings' => [ 'codemirror' => true ] ])

This is the result obtained:

Screen.Recording.2022-05-26.at.6.29.28.PM.mov

No changes to the editor at all, not even a new textArea or similar.

This are my files
View:

/* @var $this yii\web\View */
/* @var $model $this->module->productClass */
/* @var $form yii\widgets\ActiveForm */

CodemirrorAsset::register($this);

$form = ActiveForm::begin([
  "id" => "product-form",
]); ?>
	
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'description')->widget(Widget::class, [
	'settings' => [
		'codemirror' => true
	]
]) ?>

CodemirrorAsset:

/**
 * Codemirror asset bundle.
 *
 * @author NickGoodwind <nickgoodwind@gmail.com>
 */
class CodemirrorAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    
    public $js = [
        'js/codemirror/codemirror.js',
        'js/codemirror/mode/htmlmixed/htmlmixed.js',
    ];

    public $css = [
        'css/codemirror.css'
    ];

    public $depends = [
        'app\modules\admin\assets\AdminAppAsset'
    ];
}

By reviewing further into the extension code, it seems that no new CodeMirror editor instance is created anywhere inside the redactor.js file. Are there some missing steps I am not looking?

@NickGoodwind NickGoodwind changed the title Codemirror implementation for source CodeMirror implementation for source May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant