Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7419348
ve.ce.LinkAnnotation.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.ce.LinkAnnotation.js
View Options
/*!
* VisualEditor ContentEditable LinkAnnotation class.
*
* @copyright See AUTHORS.txt
*/
/**
* ContentEditable link annotation.
*
* @class
* @extends ve.ce.Annotation
* @mixes ve.ce.NailedAnnotation
* @constructor
* @param {ve.dm.LinkAnnotation} model Model to observe
* @param {ve.ce.ContentBranchNode} [parentNode] Node rendering this annotation
* @param {Object} [config] Configuration options
*/
ve
.
ce
.
LinkAnnotation
=
function
VeCeLinkAnnotation
(
model
,
parentNode
,
config
)
{
// Parent constructor
ve
.
ce
.
LinkAnnotation
.
super
.
call
(
this
,
model
,
parentNode
,
ve
.
extendObject
(
{
$element
:
$
(
'<a>'
)
},
config
)
);
// Mixin constructor
ve
.
ce
.
NailedAnnotation
.
call
(
this
);
this
.
$element
.
addClass
(
've-ce-linkAnnotation'
)
.
prop
(
{
title
:
this
.
constructor
.
static
.
getDescription
(
this
.
model
)
}
);
// T322704
ve
.
setAttributeSafe
(
this
.
$element
[
0
],
'href'
,
ve
.
resolveUrl
(
this
.
model
.
getHref
(),
this
.
getModelHtmlDocument
()
),
'#'
);
this
.
$element
.
on
(
'click'
,
this
.
onClick
.
bind
(
this
)
);
// Deprecated, use this.$element
this
.
$anchor
=
this
.
$element
;
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ce
.
LinkAnnotation
,
ve
.
ce
.
Annotation
);
OO
.
mixinClass
(
ve
.
ce
.
LinkAnnotation
,
ve
.
ce
.
NailedAnnotation
);
/* Static Properties */
ve
.
ce
.
LinkAnnotation
.
static
.
name
=
'link'
;
ve
.
ce
.
LinkAnnotation
.
static
.
tagName
=
'span'
;
/* Static Methods */
/**
* @inheritdoc
*/
ve
.
ce
.
LinkAnnotation
.
static
.
getDescription
=
function
(
model
)
{
return
model
.
getHref
();
};
/* Methods */
/* istanbul ignore next */
/**
* Handle click events.
*
* @param {jQuery.Event} e Mouse click event
*/
ve
.
ce
.
LinkAnnotation
.
prototype
.
onClick
=
function
(
e
)
{
if
(
e
.
which
===
OO
.
ui
.
MouseButtons
.
LEFT
&&
(
e
.
ctrlKey
||
e
.
metaKey
)
)
{
window
.
open
(
this
.
$element
.
prop
(
'href'
)
);
// Prevent multiple windows being opened, or other action being performed (e.g. middle click paste)
e
.
preventDefault
();
}
};
/* Registration */
ve
.
ce
.
annotationFactory
.
register
(
ve
.
ce
.
LinkAnnotation
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 04:25 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d6/12/f3934488be4c5c3453a9ab7296b4
Default Alt Text
ve.ce.LinkAnnotation.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment