X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUndelete.php;h=6e6ad779b328e61494e0c2a9091f6429d09ff670;hb=ccc1c08089b6596bc20f6d88db1909f57fab2498;hp=0c038c18ab2fa498d3723e095235b1f6a29e3c3a;hpb=f28a0ccaabf332e128fd1da1ff27d27eb268920a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 0c038c18ab..6e6ad779b3 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -450,9 +450,7 @@ class SpecialUndelete extends SpecialPage { 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, [ @@ -460,32 +458,32 @@ class SpecialUndelete extends SpecialPage { ] ); } + $out->enableOOUI(); + $buttonFields = []; + if ( $isText ) { // source view for textual content - $sourceView = Xml::element( - 'textarea', - [ - 'readonly' => 'readonly', - 'cols' => 80, - 'rows' => 25 - ], - $content->getNativeData() . "\n" - ); + $sourceView = Xml::element( 'textarea', [ + 'readonly' => 'readonly', + 'cols' => 80, + 'rows' => 25 + ], $content->getNativeData() . "\n" ); - $previewButton = Xml::element( 'input', [ + $buttonFields[] = new OOUI\ButtonInputWidget( [ 'type' => 'submit', 'name' => 'preview', - 'value' => $this->msg( 'showpreview' )->text() + 'label' => $this->msg( 'showpreview' )->text() ] ); } else { $sourceView = ''; $previewButton = ''; } - $diffButton = Xml::element( 'input', [ + $buttonFields[] = new OOUI\ButtonInputWidget( [ 'name' => 'diff', 'type' => 'submit', - 'value' => $this->msg( 'showdiff' )->text() ] ); + 'label' => $this->msg( 'showdiff' )->text() + ] ); $out->addHTML( $sourceView . @@ -506,8 +504,13 @@ class SpecialUndelete extends SpecialPage { 'type' => 'hidden', 'name' => 'wpEditToken', 'value' => $user->getEditToken() ] ) . - $previewButton . - $diffButton . + new OOUI\FieldLayout( + new OOUI\Widget( [ + 'content' => new OOUI\HorizontalLayout( [ + 'items' => $buttonFields + ] ) + ] ) + ) . Xml::closeElement( 'form' ) . Xml::closeElement( 'div' ) ); @@ -736,6 +739,9 @@ class SpecialUndelete extends SpecialPage { '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', @@ -743,6 +749,10 @@ class SpecialUndelete extends SpecialPage { '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(),