2023-09-19 17:59:29 +00:00
|
|
|
import CodeMirrorWikiEditor from './codemirror.wikieditor';
|
2024-03-14 18:32:14 +00:00
|
|
|
import mediaWikiLang from './codemirror.mode.mediawiki';
|
2023-09-19 17:59:29 +00:00
|
|
|
|
2024-04-14 20:50:33 +00:00
|
|
|
// TODO: remove URL feature flag once bidi isolation is more stable.
|
|
|
|
const urlParams = new URLSearchParams( window.location.search );
|
|
|
|
|
2023-09-19 17:59:29 +00:00
|
|
|
if ( mw.loader.getState( 'ext.wikiEditor' ) ) {
|
|
|
|
mw.hook( 'wikiEditor.toolbarReady' ).add( ( $textarea ) => {
|
2024-03-14 18:32:14 +00:00
|
|
|
const cmWE = new CodeMirrorWikiEditor(
|
|
|
|
$textarea,
|
2024-04-14 20:50:33 +00:00
|
|
|
mediaWikiLang( {
|
|
|
|
bidiIsolation: $textarea.attr( 'dir' ) === 'rtl' && urlParams.get( 'cm6bidi' )
|
|
|
|
} )
|
2024-03-14 18:32:14 +00:00
|
|
|
);
|
2023-09-19 17:59:29 +00:00
|
|
|
cmWE.addCodeMirrorToWikiEditor();
|
|
|
|
} );
|
|
|
|
}
|