Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7396409
ve.ce.MWEntityNode.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.MWEntityNode.js
View Options
/*!
* VisualEditor ContentEditable MWEntityNode class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable MediaWiki entity node.
*
* @class
* @extends ve.ce.LeafNode
* @constructor
* @param {ve.dm.MWEntityNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve
.
ce
.
MWEntityNode
=
function
VeCeMWEntityNode
()
{
// Parent constructor
ve
.
ce
.
MWEntityNode
.
super
.
apply
(
this
,
arguments
);
// DOM changes
this
.
$element
.
addClass
(
've-ce-mwEntityNode'
);
// Need CE=false to prevent selection issues
this
.
$element
.
prop
(
'contentEditable'
,
'false'
);
// Events
this
.
model
.
connect
(
this
,
{
update
:
'onUpdate'
}
);
// Initialization
this
.
onUpdate
();
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ce
.
MWEntityNode
,
ve
.
ce
.
LeafNode
);
/* Static Properties */
ve
.
ce
.
MWEntityNode
.
static
.
name
=
'mwEntity'
;
/* Methods */
/**
* Handle model update events.
*/
ve
.
ce
.
MWEntityNode
.
prototype
.
onUpdate
=
function
()
{
const
whitespaceHtmlChars
=
ve
.
visibleWhitespaceCharacters
,
significantWhitespace
=
this
.
getModel
().
getParent
().
hasSignificantWhitespace
();
let
chr
=
this
.
model
.
getAttribute
(
'character'
);
if
(
chr
===
'\u00a0'
)
{
// non-breaking space
this
.
$element
.
addClass
(
've-ce-mwEntityNode-nbsp'
)
.
attr
(
'title'
,
mw
.
msg
(
'visualeditor-tooltip-non-breaking-space'
)
);
}
else
{
this
.
$element
.
removeClass
(
've-ce-mwEntityNode-nbsp'
)
.
removeAttr
(
'title'
);
}
if
(
!
significantWhitespace
&&
Object
.
prototype
.
hasOwnProperty
.
call
(
whitespaceHtmlChars
,
chr
)
)
{
chr
=
whitespaceHtmlChars
[
chr
];
}
this
.
$element
.
text
(
chr
);
};
/* Registration */
ve
.
ce
.
nodeFactory
.
register
(
ve
.
ce
.
MWEntityNode
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 14:09 (6 h, 13 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
19/bd/b76614be977273bc6fe5f5dcd58e
Default Alt Text
ve.ce.MWEntityNode.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment