|
|
@@ -165,34 +165,6 @@ export default class WidgetTypeAround extends Plugin {
|
|
|
}, { priority: 'low' } );
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Registers a `mousedown` listener for the view document which intercepts events
|
|
|
- * coming from the type around UI, which happens when a user clicks one of the buttons
|
|
|
- * that insert a paragraph next to a widget.
|
|
|
- *
|
|
|
- * @private
|
|
|
- */
|
|
|
- _enableInsertingParagraphsOnButtonClick() {
|
|
|
- const editor = this.editor;
|
|
|
- const editingView = editor.editing.view;
|
|
|
-
|
|
|
- editingView.document.on( 'mousedown', ( evt, domEventData ) => {
|
|
|
- const button = getClosestTypeAroundDomButton( domEventData.domTarget );
|
|
|
-
|
|
|
- if ( !button ) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const buttonPosition = getTypeAroundButtonPosition( button );
|
|
|
- const widgetViewElement = getClosestWidgetViewElement( button, editingView.domConverter );
|
|
|
-
|
|
|
- this._insertParagraph( widgetViewElement, buttonPosition );
|
|
|
-
|
|
|
- domEventData.preventDefault();
|
|
|
- evt.stop();
|
|
|
- } );
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Brings support for the "fake caret" that appears when either:
|
|
|
*
|
|
|
@@ -407,6 +379,34 @@ export default class WidgetTypeAround extends Plugin {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Registers a `mousedown` listener for the view document which intercepts events
|
|
|
+ * coming from the type around UI, which happens when a user clicks one of the buttons
|
|
|
+ * that insert a paragraph next to a widget.
|
|
|
+ *
|
|
|
+ * @private
|
|
|
+ */
|
|
|
+ _enableInsertingParagraphsOnButtonClick() {
|
|
|
+ const editor = this.editor;
|
|
|
+ const editingView = editor.editing.view;
|
|
|
+
|
|
|
+ editingView.document.on( 'mousedown', ( evt, domEventData ) => {
|
|
|
+ const button = getClosestTypeAroundDomButton( domEventData.domTarget );
|
|
|
+
|
|
|
+ if ( !button ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const buttonPosition = getTypeAroundButtonPosition( button );
|
|
|
+ const widgetViewElement = getClosestWidgetViewElement( button, editingView.domConverter );
|
|
|
+
|
|
|
+ this._insertParagraph( widgetViewElement, buttonPosition );
|
|
|
+
|
|
|
+ domEventData.preventDefault();
|
|
|
+ evt.stop();
|
|
|
+ } );
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Creates the "enter" key listener on the view document that allows the user to insert a paragraph
|
|
|
* near the widget when either:
|