mediawiki-extensions-Visual.../modules/ve/ce/nodes/ve.ce.ParagraphNode.js
Catrope e148234c29 Render inline annotations in CE
Moved annotation rendering from ce.Textnode into the new
ce.ContentBranchNode class. This allows us to render annotations that
span across multiple nodes.

* Add ce.ContentBranchNode, inheriting ce.BranchNode
* Make ce.{Paragraph,Heading,Preformatted}Node inherit ce.ContentBranchNode
* Made ce.ContentBranchNode render its child nodes with anntations,
  using .getAnnotatedHtml() on the child nodes
* Put a default implementation for .getAnnotatedHtml() in ce.LeafNode
* Override this in ce.TextNode to do escaping and whitespace handling
* Removed rendering code from ce.TextNode (this.$ is now unused there)
* Removed ce.TextNode.onUpdate() and ce.BranchNode.clean(), now unneeded
* Have ce.BranchNode propagate update events from children, so
  ce.ContentBranchNode can rerender when its children change
* Update tests, add test case for escaping of &<>'"

Change-Id: I4600e984b287c6ff9267f4281d2f09bab9e1ad95
2012-11-28 11:21:59 -08:00

41 lines
828 B
JavaScript

/**
* VisualEditor content editable ParagraphNode class.
*
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable node for a paragraph.
*
* @class
* @constructor
* @extends {ve.ce.BranchNode}
* @param {ve.dm.ParagraphNode} model Model to observe
*/
ve.ce.ParagraphNode = function VeCeParagraphNode( model ) {
// Parent constructor
ve.ce.ContentBranchNode.call( this, 'paragraph', model, $( '<p>' ) );
};
/* Inheritance */
ve.inheritClass( ve.ce.ParagraphNode, ve.ce.ContentBranchNode );
/* Static Members */
/**
* Node rules.
*
* @see ve.ce.NodeFactory
* @static
* @member
*/
ve.ce.ParagraphNode.rules = {
'canBeSplit': true
};
/* Registration */
ve.ce.nodeFactory.register( 'paragraph', ve.ce.ParagraphNode );