jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/371713 )
Change subject: Add RTL support in VE source editor mode
......................................................................
Add RTL support in VE source editor mode
Bug: T170001
Change-Id: I7223a57969a2299a86d73cfd57336e8d56086520
---
M resources/modules/ve-cm/ve.ui.CodeMirrorAction.js
1 file changed, 19 insertions(+), 1 deletion(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/modules/ve-cm/ve.ui.CodeMirrorAction.js
b/resources/modules/ve-cm/ve.ui.CodeMirrorAction.js
index cf42607..d37bc3d 100644
--- a/resources/modules/ve-cm/ve.ui.CodeMirrorAction.js
+++ b/resources/modules/ve-cm/ve.ui.CodeMirrorAction.js
@@ -69,13 +69,21 @@
've-ce-documentNode-codeEditor-webkit'
);
- // As the action is regenerated each time, we need to store the
bound listener
+ /* Events */
+
+ // As the action is regenerated each time, we need to store
bound listeners
// in the mirror for later disconnection.
surface.mirror.veTransactionListener =
this.onDocumentPrecommit.bind( this );
+ surface.mirror.veLangChangeListener = this.onLangChange.bind(
this );
doc.on( 'precommit', surface.mirror.veTransactionListener );
+ surfaceView.getDocument().on( 'langChange',
surface.mirror.veLangChangeListener );
+
+ this.onLangChange();
+
} else if ( surface.mirror && enable !== true ) {
doc.off( 'precommit', surface.mirror.veTransactionListener );
+ surfaceView.getDocument().off( 'langChange',
surface.mirror.veLangChangeListener );
// Restore edit-font
surfaceView.$element.removeClass( 'mw-editfont-monospace'
).addClass( 'mw-editfont-' + mw.user.options.get( 'editfont' ) );
@@ -93,6 +101,16 @@
};
/**
+ * Handle langChange events from the document view
+ */
+ve.ui.CodeMirrorAction.prototype.onLangChange = function () {
+ var surface = this.surface,
+ dir = surface.getView().getDocument().getDir();
+
+ surface.mirror.getWrapperElement().setAttribute( 'dir', dir );
+};
+
+/**
* Handle precommit events from the document.
*
* The document is still in it's 'old' state before the transaction
--
To view, visit https://gerrit.wikimedia.org/r/371713
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7223a57969a2299a86d73cfd57336e8d56086520
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeMirror
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits