numaxlab / nova-ckeditor5-classic

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

Decorators in link options not works #18

Closed oriolfg closed 3 years ago

oriolfg commented 4 years ago

Adding decorators to the link options, in the settings, no change is observed, it makes me think it is not working properly.

For example:

'options' => [
        'language' => 'en',
        'toolbar' => [
            'Link',
        ],
        'link' => [
            'decorators' => [
                'isExternal' => [
                    'mode' => 'manual',
                    'label' => 'Open in a new tab?',
                    'attributes' => [
                        'target' => '_blank',
                        'rel'=> 'noopener noreferrer'
                    ]
                ],
                'noFollow' => [
                    'mode' => 'manual',
                    'label' => 'No Follow',
                    'attributes' => [
                        'rel' => 'nofollow'
                    ]
                ]
            ]
        ],
    ]

Link functionality appears normal and "NoFollow" or "Open in a new tab" options are not displayed

Do I need to do any extra installation?

(I use the latest version of your package, on an installation with laravel 7 and new 3)

oriolfg commented 4 years ago

I managed to make it work, redoing the compiled webpack file "dist / js / field.js.

When redoing this file with the configuration file with the link plugin then it works.

Steps: 1 -Fork repo or create local copy and use it instead numaxlab repository 2 - Add link options and plugin to default configurations file

'options' => [
    'plugins' => ['Link'],
    'link' => [
        'decorators' => [
            'isExternal' => [
                'mode' => 'manual',
                'label' => 'Open in a new tab?',
                'attributes' => [
                    'target' => '_blank',
                    'rel'=> 'noopener noreferrer'
                ]
            ],
            'noFollow' => [
                'mode' => 'manual',
                'label' => 'No Follow',
                'attributes' => [
                    'rel' => 'nofollow'
                ]
            ]
        ]
    ],
    ...
]

3 - Create new field.js:

npm i
npm run dev
rm -rf node_modules

4 - Enjoy your ckeditor with link options working fine! But forgot about the original repository updates :(

oriolfg commented 4 years ago

You will probably need to resolve this in your repository for it to work properly

ablunier commented 3 years ago

Hi @oriolfg, thanks for your feedback. This wasn't working because the functionality was not included in the latest release. Now it is included in v1.1.2