mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Add support for read-only mode
Change-Id: Ibf8ab22ead2ceb80e39dcab50f4fc6c1ee0ae1f0 Depends-On: Iedd1bd9ce17750ad8528c1a053293c4a7321c5de
This commit is contained in:
parent
eb7a8371d8
commit
f22a61c000
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue