Merge "Use InputWidget facilities in byte limit counter"

This commit is contained in:
jenkins-bot 2013-11-26 13:21:18 +00:00 committed by Gerrit Code Review
commit ef7152ff91
2 changed files with 5 additions and 11 deletions

View file

@ -59,7 +59,6 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() {
currentUri.query.diff === undefined
);
this.originalDocumentTitle = document.title;
this.editSummaryByteLimit = 255;
this.tabLayout = mw.config.get( 'wgVisualEditorConfig' ).tabLayout;
/**

View file

@ -289,21 +289,16 @@ ve.ui.MWSaveDialog.prototype.initialize = function () {
);
this.editSummaryInput.$element.addClass( 've-ui-mwSaveDialog-summary' );
this.editSummaryInput.$input
.placeholder()
.byteLimit( this.editSummaryByteLimit )
.prop( 'tabIndex', 0 );
this.editSummaryInput.on( 'change', ve.bind( function () {
var $textarea = this.editSummaryInput.$input,
$editSummaryCount = this.savePanel.$element.find( '.ve-ui-mwSaveDialog-editSummary-count' );
this.editSummaryInput.on( 'change', function () {
// TODO: This looks a bit weird, there is no unit in the UI, just numbers
// Users likely assume characters but then it seems to count down quicker
// than expected. Facing users with the word "byte" is bad? (bug 40035)
setTimeout( function () {
$editSummaryCount.text(
saveDialog.editSummaryByteLimit - $.byteLength( $textarea.val() )
);
} );
}, this ) );
saveDialog.savePanel.$element.find( '.ve-ui-mwSaveDialog-editSummary-count' ).text(
saveDialog.editSummaryByteLimit - $.byteLength( saveDialog.editSummaryInput.getValue() )
);
} );
this.$saveOptions = this.$( '<div>' ).addClass( 've-ui-mwSaveDialog-options' ).append(
this.$( '<div>' ).addClass( 've-ui-mwSaveDialog-checkboxes' ),