How to use the @ckeditor/ckeditor5-ui/src/button/buttonview function in @ckeditor/ckeditor5-ui

To help you get started, we’ve selected a few @ckeditor/ckeditor5-ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-image / tests / imagetoolbar.js View on Github external
this.editor.ui.componentFactory.add( 'fake_button', locale => {
				const view = new ButtonView( locale );

				view.set( {
					label: 'fake button'
				} );

				return view;
			} );
		}
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / introsrcdialog / ui / introsrcdialogformview.js View on Github external
_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;
  }
github ckeditor / ckeditor5-image / src / imagestyle / imagestyleui.js View on Github external
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;
		} );
	}
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / formdialog / ui / formdialogformview.js View on Github external
_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;
  }
github ckeditor / ckeditor5-table / src / tablestyleui.js View on Github external
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;
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / introsrcdialog.js View on Github external
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;
    } );
  }
github sulu / sulu / src / Sulu / Bundle / AdminBundle / Resources / js / containers / CKEditor5 / plugins / ExternalLinkPlugin / ExternalLinkPlugin.js View on Github external
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;
github ckeditor / ckeditor5-media-embed / src / ui / mediaformview.js View on Github external
_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 );
		}