bizley / yii2-quill

Yii 2 implementation of Quill, modern WYSIWYG editor
Apache License 2.0
62 stars 15 forks source link

Quill cannot import module smart-breaker #22

Closed nguyen-mse closed 4 years ago

nguyen-mse commented 4 years ago

Hi, I have installed both the Quill editor and the smart break module as per instruction (using composer.json). The Quill editor works fine. When I try to use the Smart-breaker module, I have an error state that Quill cannot import module/smart-breaker (see attached image) Quill-smart-breaker-error Below is the code for Quill

echo $form->field($model, 'description')->widget(Quill::class, [
            'config' => ['localAssetss' => TRUE,],
            'options' => ['style' => 'height:220px', ],
            'modules' => [
                'formula' => TRUE, 
                'smart-breaker' => TRUE,
            ],
            'toolbarOptions' => [
                [['header' => [1, 2, 3, 4, FALSE]]],
                ['bold', 'italic', 'underline', 'strike'],
                ['link'],
                [['list' => 'bullet'], ['list' => 'ordered']],
                [['indent' => '-1'], ['indent' => '+1']],
                ['formula'],
            ],
        ])

If I comment out the line 'smart-breaker' => TRUE, then it works fine. I check and the smart-break files were install at vendor/npm-asset/quill-smart-break

Note that the vendor files are shared among many projects, hence, located outside the project directory. We used quite a number of Yii extensions without any issue.

I have googled for this issue but couldn't find anyone report similar issue.

Thanks, D

bizley commented 4 years ago

There is no config option. Maybe you are confusing it with configuration? Although if you would use configuration here you must also set modules there instead of using modules key. So best option for you is to set it like:

echo $form->field($model, 'description')->widget(Quill::class, [
        'localAssets' => true,
        'options' => ['style' => 'height:220px', ],
        'modules' => [
            'formula' => true, 
            'smart-breaker' => true,
        ],
        'toolbarOptions' => [
            [['header' => [1, 2, 3, 4, false]]],
            ['bold', 'italic', 'underline', 'strike'],
            ['link'],
            [['list' => 'bullet'], ['list' => 'ordered']],
            [['indent' => '-1'], ['indent' => '+1']],
            ['formula'],
        ],
    ])

Remember that with localAssets you need to add in your composer.json:

"npm-asset/quill": "^1.3",
"npm-asset/katex": "^0.11",
"npm-asset/quill-smart-break": ">=0.1.1 <1.0.0"
nguyen-mse commented 4 years ago

Thanks Bizley for a prompt response. I'm new to NPM package management and using local assets. I also miss the "npm-asset/quill": "^1.3" from my composer.json.

It all works fine now. Thanks again.

bizley commented 4 years ago

Great! Thanks for using my package and more important for caring enough to report an issue (valid or not) :+1:

nguyen-mse commented 4 years ago

Actually, we should thank you for put out the effort to develop something useful for the community to use.

It isn’t that the package has any issue, it’s more that I don’t know how to set it up properly.

From: Bizley notifications@github.com Sent: Saturday, 1 August 2020 18:06 To: bizley/yii2-quill yii2-quill@noreply.github.com Cc: David Nguyen nguyen@unimelb.edu.au; Author author@noreply.github.com Subject: Re: [bizley/yii2-quill] Quill cannot import module smart-breaker (#22)

Great! Thanks for using my package and more important for caring enough to report an issue (valid or not) 👍

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/bizley/yii2-quill/issues/22#issuecomment-667492411, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGIS2KX3A5FF2UYJFD7X4IDR6PEHPANCNFSM4PPK7R5A.