Debian Codegraph @

extensions/CodeEditor/modules/ext.codeEditor.js

raw symbols SCIP
1 /**
2 * MediaWiki:Gadget-codeeditor.js
3 * (c) 2011 Brion Vibber <brion @ pobox.com>
4 * GPLv2 or later
5 *
6 * Syntax highlighting, auto-indenting code editor widget for on-wiki JS and CSS pages.
7 * Uses embedded Ajax.org Cloud9 Editor: https://ace.c9.io/
8 *
9 * Known issues:
10 * - extension version doesn't have optional bits correct
11 * - ties into WikiEditor, so doesn't work on classic toolbar
12 * - background worker for JS syntax check doesn't load in non-debug mode (probably also fails if extension assets are offsite)
13 * - copy/paste not available from context menu (Firefox, Chrome on Linux -- kbd & main menu commands ok)
14 * - accessibility: tab/shift-tab are overridden. is there a consistent alternative for keyboard-reliant users?
15 * - accessibility: accesskey on the original textarea needs to be moved over or otherwise handled
16 * - scrollbar initializes too wide; need to trigger resize check after that's filled
17 */
18 /*
19 * JavaScript for WikiEditor Table of Contents
20 */
21
22 $( function () {
23 // eslint-disable-next-line no-jquery/no-global-selector
24 var $wpTextbox1 = $( '#wpTextbox1' );
25
26 // Code is supposed to be always LTR. See bug 39364.
27 $wpTextbox1.parent().prop( 'dir', 'ltr' );
28
29 // Add code editor module
30 $wpTextbox1.wikiEditor( 'addModule', 'codeEditor' );
31
32 $wpTextbox1.on( 'wikiEditor-toolbar-doneInitialSections', function () {
33 $wpTextbox1.data( 'wikiEditor-context' ).fn.codeEditorMonitorFragment();
34 } );
35 } );