ソースを参照

Added converter resetting fake mark when converting from model to view.

Szymon Kupś 9 年 前
コミット
b0610b7559

+ 8 - 0
packages/ckeditor5-engine/src/conversion/model-selection-to-view-converters.js

@@ -209,3 +209,11 @@ export function clearAttributes() {
 		conversionApi.viewSelection.removeAllRanges();
 	};
 }
+
+/**
+ * Function factory, creates a converter that clears fake selection marking after the previous
+ * {@link engine.model.Selection model selection} conversion.
+ */
+export function clearFakeSelection() {
+	return ( evt, data, consumable, conversionApi ) => conversionApi.viewSelection.setFake( false );
+}

+ 3 - 1
packages/ckeditor5-engine/src/editingcontroller.js

@@ -11,7 +11,8 @@ import { convertSelectionChange } from './conversion/view-selection-to-model-con
 import {
 	convertRangeSelection,
 	convertCollapsedSelection,
-	clearAttributes
+	clearAttributes,
+	clearFakeSelection
 } from './conversion/model-selection-to-view-converters.js';
 
 import EmitterMixin from '../utils/emittermixin.js';
@@ -105,6 +106,7 @@ export default class EditingController {
 
 		// Attach default selection converters.
 		this.modelToView.on( 'selection', clearAttributes(), { priority: 'low' } );
+		this.modelToView.on( 'selection', clearFakeSelection(), { priority: 'low' } );
 		this.modelToView.on( 'selection', convertRangeSelection(), { priority: 'low' } );
 		this.modelToView.on( 'selection', convertCollapsedSelection(), { priority: 'low' } );
 	}