Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7424206
ve.ui.ContextOptionWidget.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.ui.ContextOptionWidget.js
View Options
/*!
* VisualEditor Context Item widget class.
*
* @copyright See AUTHORS.txt
*/
/**
* Proxy for a tool, displaying information about the current context.
*
* Use with ve.ui.ContextSelectWidget.
*
* @class
* @extends OO.ui.DecoratedOptionWidget
*
* @constructor
* @param {Function} tool Tool item is a proxy for
* @param {ve.dm.Node|ve.dm.Annotation} model Node or annotation item is related to
* @param {Object} [config] Configuration options
*/
ve
.
ui
.
ContextOptionWidget
=
function
VeUiContextOptionWidget
(
tool
,
model
,
config
)
{
// Config initialization
config
=
config
||
{};
// Parent constructor
ve
.
ui
.
ContextOptionWidget
.
super
.
call
(
this
,
config
);
// Properties
this
.
tool
=
tool
;
this
.
model
=
model
;
// Initialization
this
.
$element
.
addClass
(
've-ui-contextOptionWidget'
);
this
.
setIcon
(
this
.
tool
.
static
.
icon
);
this
.
setLabel
(
this
.
getDescription
()
);
};
/* Setup */
OO
.
inheritClass
(
ve
.
ui
.
ContextOptionWidget
,
OO
.
ui
.
DecoratedOptionWidget
);
/* Methods */
/**
* Get a description of the model.
*
* @return {string} Description of model
*/
ve
.
ui
.
ContextOptionWidget
.
prototype
.
getDescription
=
function
()
{
let
description
;
if
(
this
.
model
instanceof
ve
.
dm
.
Annotation
)
{
description
=
ve
.
ce
.
annotationFactory
.
getDescription
(
this
.
model
);
}
else
if
(
this
.
model
instanceof
ve
.
dm
.
Node
)
{
description
=
ve
.
ce
.
nodeFactory
.
getDescription
(
this
.
model
);
}
if
(
!
description
)
{
description
=
this
.
tool
.
static
.
title
;
}
return
description
;
};
/**
* Get the command for this item.
*
* @return {ve.ui.Command}
*/
ve
.
ui
.
ContextOptionWidget
.
prototype
.
getCommand
=
function
()
{
return
this
.
tool
.
static
.
getCommand
(
this
.
context
.
getSurface
()
);
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 07:11 (21 h, 42 s)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8e/58/c455990cccbf147e9e0ad6c5e43c
Default Alt Text
ve.ui.ContextOptionWidget.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment