JSFiddle - React, Tailwind, and code Playground
JavaScript
CKEDITOR.plugins.add( 'hero',
{
icons: 'hero',
requires : ['richcombo'], //, 'styles' ],
init : function( editor )
{
editor.addCommand( 'abbrDialog', new CKEDITOR.dialogCommand( 'abbrDialog' ) );
editor.ui.addButton( 'Hero',
{
label: 'Выбрать героя',
command: 'abbrDialog',
} );
CKEDITOR.dialog.add( 'abbrDialog', function ( editor )
{
tenant_fields[0]=["Sniper", "2"];
tenant_fields[1]=["Windranger", "3"];
tenant_fields[2]=["Invoker", "4"];
return {
title : 'Выбор героя',
minWidth : 400,
minHeight : 200,
contents :
[
{
id : 'tab1',
label : 'Tenants',
elements :
[
{
id : 'tenant_dropdown',
type : 'select',
label : 'Выбери героя.',
'default':'',
items: tenant_fields
}
]
}
],
onOk : function()
{
var dialog = this;
var abbr = editor.document.createElement( 'span' );
abbr.setText( dialog.getValueOf( 'tab1', 'tenant_dropdown' ) );
editor.insertElement( abbr );
}
};
} );
...