Extension:CodeEditor/zh

代码编辑器扩展给予WikiEditor高级编辑工具栏一个嵌入式的Ace编辑器部件，为用户/网站的JavaScript页面、CSS页面、JSON页面以及其他由已安装扩展提供的页面（如“Module”名字空间提供的Lua页面）提供一些便利. 代码编辑器不会在常规Wiki页面（即内容模型为“wikitext”的页面）上显示. (See for syntax highlighting of wikitext when using the source editor.)

它提供以下功能：


 * 为JavaScript、CSS和Lua提供语法高亮
 * 自动缩进
 * 1.22版本起Tab键会生成制表符缩进，而之前是软缩进.
 * 使用Tab/Shift+Tab键进行缩进的增减
 * 针对JavaScript的语法有效性检查
 * 括号、大括号和方括号的配对标示

配置

 * 要在MediaWiki、用户和其他核心名字空间中的JavaScript和CSS页面上禁用编辑器，设置（默认为“true”）
 * 要在MediaWiki、用户和其他核心名字空间中的JavaScript和CSS页面上禁用编辑器，设置（默认为“true”）


 * 如要为Scribunto（即“模块”名字空间）禁用此扩展，请将设为false，默认是"true"
 * 如要为Scribunto（即“模块”名字空间）禁用此扩展，请将设为false，默认是"true"

JavaScript
可以更改ACE编辑器的配置，只需使用MediaWiki JS hook (i.e. ）. 传递给您的hook的参数是一个ACE编辑器会话.



Wiki编辑器集成
'' I've been integrating CodeEditor into the pluggable portions of as prep for Future editor work, since we'll want to be able to extend it to edit things that aren't plain wikitext, which'll need some changes to the toolbar setup and whatnot.   JS/CSS here still return plain text in the end, making it an easier intermediate project. --brion 00:26, 14 June 2011 (UTC) ''

Good:


 * special char insertions work, including quote pairs to surround text
 * basic formatting insertions work, including link dialogs
 * search/replace dialog works
 * ace's built-in search/replace UI also triggers from keyboard commands, still need to disable them! (onCommandKey)

Bad:


 * multi-line formatting doesn't apply correctly (but really should that apply here? :)

To-do:


 * remove toolbar buttons that don't apply (formatting, syntax help?)
 * add toolbar buttons that are more directly useful
 * indent/outdent
 * insertion helpers for common keywords or code bits
 * help reference to MW JS API reference, JS & CSS specs/documentation



已知的问题

 * accessibility: tab/shift-tab are overridden. Is there a consistent alternative for keyboard-reliant users?
 * accessibility: access key on the original textarea needs to be moved over or otherwise handled
 * scrollbar initializes too wide; need to trigger resize check after that's filled (maybe fixed?)
 * cursor/scroll position not maintained over previews/show changes

许可证
尽管此扩展以GNU通用公共许可证2.0版或更高版本（GPL-2.0+）授权，它同样使用Ace编辑器软件，而它则以3句版BSD许可证“新版”或“修正版”（BSD-3-Clause）授权.