Bläddra i källkod

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 år sedan
förälder
incheckning
dfbf6948e2
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9 0
      packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js

+ 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 }`;
 		}