mediawiki-extensions-CodeMi.../extension.json
MusikAnimal 13c9eae26e CodeMirrorPreferences: add panel to tweak prefs with the editor open
This is toggled by pressing Mod-Shift-, (or Command-Shift-, on MacOS),
which then puts focus on the preferences panel. It can be closed with
the Escape key, just like other CM panels.

The CodeMirror class comes with these extension which can be toggled in
preferences:
* Bracket matching
* Line numbering
* Line wrapping
* Highlight the active line
* Show special characters

Only bracket matching, line numbering, and line wrapping are available
in the 2017 editor.

The bidi isolation and template folding extensions are registered in
CodeMirrorModeMediaWiki as they are MW-specific. CodeMirrorPreferences'
new registerExtension() method allows any consumer of CodeMirror to add
any arbitrary extensions to the preferences panel. This is expected to
be called *after* CodeMirror has finished initializing. The
'ext.CodeMirror.ready' hook now passes the CodeMirror instance to
accommodate this.

The preferences are stored as a single user option in the database,
called 'codemirror-preferences'. The defaults can be configured with the
$wgCodeMirrorDefaultPreferences configuration setting. The
sysadmin-facing values are the familiar boolean, but since CodeMirror is
widely used, we make extra efforts to reduce the storage footprint (see
T54777). This includes only storing preferences that differ from the
defaults, and using binary representation instead of boolean values,
since the user option is stored as a string.

For now, all preferences are ignored in the 2017 editor. In a future
patch, we may add some as toggleable Tools in the VE toolbar.

Other changes:
* Refactor CSS to use a .darkmode() mixin
* Add a method to create a CSS-only fieldset in CodeMirrorPanel
* Fix Jest tests now that there are more calls to mw.user.options.get()
* Adjust Selenium tests to always use CM6
* Adjust Selenium tests to delete test pages (useful for local dev)
* Remove unused code

Bug: T359498
Change-Id: I70dcf2f49418cea632c452c1266440effad634f3
2024-11-18 22:23:22 -05:00

422 lines
10 KiB
JSON

{
"name": "CodeMirror",
"version": "6.0.0",
"author": [
"[https://www.mediawiki.org/wiki/User:Pastakhov Pavel Astakhov]",
"[https://www.mediawiki.org/wiki/User:Florianschmidtwelzow Florian Schmidt]",
"Marijn Haverbeke",
"MusikAnimal",
"Bhsd",
"[https://raw.githubusercontent.com/codemirror/CodeMirror/master/AUTHORS CodeMirror contributors]"
],
"url": "https://www.mediawiki.org/wiki/Extension:CodeMirror",
"descriptionmsg": "codemirror-desc",
"type": "editor",
"license-name": "GPL-2.0-or-later",
"requires": {
"MediaWiki": ">= 1.43"
},
"config": {
"CodeMirrorV6": {
"value": false,
"description": "Temporary feature flag for the CodeMirror 6 upgrade."
},
"CodeMirrorConflictingGadgets": {
"value": [
"wikEd"
],
"description": "An array of gadget names that, if enabled, will prevent CodeMirror from loading on action=edit and action=submit.",
"public": true
},
"CodeMirrorTemplateFoldingNamespaces": {
"value": null,
"description": "List of namespace IDs where template folding should be enabled, or `null` to enable for all namespaces. Set to [] to disable everywhere.",
"public": true
},
"CodeMirrorLineNumberingNamespaces": {
"value": null,
"description": "List of namespace IDs where line numbering should be enabled, or `null` to enable for all namespaces. Set to [] to disable everywhere.",
"public": true
},
"CodeMirrorDefaultPreferences": {
"value": {
"activeLine": false,
"bidiIsolation": false,
"bracketMatching": true,
"lineNumbering": true,
"lineWrapping": true,
"specialChars": true,
"templateFolding": true
},
"description": "Defaults for CodeMirror user preferences. See https://w.wiki/BwzZ for more information.",
"public": true
}
},
"MessagesDirs": {
"CodeMirror": [
"i18n"
]
},
"AutoloadNamespaces": {
"MediaWiki\\Extension\\CodeMirror\\": "includes/"
},
"ResourceModules": {
"ext.CodeMirror": {
"dependencies": [
"mediawiki.api",
"mediawiki.user",
"user.options"
],
"packageFiles": [
"legacy/ext.CodeMirror.js",
{
"name": "legacy/ext.CodeMirror.data.js",
"callback": "MediaWiki\\Extension\\CodeMirror\\DataScript::makeScript"
}
]
},
"ext.CodeMirror.WikiEditor": {
"dependencies": [
"ext.CodeMirror",
"jquery.textSelection",
"mediawiki.user",
"user.options",
"oojs-ui.styles.icons-editing-styling"
],
"packageFiles": [
"legacy/ext.CodeMirror.WikiEditor.js"
],
"styles": [
"legacy/ext.CodeMirror.less"
],
"messages": [
"codemirror-toggle-label"
]
},
"ext.CodeMirror.lib": {
"scripts": [
"lib/codemirror/lib/codemirror.js"
],
"styles": [
"lib/codemirror/lib/codemirror.css",
"legacy/codemirror-fixes.less"
]
},
"ext.CodeMirror.addons": {
"scripts": [
"legacy/addon/matchbrackets-wmde.js"
],
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.mode.mediawiki": {
"packageFiles": "legacy/mode/mediawiki/mediawiki.js",
"styles": [
"codemirror.mediawiki.less",
"codemirror.mediawiki.colorblind.less"
],
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.css": {
"scripts": "lib/codemirror/mode/css/css.js",
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.javascript": {
"scripts": "lib/codemirror/mode/javascript/javascript.js",
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.xml": {
"scripts": "lib/codemirror/mode/xml/xml.js",
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.htmlmixed": {
"scripts": "lib/codemirror/mode/htmlmixed/htmlmixed.js",
"dependencies": [
"ext.CodeMirror.lib.mode.xml",
"ext.CodeMirror.lib.mode.javascript",
"ext.CodeMirror.lib.mode.css",
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.clike": {
"scripts": "lib/codemirror/mode/clike/clike.js",
"dependencies": [
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.lib.mode.php": {
"scripts": "lib/codemirror/mode/php/php.js",
"dependencies": [
"ext.CodeMirror.lib.mode.htmlmixed",
"ext.CodeMirror.lib.mode.clike",
"ext.CodeMirror.lib"
]
},
"ext.CodeMirror.visualEditor": {
"dependencies": [
"ext.visualEditor.mwcore",
"ext.visualEditor.mwmeta",
"mediawiki.api",
"user.options",
"ext.CodeMirror"
],
"scripts": [
"legacy/modules/ve-cm/ve.ui.CodeMirrorAction.js",
"legacy/modules/ve-cm/ve.ui.CodeMirrorTool.js"
],
"styles": [
"legacy/modules/ve-cm/ve.ui.CodeMirror.less",
"legacy/ext.CodeMirror.less"
],
"messages": [
"codemirror-toggle-label"
]
},
"ext.CodeMirror.v6": {
"class": "MediaWiki\\ResourceLoader\\CodexModule",
"dependencies": [
"mediawiki.api",
"mediawiki.user",
"user.options",
"ext.CodeMirror.v6.lib"
],
"packageFiles": [
"codemirror.js",
"codemirror.textSelection.js",
"codemirror.panel.js",
"codemirror.search.js",
"codemirror.gotoLine.js",
"codemirror.preferences.js",
{
"name": "ext.CodeMirror.data.js",
"callback": "MediaWiki\\Extension\\CodeMirror\\DataScript::makeScript"
}
],
"styles": [
"codemirror.less"
],
"codexStyleOnly": true,
"codexComponents": [
"CdxButton",
"CdxCheckbox",
"CdxLabel",
"CdxField",
"CdxTextInput",
"CdxToggleButton",
"CdxToggleButtonGroup"
],
"messages": [
"codemirror-all",
"codemirror-all-tooltip",
"codemirror-by-word",
"codemirror-close",
"codemirror-control-character",
"codemirror-done",
"codemirror-find",
"codemirror-find-results",
"codemirror-folded-code",
"codemirror-goto-line",
"codemirror-goto-line-go",
"codemirror-match-case",
"codemirror-next",
"codemirror-prefs-activeline",
"codemirror-prefs-bracketmatching",
"codemirror-prefs-linenumbering",
"codemirror-prefs-linewrapping",
"codemirror-prefs-specialchars",
"codemirror-prefs-title",
"codemirror-previous",
"codemirror-regexp",
"codemirror-replace",
"codemirror-replace-all",
"codemirror-replace-placeholder",
"codemirror-special-char-backspace",
"codemirror-special-char-bell",
"codemirror-special-char-carriage-return",
"codemirror-special-char-escape",
"codemirror-special-char-left-to-right-isolate",
"codemirror-special-char-left-to-right-mark",
"codemirror-special-char-left-to-right-override",
"codemirror-special-char-line-separator",
"codemirror-special-char-narrow-nbsp",
"codemirror-special-char-nbsp",
"codemirror-special-char-newline",
"codemirror-special-char-null",
"codemirror-special-char-object-replacement",
"codemirror-special-char-paragraph-separator",
"codemirror-special-char-pop-directional-isolate",
"codemirror-special-char-right-to-left-isolate",
"codemirror-special-char-right-to-left-mark",
"codemirror-special-char-right-to-left-override",
"codemirror-special-char-vertical-tab",
"codemirror-special-char-zero-width-joiner",
"codemirror-special-char-zero-width-no-break-space",
"codemirror-special-char-zero-width-non-joiner",
"codemirror-special-char-zero-width-space",
"codemirror-unfold"
]
},
"ext.CodeMirror.v6.init": {
"dependencies": [
"ext.CodeMirror.v6",
"ext.CodeMirror.v6.mode.mediawiki"
],
"packageFiles": [
"codemirror.mediawiki.init.js"
]
},
"ext.CodeMirror.v6.lib": {
"packageFiles": [
"lib/codemirror6.bundle.dist.js"
]
},
"ext.CodeMirror.v6.mode.mediawiki": {
"packageFiles": [
"codemirror.mediawiki.js",
"codemirror.mediawiki.config.js",
"codemirror.mediawiki.bidiIsolation.js",
"codemirror.mediawiki.templateFolding.js"
],
"styles": [
"codemirror.mediawiki.less",
"codemirror.mediawiki.colorblind.less"
],
"dependencies": [
"ext.CodeMirror.v6",
"ext.CodeMirror.v6.lib"
],
"messages": [
"codemirror-fold-template",
"codemirror-prefs-bidiisolation",
"codemirror-prefs-templatefolding"
]
},
"ext.CodeMirror.v6.WikiEditor": {
"dependencies": [
"ext.wikiEditor"
],
"packageFiles": [
"codemirror.wikieditor.js"
],
"styles": [
"codemirror.wikieditor.less"
],
"messages": [
"codemirror-toggle-label",
"codemirror-toggle-label-short"
]
},
"ext.CodeMirror.v6.WikiEditor.init": {
"dependencies": [
"ext.CodeMirror.v6.WikiEditor",
"ext.CodeMirror.v6.mode.mediawiki"
],
"packageFiles": [
"codemirror.wikieditor.mediawiki.init.js"
]
},
"ext.CodeMirror.v6.visualEditor": {
"dependencies": [
"ext.visualEditor.mwcore",
"ext.visualEditor.mwmeta",
"mediawiki.api",
"user.options",
"ext.CodeMirror.v6"
],
"scripts": [
"ve-cm/ve.ui.CodeMirrorAction.v6.js",
"ve-cm/ve.ui.CodeMirrorTool.v6.js"
],
"styles": [
"ve-cm/ve.ui.CodeMirror.v6.less"
],
"messages": [
"codemirror-toggle-label"
]
},
"ext.CodeMirror.visualEditor.init": {
"packageFiles": [
"ve-cm/ve.ui.CodeMirror.init.js",
{
"name": "ext.CodeMirror.data.js",
"callback": "MediaWiki\\Extension\\CodeMirror\\DataScript::makeScript"
}
]
}
},
"ResourceFileModulePaths": {
"localBasePath": "resources",
"remoteExtPath": "CodeMirror/resources"
},
"ForeignResourcesDir": "resources/lib",
"DefaultUserOptions": {
"usecodemirror": 0,
"usecodemirror-colorblind": 0,
"codemirror-preferences": ""
},
"QUnitTestModule": {
"localBasePath": "resources/legacy/mode/mediawiki/tests",
"remoteExtPath": "CodeMirror/resources/legacy/mode/mediawiki/tests",
"packageFiles": [
"qunit/CodeMirror.mediawiki.test.js"
],
"dependencies": [
"ext.CodeMirror",
"ext.CodeMirror.lib",
"ext.CodeMirror.mode.mediawiki"
]
},
"Hooks": {
"EditPage::showEditForm:initial": "main",
"EditPage::showReadOnlyForm:initial": "main",
"GetPreferences": "main",
"ResourceLoaderGetConfigVars": "main"
},
"HookHandlers": {
"main": {
"class": "MediaWiki\\Extension\\CodeMirror\\Hooks",
"services": [
"UserOptionsLookup",
"MainConfig"
],
"optional_services": [
"GadgetsRepo"
]
}
},
"attributes": {
"CodeMirror": {
"ContentModels": [
"wikitext"
],
"PluginModules": [
"ext.CodeMirror.addons"
],
"TagModes": {
"pre": "mw-tag-pre",
"nowiki": "mw-tag-nowiki"
}
},
"VisualEditor": {
"PluginModules": [
"ext.CodeMirror.visualEditor.init"
]
},
"EventLogging": {
"Schemas": {
"CodeMirrorUsage": "/analytics/legacy/codemirrorusage/1.0.0"
}
}
},
"manifest_version": 2
}