Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7410888
ve.ui.FragmentWindowTool.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.FragmentWindowTool.js
View Options
/*!
* VisualEditor UserInterface FragmentWindowTool classes.
*
* @copyright See AUTHORS.txt
*/
/**
* UserInterface fragment window tool.
*
* @abstract
* @class
* @extends ve.ui.WindowTool
* @constructor
* @param {OO.ui.ToolGroup} toolGroup
* @param {Object} [config] Configuration options
*/
ve
.
ui
.
FragmentWindowTool
=
function
VeUiFragmentWindowTool
()
{
// Parent constructor
ve
.
ui
.
FragmentWindowTool
.
super
.
apply
(
this
,
arguments
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ui
.
FragmentWindowTool
,
ve
.
ui
.
WindowTool
);
/* Static Properties */
/**
* Annotation or node models this tool is related to.
*
* Used by #isCompatibleWith.
*
* @static
* @property {Function[]}
* @inheritable
*/
ve
.
ui
.
FragmentWindowTool
.
static
.
modelClasses
=
[];
ve
.
ui
.
FragmentWindowTool
.
static
.
deactivateOnSelect
=
false
;
/* Methods */
/**
* @inheritdoc
*/
ve
.
ui
.
FragmentWindowTool
.
static
.
isCompatibleWith
=
function
(
model
)
{
return
ve
.
isInstanceOfAny
(
model
,
this
.
modelClasses
);
};
/**
* @inheritdoc
*/
ve
.
ui
.
FragmentWindowTool
.
prototype
.
onUpdateState
=
function
(
fragment
)
{
this
.
setActive
(
false
);
// Grand-parent method
// Parent method is skipped because it set's active state based on which windows
// are open, which we override in this implementation
ve
.
ui
.
FragmentWindowTool
.
super
.
super
.
prototype
.
onUpdateState
.
apply
(
this
,
arguments
);
const
models
=
this
.
getSelectedModels
(
fragment
);
for
(
let
i
=
0
,
len
=
models
.
length
;
i
<
len
;
i
++
)
{
if
(
this
.
constructor
.
static
.
isCompatibleWith
(
models
[
i
]
)
)
{
this
.
setActive
(
true
);
break
;
}
}
};
/**
* Get list of selected nodes and annotations.
*
* @param {ve.dm.SurfaceFragment|null} fragment Surface fragment
* @return {ve.dm.Model[]} Selected models
*/
ve
.
ui
.
FragmentWindowTool
.
prototype
.
getSelectedModels
=
function
(
fragment
)
{
return
fragment
?
fragment
.
getSelectedModels
()
:
[];
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 23:16 (1 d, 22 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3f/f7/72f0f157e88ec7af108ac0f27678
Default Alt Text
ve.ui.FragmentWindowTool.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment