mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 23:46:39 +00:00
Merge "Add support for read-only mode"
This commit is contained in:
commit
c18f50638f
|
@ -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