8
0
Piotrek Koszuliński 6 лет назад
Родитель
Сommit
ec2f423f50

+ 0 - 24
packages/ckeditor5-widget/src/utils.js

@@ -9,7 +9,6 @@
 
 
 import HighlightStack from './highlightstack';
 import HighlightStack from './highlightstack';
 import IconView from '@ckeditor/ckeditor5-ui/src/icon/iconview';
 import IconView from '@ckeditor/ckeditor5-ui/src/icon/iconview';
-import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect';
 import env from '@ckeditor/ckeditor5-utils/src/env';
 import env from '@ckeditor/ckeditor5-utils/src/env';
 
 
 import dragHandlerIcon from '../theme/icons/drag-handler.svg';
 import dragHandlerIcon from '../theme/icons/drag-handler.svg';
@@ -349,29 +348,6 @@ export function viewToModelPositionOutsideModelElement( model, viewElementMatche
 	};
 	};
 }
 }
 
 
-/**
- * Returns coordinates of top-left corner of a element, relative to the document's top-left corner.
- *
- * @param {HTMLElement} element
- * @param {String} resizerPosition Position of the resize handler, e.g. `"top-left"`, `"bottom-right"`.
- * @returns {Object} return
- * @returns {Number} return.x
- * @returns {Number} return.y
- */
-export function getAbsoluteBoundaryPoint( element, resizerPosition ) {
-	const elementRect = new Rect( element );
-	const positionParts = resizerPosition.split( '-' );
-	const ret = {
-		x: positionParts[ 1 ] == 'right' ? elementRect.right : elementRect.left,
-		y: positionParts[ 0 ] == 'bottom' ? elementRect.bottom : elementRect.top
-	};
-
-	ret.x += element.ownerDocument.defaultView.scrollX;
-	ret.y += element.ownerDocument.defaultView.scrollY;
-
-	return ret;
-}
-
 // Default filler offset function applied to all widget elements.
 // Default filler offset function applied to all widget elements.
 //
 //
 // @returns {null}
 // @returns {null}

+ 1 - 1
packages/ckeditor5-widget/src/widgetresizer.js

@@ -8,7 +8,7 @@
  */
  */
 
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import Resizer from './resizer';
+import Resizer from './widgetresizer/resizer';
 import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
 import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import { throttle } from 'lodash-es';
 import { throttle } from 'lodash-es';

+ 3 - 2
packages/ckeditor5-widget/src/resizer.js → packages/ckeditor5-widget/src/widgetresizer/resizer.js

@@ -4,7 +4,7 @@
  */
  */
 
 
 /**
 /**
- * @module widget/resizer
+ * @module widget/widgetresizer/resizer
  */
  */
 
 
 import View from '@ckeditor/ckeditor5-ui/src/view';
 import View from '@ckeditor/ckeditor5-ui/src/view';
@@ -13,7 +13,8 @@ import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect';
 
 
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
-import ResizeState from './resizestate';
+
+import ResizeState from './resizerstate';
 
 
 /**
 /**
  * Stores the internal state of a single resizable object.
  * Stores the internal state of a single resizable object.

+ 29 - 8
packages/ckeditor5-widget/src/resizestate.js → packages/ckeditor5-widget/src/widgetresizer/resizerstate.js

@@ -4,11 +4,9 @@
  */
  */
 
 
 /**
 /**
- * @module widget/resizer
+ * @module widget/widgetresizer/resizerstate
  */
  */
-import {
-	getAbsoluteBoundaryPoint
-} from './utils';
+
 import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect';
 import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect';
 
 
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
@@ -109,7 +107,6 @@ export default class ResizeState {
 	/**
 	/**
 	 * Method used to calculate the proposed size as the resize handles are dragged.
 	 * Method used to calculate the proposed size as the resize handles are dragged.
 	 *
 	 *
-	 * @private
 	 * @param {Event} domEventData Event data that caused the size update request. It should be used to calculate the proposed size.
 	 * @param {Event} domEventData Event data that caused the size update request. It should be used to calculate the proposed size.
 	 * @returns {Object} return
 	 * @returns {Object} return
 	 * @returns {Number} return.x Proposed width.
 	 * @returns {Number} return.x Proposed width.
@@ -175,10 +172,36 @@ export default class ResizeState {
 	}
 	}
 }
 }
 
 
+mix( ResizeState, ObservableMixin );
+
+/**
+ * Returns coordinates of top-left corner of a element, relative to the document's top-left corner.
+ *
+ * @private
+ * @param {HTMLElement} element
+ * @param {String} resizerPosition Position of the resize handler, e.g. `"top-left"`, `"bottom-right"`.
+ * @returns {Object} return
+ * @returns {Number} return.x
+ * @returns {Number} return.y
+ */
+function getAbsoluteBoundaryPoint( element, resizerPosition ) {
+	const elementRect = new Rect( element );
+	const positionParts = resizerPosition.split( '-' );
+	const ret = {
+		x: positionParts[ 1 ] == 'right' ? elementRect.right : elementRect.left,
+		y: positionParts[ 0 ] == 'bottom' ? elementRect.bottom : elementRect.top
+	};
+
+	ret.x += element.ownerDocument.defaultView.scrollX;
+	ret.y += element.ownerDocument.defaultView.scrollY;
+
+	return ret;
+}
+
 /**
 /**
+ * @private
  * @param {String} resizerPosition Expected resizer position like `"top-left"`, `"bottom-right"`.
  * @param {String} resizerPosition Expected resizer position like `"top-left"`, `"bottom-right"`.
  * @returns {String} A prefixed HTML class name for the resizer element
  * @returns {String} A prefixed HTML class name for the resizer element
- * @private
  */
  */
 function getResizerClass( resizerPosition ) {
 function getResizerClass( resizerPosition ) {
 	return `ck-widget__resizer-${ resizerPosition }`;
 	return `ck-widget__resizer-${ resizerPosition }`;
@@ -223,5 +246,3 @@ function extractCoordinates( event ) {
 		y: event.pageY
 		y: event.pageY
 	};
 	};
 }
 }
-
-mix( ResizeState, ObservableMixin );