浏览代码

Docs: Enhanced BalloonPanelView#keepAttachedTo() docs.

Aleksander Nowodzinski 8 年之前
父节点
当前提交
e1cef3b9f2

+ 7 - 3
packages/ckeditor5-ui/src/panel/balloon/balloonpanelview.js

@@ -161,9 +161,13 @@ export default class BalloonPanelView extends View {
 	}
 
 	/**
-	 * Works exactly the same as {module:ui/panel/balloon/balloonpanelview~BalloonPanelView.attachTo} with one exception.
-	 * Position of attached panel is constantly updated when any of parents of the target or limiter elements are scrolled
-	 * or when browser window is resized. Thanks to this panel always sticks to the target element.
+	 * Works the same way as {module:ui/panel/balloon/balloonpanelview~BalloonPanelView.attachTo}
+	 * except that the position of the panel is continuously updated when any ancestor of the
+	 * {@link module:utils/dom/position~Options#target} or {@link module:utils/dom/position~Options#limiter}
+	 * is being scrolled or when the browser window is being resized.
+	 *
+	 * Thanks to this, the panel always sticks to the {@link module:utils/dom/position~Options#target}.
+	 *
 	 * See https://github.com/ckeditor/ckeditor5-ui/issues/170.
 	 *
 	 * @param {module:utils/dom/position~Options} options Positioning options compatible with

+ 4 - 4
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -424,7 +424,7 @@ describe( 'BalloonPanelView', () => {
 			notRelatedElement.remove();
 		} );
 
-		it( 'should attach balloon to the target constantly when any of the related element is scrolled', () => {
+		it( 'should keep the balloon attached to the target when any of the related elements is scrolled', () => {
 			view.keepAttachedTo( { target, limiter } );
 
 			expect( attachToSpy.calledOnce ).to.true;
@@ -447,7 +447,7 @@ describe( 'BalloonPanelView', () => {
 			expect( attachToSpy.lastCall.args[ 0 ] ).to.deep.equal( { target, limiter } );
 		} );
 
-		it( 'should attach balloon to the target constantly when browser window is resized', () => {
+		it( 'should keep the balloon attached to the target when the browser window is being resized', () => {
 			view.keepAttachedTo( { target, limiter } );
 
 			expect( attachToSpy.calledOnce ).to.true;
@@ -473,7 +473,7 @@ describe( 'BalloonPanelView', () => {
 			expect( attachToSpy.calledOnce ).to.true;
 		} );
 
-		it( 'should stop attaching when the view will be destroyed', () => {
+		it( 'should stop attaching once the view is destroyed', () => {
 			view.keepAttachedTo( { target, limiter } );
 
 			expect( attachToSpy.calledOnce ).to.true;
@@ -487,7 +487,7 @@ describe( 'BalloonPanelView', () => {
 			expect( attachToSpy.calledOnce ).to.true;
 		} );
 
-		it( 'should set default limiter as document.body', () => {
+		it( 'should set document.body as the default limiter', () => {
 			view.keepAttachedTo( { target } );
 
 			expect( attachToSpy.calledOnce ).to.true;