Ver código fonte

Improved docs.

Oskar Wróbel 8 anos atrás
pai
commit
e0cf4d906c

+ 2 - 2
packages/ckeditor5-engine/src/conversion/buildviewconverter.js

@@ -326,8 +326,8 @@ class ViewConverterBuilder {
 					//
 					// before: <allowed><notAllowed>[]</notAllowed></allowed>
 					// after:  <allowed><notAllowed></notAllowed>[<converted></converted><notAllowed>]</notAllowed></allowed>
-					if ( splitResult.endElement ) {
-						output.end = Position.createAt( splitResult.endElement );
+					if ( splitResult.cursorParent ) {
+						output.end = Position.createAt( splitResult.cursorParent );
 
 					// When element is converted on target position (without splitting) we need to move range
 					// after this element but we need to take into consideration that children could split our

+ 11 - 4
packages/ckeditor5-engine/src/conversion/viewconversiondispatcher.js

@@ -175,8 +175,7 @@ export default class ViewConversionDispatcher {
 			// Store writer in current conversion as a conversion API.
 			this.conversionApi.writer = writer;
 
-			// Additional date available between conversions.
-			// Needed when one converter needs to leave some data for the oder converters.
+			// Custom data stored by converter for conversion process.
 			this.conversionApi.data = {};
 
 			// Do the conversion.
@@ -296,7 +295,7 @@ export default class ViewConversionDispatcher {
 
 		return {
 			position: data.position,
-			endElement: data.range.end.parent
+			cursorParent: data.range.end.parent
 		};
 	}
 
@@ -413,6 +412,7 @@ function extractMarkersFromModelFragment( modelItem, writer ) {
 	return markers;
 }
 
+// Creates model fragment according to given context and returns position in top element.
 function contextToPosition( contextDefinition, writer ) {
 	let position;
 
@@ -493,7 +493,7 @@ function contextToPosition( contextDefinition, writer ) {
  * @method #splitToAllowedParent
  * @param {module:engine/model/position~Position} position Position on which element is going to be inserted.
  * @param {module:engine/model/element~Node} element Element to insert.
- * @returns TODO
+ * @returns {SplitToAllowedParentResult} Split result.
  */
 
 /**
@@ -501,3 +501,10 @@ function contextToPosition( contextDefinition, writer ) {
  *
  * @param {Object} #data
  */
+
+/**
+ * @typedef {Object} SplitToAllowedParentResult
+ * @property {module:engine/model/position~Position} position between split elements.
+ * @property {module:engine/model/element~Element} [cursorParent] Element inside which cursor should be placed to
+ * continue conversion. When element is not defined it means that there was no split.
+ */