Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/247027
Change subject: Wrap body-only HTML in <body> tags when parsing
......................................................................
Wrap body-only HTML in <body> tags when parsing
Otherwise any <link>/<meta> tags at the start of the input
will be considered part of the <head> instead, which will
cause them to be lost when round-tripped through the editor.
Bug: T115362
Change-Id: I3871281843567d3e329f2707e4a46804f4daeca7
---
M modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/27/247027/1
diff --git
a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
index 55ef225..d4746b2 100644
--- a/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
+++ b/modules/flow/ui/widgets/editor/editors/mw.flow.ui.VisualEditorWidget.js
@@ -88,11 +88,13 @@
/**
* Create a VE surface with the provided content in it.
- * @param {string} content HTML to put in the surface
+ * @param {string} content HTML to put in the surface (body only)
*/
mw.flow.ui.VisualEditorWidget.prototype.createSurface = function (
content ) {
var dmDoc,
- htmlDoc = ve.createDocumentFromHtml( content );
+ // Wrap content in <body> tag to prevent <link>/<meta>
tags from being pulled
+ // up into the <head> (T115362)
+ htmlDoc = ve.createDocumentFromHtml( '<body>' + content
+ '</body>' );
ve.init.mw.Target.static.fixBase( htmlDoc );
dmDoc = ve.dm.converter.getModelFromDom( htmlDoc, {
lang: mw.config.get( 'wgVisualEditor'
).pageLanguageCode,
--
To view, visit https://gerrit.wikimedia.org/r/247027
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3871281843567d3e329f2707e4a46804f4daeca7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits