if ( ( $this->mPreview || !$isText ) && $content ) {
// NOTE: non-text content has no source view, so always use rendered preview
- // Hide [edit]s
$popts = $out->parserOptions();
- $popts->setEditSection( false );
$pout = $content->getParserOutput( $this->mTargetObj, $rev->getId(), $popts, true );
$out->addParserOutput( $pout, [
if ( $isText ) {
// source view for textual content
- $sourceView = new OOUI\MultilineTextInputWidget( [
- 'readOnly' => true,
- 'rows' => 25,
- 'value' => $content->getNativeData() . "\n"
- ] );
+ $sourceView = Xml::element( 'textarea', [
+ 'readonly' => 'readonly',
+ 'cols' => 80,
+ 'rows' => 25
+ ], $content->getNativeData() . "\n" );
$buttonFields[] = new OOUI\ButtonInputWidget( [
'type' => 'submit',
'content' => new OOUI\HtmlSnippet( $this->msg( 'undeleteextrahelp' )->parseAsBlock() )
] );
+ $conf = $this->getConfig();
+ $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+
$fields[] = new OOUI\FieldLayout(
new OOUI\TextInputWidget( [
'name' => 'wpComment',
'infusable' => true,
'value' => $this->mComment,
'autofocus' => true,
+ // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+ // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+ // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+ 'maxLength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
] ),
[
'label' => $this->msg( 'undeletecomment' )->text(),