Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7448267
ve.dm.LinearSelection.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.dm.LinearSelection.js
View Options
/*!
* VisualEditor Linear Selection class.
*
* @copyright See AUTHORS.txt
*/
/**
* @class
* @extends ve.dm.Selection
* @constructor
* @param {ve.Range} range
*/
ve
.
dm
.
LinearSelection
=
function
VeDmLinearSelection
(
range
)
{
// Parent constructor
ve
.
dm
.
LinearSelection
.
super
.
call
(
this
);
this
.
range
=
range
;
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
dm
.
LinearSelection
,
ve
.
dm
.
Selection
);
/* Static Properties */
ve
.
dm
.
LinearSelection
.
static
.
name
=
'linear'
;
/* Static Methods */
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
static
.
newFromHash
=
function
(
hash
)
{
return
new
ve
.
dm
.
LinearSelection
(
ve
.
Range
.
static
.
newFromHash
(
hash
.
range
)
);
};
/* Methods */
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
toJSON
=
function
()
{
return
{
type
:
this
.
constructor
.
static
.
name
,
range
:
this
.
range
};
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
getDescription
=
function
()
{
return
'Linear: '
+
this
.
range
.
from
+
' - '
+
this
.
range
.
to
;
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
collapseToStart
=
function
()
{
return
new
this
.
constructor
(
new
ve
.
Range
(
this
.
getRange
().
start
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
collapseToEnd
=
function
()
{
return
new
this
.
constructor
(
new
ve
.
Range
(
this
.
getRange
().
end
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
collapseToFrom
=
function
()
{
return
new
this
.
constructor
(
new
ve
.
Range
(
this
.
getRange
().
from
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
collapseToTo
=
function
()
{
return
new
this
.
constructor
(
new
ve
.
Range
(
this
.
getRange
().
to
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
isCollapsed
=
function
()
{
return
this
.
getRange
().
isCollapsed
();
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
translateByTransaction
=
function
(
tx
,
excludeInsertion
)
{
return
new
this
.
constructor
(
tx
.
translateRange
(
this
.
getRange
(),
excludeInsertion
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
translateByTransactionWithAuthor
=
function
(
tx
,
authorId
)
{
return
new
this
.
constructor
(
tx
.
translateRangeWithAuthor
(
this
.
getRange
(),
authorId
)
);
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
getRanges
=
function
()
{
return
[
this
.
range
];
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
getCoveringRange
=
function
()
{
return
this
.
range
;
};
/**
* Get the range for this selection
*
* @return {ve.Range}
*/
ve
.
dm
.
LinearSelection
.
prototype
.
getRange
=
function
()
{
return
this
.
range
;
};
/**
* @inheritdoc
*/
ve
.
dm
.
LinearSelection
.
prototype
.
equals
=
function
(
other
)
{
return
this
===
other
||
(
!!
other
&&
other
.
constructor
===
this
.
constructor
&&
this
.
getRange
().
equals
(
other
.
getRange
()
)
);
};
/* Registration */
ve
.
dm
.
selectionFactory
.
register
(
ve
.
dm
.
LinearSelection
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 19:34 (1 d, 11 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4e/63/968b7680a0b7d577e24b942813cc
Default Alt Text
ve.dm.LinearSelection.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment