Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6109828
ve.init.mw.TargetFactory.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ve.init.mw.TargetFactory.js
View Options
/*!
* VisualEditor MediaWiki Initialization TargetFactory class.
*
* @copyright See AUTHORS.txt
*/
/**
* Target factory.
*
* @class
* @extends OO.Factory
* @constructor
*/
ve
.
init
.
mw
.
TargetFactory
=
function
VeInitMwTargetFactory
()
{
// Parent constructor
ve
.
init
.
mw
.
TargetFactory
.
super
.
call
(
this
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
init
.
mw
.
TargetFactory
,
OO
.
Factory
);
/* Methods */
/**
* @inheritdoc
*/
ve
.
init
.
mw
.
TargetFactory
.
prototype
.
register
=
function
(
constructor
)
{
// Validate arguments
if
(
!
(
constructor
.
prototype
instanceof
ve
.
init
.
mw
.
Target
)
)
{
throw
new
Error
(
'Targets must be subclasses of ve.init.mw.Target'
);
}
// Parent method
ve
.
init
.
mw
.
TargetFactory
.
super
.
prototype
.
register
.
apply
(
this
,
arguments
);
};
/**
* @inheritdoc
*/
ve
.
init
.
mw
.
TargetFactory
.
prototype
.
create
=
function
()
{
// Parent method
const
target
=
ve
.
init
.
mw
.
TargetFactory
.
super
.
prototype
.
create
.
apply
(
this
,
arguments
);
/*
* This hook is designed to replace all the previous post-init
* article editor hooks:
*
* mw.hook( 've.newTarget' ).add( ( target ) => {
* if ( target.constructor.static.name !== 'article' ) {
* return;
* }
*
* // ve.activationComplete
* target.on( 'surfaceReady', () => {
* console.log( 'surface ready' );
* } );
*
* // ve.toolbarSaveButton.stateChanged
* target.on( 'toolbarSaveButtonStateChanged', () => {
* console.log( 'toolbar save button changed', target.toolbarSaveButton, target.isSaveable() );
* } );
*
* // ve.saveDialog.stateChanged
* target.on( 'saveWorkflowChangePanel', () => {
* console.log( 'save dialog change panel', ve.init.target.saveDialog );
* } );
*
* // ve.deactivationComplete
* target.on( 'teardown', () => {
* console.log( 'teardown', ve.init.target.edited );
* } );
* } );
*/
mw
.
hook
(
've.newTarget'
).
fire
(
target
);
return
target
;
};
/* Initialization */
ve
.
init
.
mw
.
targetFactory
=
new
ve
.
init
.
mw
.
TargetFactory
();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 6 2026, 17:06 (6 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9e/8b/c4b7d370042c0964f28d039bdbe2
Default Alt Text
ve.init.mw.TargetFactory.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment