Selaa lähdekoodia

Remove the fake horizontal caret as soon as the editor is blurred. The regular caret disappears and so should the fake one.

Aleksander Nowodzinski 5 vuotta sitten
vanhempi
sitoutus
dfbf6948e2

+ 9 - 0
packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js

@@ -254,6 +254,15 @@ export default class WidgetTypeAround extends Plugin {
 			}
 		}, { priority: 'highest' } );
 
+		this.listenTo( editor.ui.focusTracker, 'change:isFocused', ( evt, name, isFocused ) => {
+			if ( !isFocused ) {
+				editor.model.change( writer => {
+					// TODO: use data.directChange to not break collaboration?
+					writer.removeSelectionAttribute( TYPE_AROUND_SELECTION_ATTRIBUTE );
+				} );
+			}
+		} );
+
 		function positionToWidgetCssClass( position ) {
 			return `ck-widget_type-around_active_${ position }`;
 		}