mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Merge "Support for <center> tag"
This commit is contained in:
commit
aae793537c
|
@ -103,6 +103,7 @@ $html = '<div>' . file_get_contents( $page ) . '</div>';
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.AlienInlineNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.AlienInlineNode.js"></script>
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.AlienBlockNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.AlienBlockNode.js"></script>
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.BreakNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.BreakNode.js"></script>
|
||||||
|
<script src="../../modules/ve/dm/nodes/ve.dm.CenterNode.js"></script>
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.DefinitionListItemNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.DefinitionListItemNode.js"></script>
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.DefinitionListNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.DefinitionListNode.js"></script>
|
||||||
<script src="../../modules/ve/dm/nodes/ve.dm.DocumentNode.js"></script>
|
<script src="../../modules/ve/dm/nodes/ve.dm.DocumentNode.js"></script>
|
||||||
|
@ -133,6 +134,7 @@ $html = '<div>' . file_get_contents( $page ) . '</div>';
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.AlienInlineNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.AlienInlineNode.js"></script>
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.AlienBlockNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.AlienBlockNode.js"></script>
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.BreakNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.BreakNode.js"></script>
|
||||||
|
<script src="../../modules/ve/ce/nodes/ve.ce.CenterNode.js"></script>
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.DefinitionListItemNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.DefinitionListItemNode.js"></script>
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.DefinitionListNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.DefinitionListNode.js"></script>
|
||||||
<script src="../../modules/ve/ce/nodes/ve.ce.DocumentNode.js"></script>
|
<script src="../../modules/ve/ce/nodes/ve.ce.DocumentNode.js"></script>
|
||||||
|
|
42
modules/ve/ce/nodes/ve.ce.CenterNode.js
Normal file
42
modules/ve/ce/nodes/ve.ce.CenterNode.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* VisualEditor content editable CenterNode class.
|
||||||
|
*
|
||||||
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
||||||
|
* @license The MIT License (MIT); see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContentEditable node for a center tag.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @constructor
|
||||||
|
* @extends {ve.ce.BranchNode}
|
||||||
|
* @param model {ve.dm.CenterNode} Model to observe
|
||||||
|
*/
|
||||||
|
ve.ce.CenterNode = function ( model ) {
|
||||||
|
// Inheritance
|
||||||
|
ve.ce.BranchNode.call(
|
||||||
|
this, 'center', model, $( '<center></center>')
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Static Members */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node rules.
|
||||||
|
*
|
||||||
|
* @see ve.ce.NodeFactory
|
||||||
|
* @static
|
||||||
|
* @member
|
||||||
|
*/
|
||||||
|
ve.ce.CenterNode.rules = {
|
||||||
|
'canBeSplit': false
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Registration */
|
||||||
|
|
||||||
|
ve.ce.nodeFactory.register( 'center', ve.ce.CenterNode );
|
||||||
|
|
||||||
|
/* Inheritance */
|
||||||
|
|
||||||
|
ve.extendClass( ve.ce.CenterNode, ve.ce.BranchNode );
|
63
modules/ve/dm/nodes/ve.dm.CenterNode.js
Normal file
63
modules/ve/dm/nodes/ve.dm.CenterNode.js
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/**
|
||||||
|
* VisualEditor data model CenterNode class.
|
||||||
|
*
|
||||||
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
||||||
|
* @license The MIT License (MIT); see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DataModel node for a center tag.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @constructor
|
||||||
|
* @extends {ve.dm.BranchNode}
|
||||||
|
* @param {ve.dm.BranchNode[]} [children] Child nodes to attach
|
||||||
|
* @param {Object} [attributes] Reference to map of attribute key/value pairs
|
||||||
|
* @param {Object} [internal] Reference to internal data object
|
||||||
|
*/
|
||||||
|
ve.dm.CenterNode = function ( children, attributes, internal ) {
|
||||||
|
// Inheritance
|
||||||
|
ve.dm.BranchNode.call( this, 'center', children, attributes, internal );
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Static Members */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node rules.
|
||||||
|
*
|
||||||
|
* @see ve.dm.NodeFactory
|
||||||
|
* @static
|
||||||
|
* @member
|
||||||
|
*/
|
||||||
|
ve.dm.CenterNode.rules = {
|
||||||
|
'isWrapped': true,
|
||||||
|
'isContent': false,
|
||||||
|
'canContainContent': false,
|
||||||
|
'childNodeTypes': null,
|
||||||
|
'parentNodeTypes': null
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node converters.
|
||||||
|
*
|
||||||
|
* @see {ve.dm.Converter}
|
||||||
|
* @static
|
||||||
|
* @member
|
||||||
|
*/
|
||||||
|
ve.dm.CenterNode.converters = {
|
||||||
|
'domElementTypes': ['center'],
|
||||||
|
'toDomElement': function ( type, element ) {
|
||||||
|
return document.createElement( 'center' );
|
||||||
|
},
|
||||||
|
'toDataElement': function ( tag, element ) {
|
||||||
|
return { 'type': 'center' };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Registration */
|
||||||
|
|
||||||
|
ve.dm.nodeFactory.register( 'center', ve.dm.CenterNode );
|
||||||
|
|
||||||
|
/* Inheritance */
|
||||||
|
|
||||||
|
ve.extendClass( ve.dm.CenterNode, ve.dm.BranchNode );
|
Loading…
Reference in a new issue