Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.editor.ui.componentFactory.add( 'fake_button', locale => {
const view = new ButtonView( locale );
view.set( {
label: 'fake button'
} );
return view;
} );
}
_createButton( label, eventName ) {
const button = new ButtonView( this.locale );
button.label = label;
button.withText = true;
if ( eventName ) {
button.delegate( 'execute' ).to( this, eventName );
}
return button;
}
editor.ui.componentFactory.add( componentName, locale => {
const command = editor.commands.get( 'imageStyle' );
const view = new ButtonView( locale );
view.set( {
label: style.title,
icon: style.icon,
tooltip: true,
isToggleable: true
} );
view.bind( 'isEnabled' ).to( command, 'isEnabled' );
view.bind( 'isOn' ).to( command, 'value', value => value === style.name );
this.listenTo( view, 'execute', () => editor.execute( 'imageStyle', { value: style.name } ) );
return view;
} );
}
_createButton( label, eventName ) {
const button = new ButtonView( this.locale );
button.label = label;
button.withText = true;
if ( eventName ) {
button.delegate( 'execute' ).to( this, eventName );
}
return button;
}
componentFactory.add( 'borderStyle', locale => {
const button = new ButtonView( locale );
button.set( {
label: 'Border style',
icon: false,
tooltip: true,
withText: true
} );
button.on( 'execute', () => {
const firstPosition = selection.getFirstPosition();
const tableCell = findAncestor( 'tableCell', firstPosition );
const border = tableCell.getAttribute( 'border' );
let currentStyle;
editor.ui.componentFactory.add( 'introSrcDialog', locale => {
const view = new ButtonView( locale );
view.set( {
label: t( 'Change ACASI widget settings' ),
icon: textAlternativeIcon,
tooltip: true
} );
view.bind( 'isEnabled' ).to( command, 'isEnabled' );
this.listenTo( view, 'execute', () => this._showForm() );
return view;
} );
}
this.editor.ui.componentFactory.add('externalLink', (locale) => {
const button = new ButtonView(locale);
button.bind('isEnabled').to(
this.editor.commands.get('internalLink'),
'buttonEnabled',
this.editor.commands.get('externalLink'),
'buttonEnabled',
(internalLinkEnabled, externalLinkEnabled) => internalLinkEnabled && externalLinkEnabled
);
button.set({icon: linkIcon});
button.on('execute', action(() => {
this.selection = this.editor.model.document.selection;
this.open = true;
this.target = DEFAULT_TARGET;
this.title = undefined;
_createButton( label, icon, className, eventName ) {
const button = new ButtonView( this.locale );
button.set( {
label,
icon,
tooltip: true
} );
button.extendTemplate( {
attributes: {
class: className
}
} );
if ( eventName ) {
button.delegate( 'execute' ).to( this, eventName );
}