How to use the @ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview.defaultPositions 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 / image / ui / imageballoonpanelview.js View on Github external
function testPanelAttach( spy ) {
		sinon.assert.calledOnce( spy );
		const options = spy.firstCall.args[ 0 ];

		// Check if proper target element was used.
		expect( options.target.tagName.toLowerCase() ).to.equal( 'figure' );

		// Check if correct positions are used.
		const [ north, south ] = options.positions;

		expect( north ).to.equal( BalloonPanelView.defaultPositions.northArrowSouth );
		expect( south ).to.equal( BalloonPanelView.defaultPositions.southArrowNorth );
	}
} );
github ckeditor / ckeditor5-image / tests / image / ui / utils.js View on Github external
it( 'returns the position data', () => {
			const defaultPositions = BalloonPanelView.defaultPositions;

			setData( editor.model, '[<img src="">]' );
			const data = getBalloonPositionData( editor );

			expect( data ).to.deep.equal( {
				target: editingView.domConverter.viewToDom( editingView.document.selection.getSelectedElement() ),
				positions: [
					defaultPositions.northArrowSouth,
					defaultPositions.northArrowSouthWest,
					defaultPositions.northArrowSouthEast,
					defaultPositions.southArrowNorth,
					defaultPositions.southArrowNorthWest,
					defaultPositions.southArrowNorthEast
				]
			} );
		} );
github ckeditor / ckeditor5-image / tests / image / ui / imageballoon.js View on Github external
it( 'uses default position configuration if not specified', () =&gt; {
			const spy = testUtils.sinon.stub( ContextualBalloon.prototype, 'add' );
			const positionData = {};

			setData( doc, '[<img src="">]' );

			plugin.add( positionData );
			sinon.assert.calledWithExactly( spy, {
				position: {
					target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
					positions: [
						BalloonPanelView.defaultPositions.northArrowSouth,
						BalloonPanelView.defaultPositions.southArrowNorth
					]
				}
			} );

			expect( positionData.position ).to.be.undefined;
		} );
github ckeditor / ckeditor5-image / tests / image / ui / utils.js View on Github external
it( 'should re-position the ContextualBalloon when the image is selected', () =&gt; {
			const spy = sinon.spy( balloon, 'updatePosition' );
			const defaultPositions = BalloonPanelView.defaultPositions;
			const view = new View();

			view.element = global.document.createElement( 'div' );

			balloon.add( {
				view,
				position: {
					target: global.document.body
				}
			} );

			setData( editor.model, '[<img src="">]' );
			repositionContextualBalloon( editor );

			sinon.assert.calledWithExactly( spy, {
				target: editingView.domConverter.viewToDom( editingView.document.selection.getSelectedElement() ),
github ckeditor / ckeditor5-image / tests / image / ui / imageballoon.js View on Github external
it( 'uses default position configuration if not specified', () =&gt; {
			const spy = testUtils.sinon.stub( ContextualBalloon.prototype, 'add' );
			const positionData = {};

			setData( doc, '[<img src="">]' );

			plugin.add( positionData );
			sinon.assert.calledWithExactly( spy, {
				position: {
					target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
					positions: [
						BalloonPanelView.defaultPositions.northArrowSouth,
						BalloonPanelView.defaultPositions.southArrowNorth
					]
				}
			} );

			expect( positionData.position ).to.be.undefined;
		} );
github ckeditor / ckeditor5-table / src / ui / utils.js View on Github external
export function getBalloonPositionData( editor ) {
	const editingView = editor.editing.view;
	const defaultPositions = BalloonPanelView.defaultPositions;
	const viewSelection = editingView.document.selection;

	const parentTable = findAncestor( 'table', viewSelection.getFirstPosition() );

	return {
		target: editingView.domConverter.viewToDom( parentTable ),
		positions: [
			defaultPositions.northArrowSouth,
			defaultPositions.northArrowSouthWest,
			defaultPositions.northArrowSouthEast,
			defaultPositions.southArrowNorth,
			defaultPositions.southArrowNorthWest,
			defaultPositions.southArrowNorthEast
		]
	};
}
github ckeditor / ckeditor5-image / src / image / ui / utils.js View on Github external
export function getBalloonPositionData( editor ) {
	const editingView = editor.editing.view;
	const defaultPositions = BalloonPanelView.defaultPositions;

	return {
		target: editingView.domConverter.viewToDom( editingView.document.selection.getSelectedElement() ),
		positions: [
			defaultPositions.northArrowSouth,
			defaultPositions.northArrowSouthWest,
			defaultPositions.northArrowSouthEast,
			defaultPositions.southArrowNorth,
			defaultPositions.southArrowNorthWest,
			defaultPositions.southArrowNorthEast
		]
	};
}
github ckeditor / ckeditor5-image / src / image / ui / imageballoonpanelview.js View on Github external
_attach() {
		const editingView = this.editor.editing.view;
		const defaultPositions = BalloonPanelView.defaultPositions;

		this.attachTo( {
			target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
			positions: [ defaultPositions.northArrowSouth, defaultPositions.southArrowNorth ]
		} );
	}
}
github Tangerine-Community / Tangerine / client / ckeditor / plugins / ckeditor5-acasi / src / utils.js View on Github external
export function getBalloonPositionData( editor ) {
  const editingView = editor.editing.view;
  const defaultPositions = BalloonPanelView.defaultPositions;

  return {
    target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
    positions: [
      defaultPositions.northArrowSouth,
      defaultPositions.southArrowNorth
    ]
  };
}
github ckeditor / ckeditor5-image / src / image / ui / imageballoon.js View on Github external
_getBalloonPositionData() {
		const editingView = this.editor.editing.view;
		const defaultPositions = BalloonPanelView.defaultPositions;

		return {
			target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
			positions: [
				defaultPositions.northArrowSouth,
				defaultPositions.southArrowNorth
			]
		};
	}
}