8
0
Просмотр исходного кода

Fix: Clicking a type around button in a caption-less image widget should insert a paragraph instead of displaying a caption.

Aleksander Nowodzinski 5 лет назад
Родитель
Сommit
c9176357df

+ 4 - 1
packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js

@@ -169,7 +169,7 @@ export default class WidgetTypeAround extends Plugin {
 		const editor = this.editor;
 		const editingView = editor.editing.view;
 
-		editingView.document.on( 'click', ( evt, domEventData ) => {
+		editingView.document.on( 'mousedown', ( evt, domEventData ) => {
 			const button = getClosestTypeAroundDomButton( domEventData.domTarget );
 
 			if ( !button ) {
@@ -197,6 +197,9 @@ export default class WidgetTypeAround extends Plugin {
 
 			editingView.focus();
 			editingView.scrollToTheSelection();
+
+			domEventData.preventDefault();
+			evt.stop();
 		} );
 	}
 }