numaxlab / nova-ckeditor5-classic

A Laravel Nova CKEditor5 Classic Field.
MIT License
39 stars 41 forks source link

Use a custom CKEditor build #6

Closed radwanic closed 5 years ago

radwanic commented 5 years ago

Hi, First I'd like to thank you for the great work you've done here.

The field is awesome, but the CLEditor build itself is missing lots of plugins.

I was able to use another custom build that has more plugins such as alignment. I also added a min-height to the editor's box, as well as the proper separators.

image

radwanic commented 5 years ago

Had to vcs, no longer a valid PR

arthurdotwork commented 4 years ago

Hi @radwanic, is it possible to made the PR again or to provide an installation procedure for your fork ?

Thanks.

radwanic commented 4 years ago

@arthureichelberger in your composer.json, add "radwanic/nova-ckeditor5-classic": "*" under require

"require": {
      ...
     "radwanic/nova-ckeditor5-classic": "*" 
}

And use this vcs under repositories

"repositories": [
    ...
   {
       "type": "vcs",
       "url": "https://github.com/radwanic/nova-ckeditor5-classic"
   }
]

Then you can use whatever options you need in your config file (ckeditor5Classic.php)... Here is mine...

<?php
return [
    'options' => [
        'language' => 'en',
        'toolbar' => [
            'Heading',
            '|',
            'Bold',
            'Italic',
            '|',
            'NumberedList',
            'BulletedList',
            'BlockQuote',
            '|',
            'Link',
            'MediaEmbed',
            'imageUpload',
            '|',
            'insertTable',
            'tableColumn',
            'tableRow',
            'mergeTableCells',
            '|',
            'alignment:left',
            'alignment:center',
            'alignment:right',
            '|',
            'Undo',
            'Redo',
        ],
        'table' => [
            'contentToolbar' => [
                'tableColumn',
                'tableRow',
                'mergeTableCells',
            ]
        ],
        'image' => [
            'toolbar' => [
                'imageTextAlternative', '|',
                'imageStyle:alignLeft',
                'imageStyle:full',
                'imageStyle:alignRight'
            ],
            'styles' => [
                // This option is equal to a situation where no style is applied.
                'full',
                // This represents an image aligned to the left.
                'alignLeft',
                // This represents an image aligned to the right.
                'alignRight',
            ]
        ],
        'heading' => [
            'options' => [
                ['model' => 'paragraph', 'title' => 'Paragraph', 'class' => 'ck-heading_paragraph'],
                ['model' => 'heading1', 'view' => 'h1', 'title' => 'Heading 1', 'class' => 'ck-heading_heading1'],
                ['model' => 'heading2', 'view' => 'h2', 'title' => 'Heading 2', 'class' => 'ck-heading_heading2'],
                ['model' => 'heading3', 'view' => 'h3', 'title' => 'Heading 3', 'class' => 'ck-heading_heading3'],
                ['model' => 'heading4', 'view' => 'h4', 'title' => 'Heading 4', 'class' => 'ck-heading_heading4'],
                ['model' => 'heading5', 'view' => 'h5', 'title' => 'Heading 5', 'class' => 'ck-heading_heading5'],
                ['model' => 'heading6', 'view' => 'h6', 'title' => 'Heading 6', 'class' => 'ck-heading_heading6'],
            ],
        ],
    ]

];
arthurdotwork commented 4 years ago

Thanks you, you're saving me a lot of time !