Merge "Add support for read-only mode"

This commit is contained in:
jenkins-bot 2019-02-22 20:08:33 +00:00 committed by Gerrit Code Review
commit c18f50638f
2 changed files with 10 additions and 4 deletions

View file

@ -26,7 +26,7 @@ ve.ui.MWLatexContextItem = function VeUiMWLatexContextItem() {
} );
// Don't show quick edit button in mobile as the primary action will be quick edit
if ( !this.context.isMobile() ) {
if ( !this.context.isMobile() && !this.isReadOnly() ) {
this.actionButtons.addItems( [ this.quickEditButton ], 0 );
}

View file

@ -190,11 +190,13 @@ ve.ui.MWLatexDialog.prototype.getSetupProcess = function ( data ) {
.next( function () {
var attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs,
display = attributes && attributes.display || 'default',
id = attributes && attributes.id || '';
id = attributes && attributes.id || '',
isReadOnly = this.isReadOnly();
// Populate form
this.displaySelect.selectItemByData( display );
this.idInput.setValue( id );
// TODO: This widget is not readable when disabled
this.displaySelect.selectItemByData( display ).setDisabled( isReadOnly );
this.idInput.setValue( id ).setDisabled( isReadOnly );
// Add event handlers
this.input.on( 'change', this.onChangeHandler );
@ -305,6 +307,10 @@ ve.ui.MWLatexDialog.prototype.onListClick = function ( e ) {
insert = symbol.insert,
range = this.input.getRange();
if ( this.isReadOnly() ) {
return;
}
if ( encapsulate ) {
if ( range.from === range.to ) {
this.input.insertContent( encapsulate.placeholder );