Răsfoiți Sursa

Docs: More details on the two writers thingy.

Piotrek Koszuliński 7 ani în urmă
părinte
comite
887ca4d8e7

+ 5 - 2
packages/ckeditor5-engine/src/view/downcastwriter.js

@@ -26,12 +26,15 @@ import { isPlainObject } from 'lodash-es';
  *
  * It provides a set of methods used to manipulate view nodes.
  *
+ * Do not create an instance of this writer manually. To modify a view structure, use
+ * the {@link module:engine/view/view~View#change `View#change()`} block.
+ *
  * The `DowncastWriter` is designed to work with semantic views which are the views that were/are being downcasted from the model.
  * To work with ordinary views (e.g. parsed from a pasted content) use the
  * {@link module:engine/view/upcastwriter~UpcastWriter upcast writer}.
  *
- * Do not create an instance of this writer manually. To modify a view structure, use
- * the {@link module:engine/view/view~View#change `View#change()`) block.
+ * Read more about changing the view in the {@glink framework/guides/architecture/editing-engine#changing-the-view Changing the view}
+ * section of the {@glink framework/guides/architecture/editing-engine Editing engine architecture} guide.
  */
 export default class DowncastWriter {
 	constructor( document ) {

+ 12 - 2
packages/ckeditor5-engine/src/view/upcastwriter.js

@@ -16,13 +16,23 @@ import Range from './range';
 import Selection from './selection';
 
 /**
- * View upcast writer.
+ * View upcast writer. It provides a set of methods used to manipulate non-semantic view trees.
  *
- * It provides a set of methods used to manipulate view nodes.
  * It should be used only while working on a non-semantic view
  * (e.g. a view created from HTML string on paste).
  * To manipulate a view which was or is being downcasted from the the model use the
  * {@link module:engine/view/downcastwriter~DowncastWriter downcast writer}.
+ *
+ * Read more about changing the view in the {@glink framework/guides/architecture/editing-engine#changing-the-view Changing the view}
+ * section of the {@glink framework/guides/architecture/editing-engine Editing engine architecture} guide.
+ *
+ * Unlike `DowncastWriter`, which is available in the {@link module:engine/view/view~View#change `View#change()`} block,
+ * `UpcastWriter` can wherever you need it:
+ *
+ *		const writer = new UpcastWriter();
+ *		const text = writer.createText( 'foo!' );
+ *
+ *		writer.appendChild( text, someViewElement );
  */
 export default class UpcastWriter {
 	/**