Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7415366
ve.ce.ListNode.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ve.ce.ListNode.js
View Options
/*!
* VisualEditor ContentEditable ListNode class.
*
* @copyright See AUTHORS.txt
*/
/**
* ContentEditable list node.
*
* @class
* @extends ve.ce.BranchNode
* @constructor
* @param {ve.dm.ListNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve
.
ce
.
ListNode
=
function
VeCeListNode
()
{
// Parent constructor
ve
.
ce
.
ListNode
.
super
.
apply
(
this
,
arguments
);
// Events
this
.
model
.
connect
(
this
,
{
update
:
'onUpdate'
}
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ce
.
ListNode
,
ve
.
ce
.
BranchNode
);
/* Static Properties */
ve
.
ce
.
ListNode
.
static
.
name
=
'list'
;
ve
.
ce
.
ListNode
.
static
.
removeEmptyLastChildOnEnter
=
true
;
/* Methods */
/**
* Get the HTML tag name.
*
* Tag name is selected based on the model's style attribute.
*
* @return {string} HTML tag name
* @throws {Error} If style is invalid
*/
ve
.
ce
.
ListNode
.
prototype
.
getTagName
=
function
()
{
const
style
=
this
.
model
.
getAttribute
(
'style'
),
types
=
{
bullet
:
'ul'
,
number
:
'ol'
};
if
(
!
Object
.
prototype
.
hasOwnProperty
.
call
(
types
,
style
)
)
{
throw
new
Error
(
'Invalid style'
);
}
return
types
[
style
];
};
/**
* Handle model update events.
*
* If the style changed since last update the DOM wrapper will be replaced with an appropriate one.
*/
ve
.
ce
.
ListNode
.
prototype
.
onUpdate
=
function
()
{
this
.
updateTagName
();
};
/* Registration */
ve
.
ce
.
nodeFactory
.
register
(
ve
.
ce
.
ListNode
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 02:08 (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
42/1d/c68457adfc93e3dbe40cb512f015
Default Alt Text
ve.ce.ListNode.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment