Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7423966
ve.ui.ChangeDirectionalityTool.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.ChangeDirectionalityTool.js
View Options
/*!
* VisualEditor UserInterface ChangeDirectionalityTool class.
*
* @copyright See AUTHORS.txt
*/
/**
* UserInterface change view directionality tool.
*
* @class
* @extends ve.ui.Tool
* @constructor
* @param {OO.ui.ToolGroup} toolGroup
* @param {Object} [config] Configuration options
*/
ve
.
ui
.
ChangeDirectionalityTool
=
function
VeUiChangeDirectionalityTool
()
{
// Parent constructor
ve
.
ui
.
ChangeDirectionalityTool
.
super
.
apply
(
this
,
arguments
);
this
.
modelDir
=
null
;
this
.
setDisabled
(
false
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ui
.
ChangeDirectionalityTool
,
ve
.
ui
.
Tool
);
/* Static Properties */
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
name
=
'changeDirectionality'
;
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
group
=
'utility'
;
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
icon
=
'textDirRTL'
;
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
title
=
OO
.
ui
.
deferMsg
(
'visualeditor-changedir-rtl'
);
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
autoAddToCatchall
=
false
;
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
commandName
=
'changeDirectionality'
;
ve
.
ui
.
ChangeDirectionalityTool
.
static
.
deactivateOnSelect
=
false
;
/* Methods */
/**
* @inheritdoc
*/
ve
.
ui
.
ChangeDirectionalityTool
.
prototype
.
onUpdateState
=
function
(
fragment
)
{
// Parent method
ve
.
ui
.
ChangeDirectionalityTool
.
super
.
prototype
.
onUpdateState
.
apply
(
this
,
arguments
);
const
modelDir
=
fragment
.
getDocument
().
getDir
();
if
(
modelDir
!==
this
.
modelDir
)
{
// Icons used here textDirLTR, textDirRTL
this
.
setIcon
(
'textDir'
+
(
modelDir
===
'ltr'
?
'RTL'
:
'LTR'
)
);
// The following messages are used here:
// * visualeditor-changedir-tool-ltr
// * visualeditor-changedir-tool-rtl
this
.
setTitle
(
ve
.
msg
(
'visualeditor-changedir-tool-'
+
(
modelDir
===
'ltr'
?
'rtl'
:
'ltr'
)
)
);
this
.
modelDir
=
modelDir
;
}
const
viewDir
=
this
.
toolbar
.
getSurface
().
getView
().
getDocument
().
getDir
();
this
.
setActive
(
viewDir
!==
modelDir
);
};
/* Registration */
ve
.
ui
.
toolFactory
.
register
(
ve
.
ui
.
ChangeDirectionalityTool
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 06:56 (21 h, 54 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c7/20/e80a7b1622ec11243b18c5381345
Default Alt Text
ve.ui.ChangeDirectionalityTool.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment