Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7410417
ve.ui.MWPreviewElement.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.ui.MWPreviewElement.js
View Options
/*!
* VisualEditor UserInterface MWPreviewElement class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.MWPreviewElement object.
*
* @class
* @extends ve.ui.PreviewElement
*
* @constructor
* @param {ve.dm.Node} [model]
* @param {Object} [config]
* @param {boolean} [config.useView=false] Use the view HTML, and don't bother generating model HTML, which
* is a bit slower
*/
ve
.
ui
.
MWPreviewElement
=
function
VeUiMwPreviewElement
()
{
// Parent constructor
ve
.
ui
.
MWPreviewElement
.
super
.
apply
(
this
,
arguments
);
// Initialize
this
.
$element
.
addClass
(
've-ui-mwPreviewElement mw-body-content mw-parser-output'
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
ui
.
MWPreviewElement
,
ve
.
ui
.
PreviewElement
);
/* Method */
/**
* @inheritdoc
*/
ve
.
ui
.
MWPreviewElement
.
prototype
.
beforeAppend
=
function
(
element
)
{
// Parent method
ve
.
ui
.
MWPreviewElement
.
super
.
prototype
.
beforeAppend
.
apply
(
this
,
arguments
);
// Remove any TemplateStyles stylesheets already present on the page, to avoid
// very slow repaints (T330781)
Array
.
prototype
.
forEach
.
call
(
element
.
querySelectorAll
(
'style[data-mw-deduplicate]'
),
(
style
)
=>
{
const
key
=
style
.
getAttribute
(
'data-mw-deduplicate'
);
const
duplicate
=
element
.
querySelector
(
'style[data-mw-deduplicate="'
+
key
+
'"]'
);
if
(
duplicate
)
{
style
.
parentNode
.
removeChild
(
style
);
}
}
);
};
/**
* @inheritdoc
*/
ve
.
ui
.
MWPreviewElement
.
prototype
.
setModel
=
function
(
model
)
{
// Parent method
ve
.
ui
.
MWPreviewElement
.
super
.
prototype
.
setModel
.
call
(
this
,
model
);
// The following classes are used here:
// * mw-content-ltr
// * mw-content-rtl
this
.
$element
.
addClass
(
'mw-content-'
+
this
.
model
.
getDocument
().
getDir
()
);
};
/**
* @inheritdoc
*/
ve
.
ui
.
MWPreviewElement
.
prototype
.
replaceWithModelDom
=
function
()
{
// Parent method
ve
.
ui
.
MWPreviewElement
.
super
.
prototype
.
replaceWithModelDom
.
apply
(
this
,
arguments
);
ve
.
init
.
platform
.
linkCache
.
styleParsoidElements
(
this
.
$element
,
// The DM node should be attached, but check just in case.
this
.
model
.
getDocument
()
&&
this
.
model
.
getDocument
().
getHtmlDocument
()
);
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 22:58 (1 d, 23 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f6/c3/75f9dd1c9482033883ce0582e9a7
Default Alt Text
ve.ui.MWPreviewElement.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment