8
0
فهرست منبع

Internal: Hide the widget toolbar during resize to improve the performance.

See https://github.com/ckeditor/ckeditor5-widget/pull/112#issuecomment-564528765.
Marek Lewandowski 6 سال پیش
والد
کامیت
7d0bf5696a
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      packages/ckeditor5-widget/src/widgetresize.js

+ 14 - 0
packages/ckeditor5-widget/src/widgetresize.js

@@ -135,9 +135,23 @@ export default class WidgetResize extends Plugin {
 	 */
 	 */
 	attachTo( options ) {
 	attachTo( options ) {
 		const resizer = new Resizer( options );
 		const resizer = new Resizer( options );
+		const widgetToolbarRepository = this.editor.plugins.get( 'WidgetToolbarRepository' );
 
 
 		resizer.attach();
 		resizer.attach();
 
 
+		// Hiding widget toolbar to improve the performance (https://github.com/ckeditor/ckeditor5-widget/pull/112#issuecomment-564528765).
+		resizer.on( 'begin', () => {
+			widgetToolbarRepository.forceDisabled( 'resize' );
+		} );
+
+		resizer.on( 'cancel', () => {
+			widgetToolbarRepository.clearForceDisabled( 'resize' );
+		} );
+
+		resizer.on( 'commit', () => {
+			widgetToolbarRepository.clearForceDisabled( 'resize' );
+		} );
+
 		this._resizers.set( options.viewElement, resizer );
 		this._resizers.set( options.viewElement, resizer );
 
 
 		return resizer;
 		return resizer;