Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7413621
ve.ce.AnnotationFactory.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.AnnotationFactory.js
View Options
/*!
* VisualEditor ContentEditable AnnotationFactory class.
*
* @copyright See AUTHORS.txt
*/
/**
* ContentEditable annotation factory.
*
* @class
* @extends OO.Factory
* @constructor
*/
ve
.
ce
.
AnnotationFactory
=
function
VeCeAnnotationFactory
()
{
// Parent constructor
OO
.
Factory
.
call
(
this
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ce
.
AnnotationFactory
,
OO
.
Factory
);
/* Methods */
/**
* Get a plain text description of an annotation model.
*
* @param {ve.dm.Annotation} annotation Annotation to describe
* @return {string} Description of the annotation
* @throws {Error} Unknown annotation type
*/
ve
.
ce
.
AnnotationFactory
.
prototype
.
getDescription
=
function
(
annotation
)
{
const
type
=
annotation
.
constructor
.
static
.
name
;
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
this
.
registry
,
type
)
)
{
return
this
.
registry
[
type
].
static
.
getDescription
(
annotation
);
}
throw
new
Error
(
'Unknown annotation type: '
+
type
);
};
/**
* Check if an annotation can be active
*
* @param {string} type Annotation type
* @return {boolean}
*/
ve
.
ce
.
AnnotationFactory
.
prototype
.
canAnnotationBeActive
=
function
(
type
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
this
.
registry
,
type
)
)
{
return
this
.
registry
[
type
].
static
.
canBeActive
;
}
throw
new
Error
(
'Unknown annotation type: '
+
type
);
};
/* Initialization */
// TODO: Move instantiation to a different file
ve
.
ce
.
annotationFactory
=
new
ve
.
ce
.
AnnotationFactory
();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 01:09 (1 d, 15 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d9/84/f99d823a22ea0ae79ee5a804fe7e
Default Alt Text
ve.ce.AnnotationFactory.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment