How to use the @ckeditor/ckeditor5-ui/src/bindings/clickoutsidehandler 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 centaur54dev / ckeditor5-math-preview / src / mathpreview_ui.js View on Github external
// Use the high priority because the math UI navigation is more important
			// than other feature's actions, e.g. list indentation.
			// https://github.com/ckeditor/ckeditor5-link/issues/146
			priority: 'high'
		} );

		// Close the panel on the Esc key press when the editable has focus and the balloon is visible.
		this.editor.keystrokes.set( 'Esc', ( data, cancel ) => {
			if ( this._isPopupVisible ) {
				this._hideUI();
				cancel();
			}
		} );

		// Close on click outside of balloon panel element.
		clickOutsideHandler( {
			emitter: this.popupView,
			activator: () => this._isPopupVisible,
			contextElements: [ this._balloon.view.element ],
			callback: () => this._hideUI()
		} );
}
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / formdialog.js View on Github external
this._form.keystrokes.set( 'Esc', ( data, cancel ) => {
      this._hideForm( true );
      cancel();
    } );

    // Reposition the balloon or hide the form if an intro src widget is no longer selected.
    this.listenTo( editingView, 'render', () => {
      if ( !isCustomWidgetSelected( 'form', editingView.selection ) ) {
        this._hideForm( true );
      } else if ( this._isVisible ) {
        repositionCustomContextualBalloon( 'form', editor );
      }
    }, { priority: 'low' } );

    // Close on click outside of balloon panel element.
    clickOutsideHandler( {
      emitter: this._form,
      activator: () => this._isVisible,
      contextElements: [ this._form.element ],
      callback: () => this._hideForm()
    } );
  }
github ckeditor / ckeditor5-image / src / imagetextalternative / imagetextalternativeui.js View on Github external
this._form.keystrokes.set( 'Esc', ( data, cancel ) => {
			this._hideForm( true );
			cancel();
		} );

		// Reposition the balloon or hide the form if an image widget is no longer selected.
		this.listenTo( editor.ui, 'update', () => {
			if ( !getSelectedImageWidget( viewDocument.selection ) ) {
				this._hideForm( true );
			} else if ( this._isVisible ) {
				repositionContextualBalloon( editor );
			}
		} );

		// Close on click outside of balloon panel element.
		clickOutsideHandler( {
			emitter: this._form,
			activator: () => this._isVisible,
			contextElements: [ this._balloon.view.element ],
			callback: () => this._hideForm()
		} );
	}
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / introsrcdialog.js View on Github external
this._form.keystrokes.set( 'Esc', ( data, cancel ) => {
      this._hideForm( true );
      cancel();
    } );

    // Reposition the balloon or hide the form if an intro src widget is no longer selected.
    this.listenTo( editingView, 'render', () => {
      if ( !isAcasiWidgetSelected( editingView.selection ) ) {
        this._hideForm( true );
      } else if ( this._isVisible ) {
        repositionContextualBalloon( editor );
      }
    }, { priority: 'low' } );

    // Close on click outside of balloon panel element.
    clickOutsideHandler( {
      emitter: this._form,
      activator: () => this._isVisible,
      contextElements: [ this._form.element ],
      callback: () => this._hideForm()
    } );
  }
github wwalc / ckeditor5-emoji / src / emoji.js View on Github external
// Use the high priority because the emoji UI navigation is more important
			// than other feature's actions, e.g. list indentation.
			// https://github.com/ckeditor/ckeditor5-link/issues/146
			priority: 'high'
		} );

		// Close the panel on the Esc key press when the editable has focus and the balloon is visible.
		this.editor.keystrokes.set( 'Esc', ( data, cancel ) => {
			if ( this._balloon.visibleView === this.formView ) {
				this._hidePanel();
				cancel();
			}
		} );

		// Close on click outside of balloon panel element.
		clickOutsideHandler( {
			emitter: this.formView,
			activator: () => this._balloon.hasView( this.formView ),
			contextElements: [ this._balloon.view.element ],
			callback: () => this._hidePanel()
		} );
	}