2amigos / yii2-ckeditor-widget

CKEditor WYSIWYG widget for Yii2.
https://2amigos.us/open-source/ckeditor-widget
Other
172 stars 112 forks source link

Add CDN Support and improve README #73

Closed CyberPunkCodes closed 7 years ago

CyberPunkCodes commented 8 years ago

This projects seems to be partially abandoned. However, it's worth a shot.

There should be a CDN option. Whether you have to specify the version number in the config, or specify the CDN root URL that includes the version number.

You could do: https://cdnjs.com/libraries/ckeditor Then have them also specify the version: 4.5.10

or

Just have them specify the CDN root URL: https://cdnjs.com/libraries/ckeditor/4.5.10


For the non-CDN use (using assets as it currently does), a "use CDN for smilies" option would be nice. In the Advanced template, if you have the editor in the backend for admin use, the frontend uses the backend's assets directory because it stores it's current path (backend) for the smiley in the db. Revealing the path to your admin area is bad security practice. While not everyone uses the advanced for this, most DO use the backend for admin purposes.


Additionally, some basic usage help should be added to the README. It took a bit of research, and trial and error, to get this set up. You provide 0 setup other than simply how to install the plugin.

Here is my current widget:

$ckToolbarTemplate = [
    ['name' => 'document', 'groups' => ['mode', 'document', 'doctools']],
    ['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
    ['name' => 'editing', 'groups' => [ 'find', 'selection', 'spellchecker', 'editing']],
    ['name' => 'basicstyles', 'groups' => ['basicstyles', 'colors','cleanup']],
    '/',
    ['name' => 'paragraph', 'groups' => [ 'list', 'indent', 'blocks', 'align' ]],
    ['name' => 'links'],
    ['name' => 'insert'],
    '/',
    ['name' => 'styles'],
    ['name' => 'colors'],
    ['name' => 'tools'],
    ['name' => 'others'],
];

$ckRemoveButtons = 'NewPage,Flash,Iframe,SpecialChar';

<?= $form->field($model, 'text')->widget(CKEditor::className(), [
    'options' => ['rows' => 6],
    'preset' => 'custom',
    'clientOptions' => [
        'toolbarGroups' => $ckToolbarTemplate,
        'removeButtons' => $ckRemoveButtons,
        'smiley_path' => '//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.10/plugins/smiley/images/'
    ]
]) ?>

You didn't show how to change the preset (basic, standard, full, custom), or that the clientOptions even exists, how to modify the toolbar items, handle smileys, or image/file uploads.

I still want to remove my large array and make it a config file to load, but I don't know if it is possible with your extension. For preset, I saw in the code that it includes the corresponding file. ie: basic includes the basic.php config. However, if preset is custom, it sets it to null.

jeesus commented 7 years ago

This extension needs an update in general. Could include new skins and require the original source directly via composer. Is there going to be any update soon or is this project abandoned (as you can tell from comments)?

tonydspaniard commented 7 years ago

@jeesus the problem is that the original repo with composer is not installing the full version. Nevertheless, I am fully open for PRs.

tonydspaniard commented 7 years ago

@jeesus all fully updated

jeesus commented 7 years ago

@tonydspaniard I still cannot use Full version of the editor. As before, only updated through composer. Currently using version 2.0.1.