mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-27 17:50:44 +00:00
[Realtime Preview] Only clone part of the #wikiPreview element
The #wikiPreview element can contain other child elements such as the already-removed one of .previewnote but also (on category pages) category lists, which we don't want. This changes to only clone the specific content element. We could just create this in JS, but don't at this point have access to the lang direction. Bug: T315558 Change-Id: Ifcd02e9cf005e00c8dd69df162893fb673117231
This commit is contained in:
parent
6efc549714
commit
e979df2036
|
@ -16,9 +16,9 @@ function RealtimePreview() {
|
|||
this.twoPaneLayout = new TwoPaneLayout();
|
||||
this.pagePreview = require( 'mediawiki.page.preview' );
|
||||
// @todo This shouldn't be required, but the preview element is added in PHP
|
||||
// and can have attributes with values that aren't easily accessible from here,
|
||||
// and can have attributes with values (such as `dir`) that aren't easily accessible from here,
|
||||
// and we need to duplicate here what Live Preview does in core.
|
||||
var $previewContent = $( '#wikiPreview' ).clone().html();
|
||||
var $previewContent = $( '#wikiPreview .mw-content-ltr, #wikiPreview .mw-content-rtl' ).first().clone();
|
||||
this.$previewNode = $( '<div>' )
|
||||
.addClass( 'ext-WikiEditor-realtimepreview-preview' )
|
||||
.append( $previewContent );
|
||||
|
|
Loading…
Reference in a new issue