Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7410632
ve.ce.MWHeadingNode.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.MWHeadingNode.js
View Options
/*!
* VisualEditor ContentEditable MWHeadingNode class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable MW heading node.
*
* @class
* @extends ve.ce.HeadingNode
* @constructor
* @param {ve.dm.MWHeadingNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve
.
ce
.
MWHeadingNode
=
function
VeCeMWHeadingNode
()
{
// Parent constructor
ve
.
ce
.
MWHeadingNode
.
super
.
apply
(
this
,
arguments
);
// Events
this
.
model
.
connect
(
this
,
{
update
:
'onUpdate'
}
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ce
.
MWHeadingNode
,
ve
.
ce
.
HeadingNode
);
/* Static Properties */
ve
.
ce
.
MWHeadingNode
.
static
.
name
=
'mwHeading'
;
/* Methods */
ve
.
ce
.
MWHeadingNode
.
prototype
.
onSetup
=
function
()
{
// Parent method
ve
.
ce
.
MWHeadingNode
.
super
.
prototype
.
onSetup
.
call
(
this
);
// Make reference to the surface
this
.
surface
=
this
.
root
&&
this
.
root
.
getSurface
().
getSurface
();
this
.
rebuildToc
();
};
ve
.
ce
.
MWHeadingNode
.
prototype
.
onTeardown
=
function
()
{
// Parent method
ve
.
ce
.
MWHeadingNode
.
super
.
prototype
.
onTeardown
.
call
(
this
);
this
.
rebuildToc
();
};
ve
.
ce
.
MWHeadingNode
.
prototype
.
onUpdate
=
function
()
{
const
surface
=
this
.
surface
;
// Parent method
ve
.
ce
.
MWHeadingNode
.
super
.
prototype
.
onUpdate
.
call
(
this
);
if
(
surface
&&
surface
.
mwTocWidget
)
{
surface
.
getModel
().
getDocument
().
once
(
'transact'
,
()
=>
{
surface
.
mwTocWidget
.
updateNode
(
this
);
}
);
}
};
ve
.
ce
.
MWHeadingNode
.
prototype
.
rebuildToc
=
function
()
{
const
surface
=
this
.
surface
;
if
(
surface
&&
surface
.
mwTocWidget
)
{
surface
.
getModel
().
getDocument
().
once
(
'transact'
,
()
=>
{
surface
.
mwTocWidget
.
rebuild
();
}
);
}
};
/* Registration */
ve
.
ce
.
nodeFactory
.
register
(
ve
.
ce
.
MWHeadingNode
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 23:05 (1 d, 22 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ec/f6/06fe3a42d9ce6090a90868b46cc9
Default Alt Text
ve.ce.MWHeadingNode.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment