Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ckeditor - Add title tag to link using Decorators

How can I add an input where a user can add the specific title tag to a link in the ckeditor5? So for example my config file looks like this...

const config = {
toolbar: {
    items: [
        'bold',
        'italic', 
        'link',
        '|',
        'bulletedList',
        'numberedList',
        '|',
        'heading',
        '|',
        'undo',
        'redo'
    ]
},
link: {
    addTargetToExternalLinks: true,
    decorators: {
        openInNewTab: {
            mode: 'manual',
            label: 'Open in a new tab',
            defaultValue: true, 
            attributes: {
                target: '_blank',
                rel: 'noopener noreferrer'
            }
        }, title: {
            mode: 'manual',
            label: 'Set a title',
            defaultValue: ''
        }
    }
}
}

But I want to add a decorator that is like...

addTitleTag: {
            mode: 'manual',
            label: 'Add a title tag',
            defaultValue: '',           // Here the user have an input to add a title text
            attributes: {
                title: 'value'
            }
        }

But instead of a checkbox, it's text input. Is this possible?

like image 755
JohiOakey Avatar asked Dec 28 '25 19:12

JohiOakey


1 Answers

Unfortunately, this can't be achieved using decorators and is not supported by any means by the original plugin you have to modify the plugin in order to do so. I had the same need and modified the plugin.

like image 86
Alireza Avatar answered Dec 30 '25 22:12

Alireza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!