| 1 |
ace.define("ace/ext/menu_tools/settings_menu.css",["require","exports","module"], function(require, exports, module){module.exports = "#ace_settingsmenu, #kbshortcutmenu {\n background-color: #F7F7F7;\n color: black;\n box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\n padding: 1em 0.5em 2em 1em;\n overflow: auto;\n position: absolute;\n margin: 0;\n bottom: 0;\n right: 0;\n top: 0;\n z-index: 9991;\n cursor: default;\n}\n\n.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\n box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\n background-color: rgba(255, 255, 255, 0.6);\n color: black;\n}\n\n.ace_optionsMenuEntry:hover {\n background-color: rgba(100, 100, 100, 0.1);\n transition: all 0.3s\n}\n\n.ace_closeButton {\n background: rgba(245, 146, 146, 0.5);\n border: 1px solid #F48A8A;\n border-radius: 50%;\n padding: 7px;\n position: absolute;\n right: -8px;\n top: -8px;\n z-index: 100000;\n}\n.ace_closeButton{\n background: rgba(245, 146, 146, 0.9);\n}\n.ace_optionsMenuKey {\n color: darkslateblue;\n font-weight: bold;\n}\n.ace_optionsMenuCommand {\n color: darkcyan;\n font-weight: normal;\n}\n.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\n vertical-align: middle;\n}\n\n.ace_optionsMenuEntry button[ace_selected_button=true] {\n background: #e7e7e7;\n box-shadow: 1px 0px 2px 0px #adadad inset;\n border-color: #adadad;\n}\n.ace_optionsMenuEntry button {\n background: white;\n border: 1px solid lightgray;\n margin: 0px;\n}\n.ace_optionsMenuEntry button:hover{\n background: #f0f0f0;\n}"; |
| 2 |
|
| 3 |
}); |
| 4 |
|
| 5 |
ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom","ace/ext/menu_tools/settings_menu.css"], function(require, exports, module){ |
| 6 |
'use strict'; |
| 7 |
var dom = require("../../lib/dom"); |
| 8 |
var cssText = require("./settings_menu.css"); |
| 9 |
dom.importCssString(cssText, "settings_menu.css", false); |
| 10 |
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { |
| 11 |
var closer = document.createElement('div'); |
| 12 |
var ignoreFocusOut = false; |
| 13 |
function documentEscListener(e) { |
| 14 |
if (e.keyCode === 27) { |
| 15 |
close(); |
| 16 |
} |
| 17 |
} |
| 18 |
function close() { |
| 19 |
if (!closer) |
| 20 |
return; |
| 21 |
document.removeEventListener('keydown', documentEscListener); |
| 22 |
closer.parentNode.removeChild(closer); |
| 23 |
if (editor) { |
| 24 |
editor.focus(); |
| 25 |
} |
| 26 |
closer = null; |
| 27 |
callback && callback(); |
| 28 |
} |
| 29 |
function setIgnoreFocusOut(ignore) { |
| 30 |
ignoreFocusOut = ignore; |
| 31 |
if (ignore) { |
| 32 |
closer.style.pointerEvents = "none"; |
| 33 |
contentElement.style.pointerEvents = "auto"; |
| 34 |
} |
| 35 |
} |
| 36 |
closer.style.cssText = 'margin: 0; padding: 0; ' + |
| 37 |
'position: fixed; top:0; bottom:0; left:0; right:0;' + |
| 38 |
'z-index: 9990; ' + |
| 39 |
(editor ? 'background-color: rgba(0, 0, 0, 0.3);' : ''); |
| 40 |
closer.addEventListener('click', function (e) { |
| 41 |
if (!ignoreFocusOut) { |
| 42 |
close(); |
| 43 |
} |
| 44 |
}); |
| 45 |
document.addEventListener('keydown', documentEscListener); |
| 46 |
contentElement.addEventListener('click', function (e) { |
| 47 |
e.stopPropagation(); |
| 48 |
}); |
| 49 |
closer.appendChild(contentElement); |
| 50 |
document.body.appendChild(closer); |
| 51 |
if (editor) { |
| 52 |
editor.blur(); |
| 53 |
} |
| 54 |
return { |
| 55 |
close: close, |
| 56 |
setIgnoreFocusOut: setIgnoreFocusOut |
| 57 |
}; |
| 58 |
}; |
| 59 |
|
| 60 |
}); |
| 61 |
|
| 62 |
ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module){"use strict"; |
| 63 |
var modes = []; |
| 64 |
function getModeForPath(path) { |
| 65 |
var mode = modesByName.text; |
| 66 |
var fileName = path.split(/[\/\\]/).pop(); |
| 67 |
for (var i = 0; i < modes.length; i++) { |
| 68 |
if (modes[i].supportsFile(fileName)) { |
| 69 |
mode = modes[i]; |
| 70 |
break; |
| 71 |
} |
| 72 |
} |
| 73 |
return mode; |
| 74 |
} |
| 75 |
var Mode = (function () { |
| 76 |
function Mode(name, caption, extensions) { |
| 77 |
this.name = name; |
| 78 |
this.caption = caption; |
| 79 |
this.mode = "ace/mode/" + name; |
| 80 |
this.extensions = extensions; |
| 81 |
var re; |
| 82 |
if (/\^/.test(extensions)) { |
| 83 |
re = extensions.replace(/\|(\^)?/g, function (a, b) { |
| 84 |
return "$|" + (b ? "^" : "^.*\\."); |
| 85 |
}) + "$"; |
| 86 |
} |
| 87 |
else { |
| 88 |
re = "^.*\\.(" + extensions + ")$"; |
| 89 |
} |
| 90 |
this.extRe = new RegExp(re, "gi"); |
| 91 |
} |
| 92 |
Mode.prototype.supportsFile = function (filename) { |
| 93 |
return filename.match(this.extRe); |
| 94 |
}; |
| 95 |
return Mode; |
| 96 |
}()); |
| 97 |
var supportedModes = { |
| 98 |
ABAP: ["abap"], |
| 99 |
ABC: ["abc"], |
| 100 |
ActionScript: ["as"], |
| 101 |
ADA: ["ada|adb"], |
| 102 |
Alda: ["alda"], |
| 103 |
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], |
| 104 |
Apex: ["apex|cls|trigger|tgr"], |
| 105 |
AQL: ["aql"], |
| 106 |
AsciiDoc: ["asciidoc|adoc"], |
| 107 |
ASL: ["dsl|asl|asl.json"], |
| 108 |
Assembly_ARM32: ["s"], |
| 109 |
Assembly_x86: ["asm|a"], |
| 110 |
Astro: ["astro"], |
| 111 |
AutoHotKey: ["ahk"], |
| 112 |
BatchFile: ["bat|cmd"], |
| 113 |
BibTeX: ["bib"], |
| 114 |
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], |
| 115 |
C9Search: ["c9search_results"], |
| 116 |
Cirru: ["cirru|cr"], |
| 117 |
Clojure: ["clj|cljs"], |
| 118 |
Cobol: ["CBL|COB"], |
| 119 |
coffee: ["coffee|cf|cson|^Cakefile"], |
| 120 |
ColdFusion: ["cfm|cfc"], |
| 121 |
Crystal: ["cr"], |
| 122 |
CSharp: ["cs"], |
| 123 |
Csound_Document: ["csd"], |
| 124 |
Csound_Orchestra: ["orc"], |
| 125 |
Csound_Score: ["sco"], |
| 126 |
CSS: ["css"], |
| 127 |
Curly: ["curly"], |
| 128 |
Cuttlefish: ["conf"], |
| 129 |
D: ["d|di"], |
| 130 |
Dart: ["dart"], |
| 131 |
Diff: ["diff|patch"], |
| 132 |
Django: ["djt|html.djt|dj.html|djhtml"], |
| 133 |
Dockerfile: ["^Dockerfile"], |
| 134 |
Dot: ["dot"], |
| 135 |
Drools: ["drl"], |
| 136 |
Edifact: ["edi"], |
| 137 |
Eiffel: ["e|ge"], |
| 138 |
EJS: ["ejs"], |
| 139 |
Elixir: ["ex|exs"], |
| 140 |
Elm: ["elm"], |
| 141 |
Erlang: ["erl|hrl"], |
| 142 |
Flix: ["flix"], |
| 143 |
Forth: ["frt|fs|ldr|fth|4th"], |
| 144 |
Fortran: ["f|f90"], |
| 145 |
FSharp: ["fsi|fs|ml|mli|fsx|fsscript"], |
| 146 |
FSL: ["fsl"], |
| 147 |
FTL: ["ftl"], |
| 148 |
Gcode: ["gcode"], |
| 149 |
Gherkin: ["feature"], |
| 150 |
Gitignore: ["^.gitignore"], |
| 151 |
Glsl: ["glsl|frag|vert"], |
| 152 |
Gobstones: ["gbs"], |
| 153 |
golang: ["go"], |
| 154 |
GraphQLSchema: ["gql"], |
| 155 |
Groovy: ["groovy"], |
| 156 |
HAML: ["haml"], |
| 157 |
Handlebars: ["hbs|handlebars|tpl|mustache"], |
| 158 |
Haskell: ["hs"], |
| 159 |
Haskell_Cabal: ["cabal"], |
| 160 |
haXe: ["hx"], |
| 161 |
Hjson: ["hjson"], |
| 162 |
HTML: ["html|htm|xhtml|we|wpy"], |
| 163 |
HTML_Elixir: ["eex|html.eex"], |
| 164 |
HTML_Ruby: ["erb|rhtml|html.erb"], |
| 165 |
INI: ["ini|conf|cfg|prefs"], |
| 166 |
Io: ["io"], |
| 167 |
Ion: ["ion"], |
| 168 |
Jack: ["jack"], |
| 169 |
Jade: ["jade|pug"], |
| 170 |
Java: ["java"], |
| 171 |
JavaScript: ["js|jsm|cjs|mjs"], |
| 172 |
JEXL: ["jexl"], |
| 173 |
JSON: ["json"], |
| 174 |
JSON5: ["json5"], |
| 175 |
JSONiq: ["jq"], |
| 176 |
JSP: ["jsp"], |
| 177 |
JSSM: ["jssm|jssm_state"], |
| 178 |
JSX: ["jsx"], |
| 179 |
Julia: ["jl"], |
| 180 |
Kotlin: ["kt|kts"], |
| 181 |
LaTeX: ["tex|latex|ltx|bib"], |
| 182 |
Latte: ["latte"], |
| 183 |
LESS: ["less"], |
| 184 |
Liquid: ["liquid"], |
| 185 |
Lisp: ["lisp"], |
| 186 |
LiveScript: ["ls"], |
| 187 |
Log: ["log"], |
| 188 |
LogiQL: ["logic|lql"], |
| 189 |
Logtalk: ["lgt"], |
| 190 |
LSL: ["lsl"], |
| 191 |
Lua: ["lua"], |
| 192 |
LuaPage: ["lp"], |
| 193 |
Lucene: ["lucene"], |
| 194 |
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], |
| 195 |
Markdown: ["md|markdown"], |
| 196 |
Mask: ["mask"], |
| 197 |
MATLAB: ["matlab"], |
| 198 |
Maze: ["mz"], |
| 199 |
MediaWiki: ["wiki|mediawiki"], |
| 200 |
MEL: ["mel"], |
| 201 |
MIPS: ["s|asm"], |
| 202 |
MIXAL: ["mixal"], |
| 203 |
MUSHCode: ["mc|mush"], |
| 204 |
MySQL: ["mysql"], |
| 205 |
Nasal: ["nas"], |
| 206 |
Nginx: ["nginx|conf"], |
| 207 |
Nim: ["nim"], |
| 208 |
Nix: ["nix"], |
| 209 |
NSIS: ["nsi|nsh"], |
| 210 |
Nunjucks: ["nunjucks|nunjs|nj|njk"], |
| 211 |
ObjectiveC: ["m|mm"], |
| 212 |
OCaml: ["ml|mli"], |
| 213 |
Odin: ["odin"], |
| 214 |
PartiQL: ["partiql|pql"], |
| 215 |
Pascal: ["pas|p"], |
| 216 |
Perl: ["pl|pm"], |
| 217 |
pgSQL: ["pgsql"], |
| 218 |
PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], |
| 219 |
PHP_Laravel_blade: ["blade.php"], |
| 220 |
Pig: ["pig"], |
| 221 |
PLSQL: ["plsql"], |
| 222 |
Powershell: ["ps1"], |
| 223 |
Praat: ["praat|praatscript|psc|proc"], |
| 224 |
Prisma: ["prisma"], |
| 225 |
Prolog: ["plg|prolog"], |
| 226 |
Properties: ["properties"], |
| 227 |
Protobuf: ["proto"], |
| 228 |
PRQL: ["prql"], |
| 229 |
Puppet: ["epp|pp"], |
| 230 |
Python: ["py"], |
| 231 |
QML: ["qml"], |
| 232 |
R: ["r"], |
| 233 |
Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], |
| 234 |
Razor: ["cshtml|asp"], |
| 235 |
RDoc: ["Rd"], |
| 236 |
Red: ["red|reds"], |
| 237 |
RHTML: ["Rhtml"], |
| 238 |
Robot: ["robot|resource"], |
| 239 |
RST: ["rst"], |
| 240 |
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], |
| 241 |
Rust: ["rs"], |
| 242 |
SaC: ["sac"], |
| 243 |
SASS: ["sass"], |
| 244 |
SCAD: ["scad"], |
| 245 |
Scala: ["scala|sbt"], |
| 246 |
Scheme: ["scm|sm|rkt|oak|scheme"], |
| 247 |
Scrypt: ["scrypt"], |
| 248 |
SCSS: ["scss"], |
| 249 |
SH: ["sh|bash|^.bashrc"], |
| 250 |
SJS: ["sjs"], |
| 251 |
Slim: ["slim|skim"], |
| 252 |
Smarty: ["smarty|tpl"], |
| 253 |
Smithy: ["smithy"], |
| 254 |
snippets: ["snippets"], |
| 255 |
Soy_Template: ["soy"], |
| 256 |
Space: ["space"], |
| 257 |
SPARQL: ["rq"], |
| 258 |
SQL: ["sql"], |
| 259 |
SQLServer: ["sqlserver"], |
| 260 |
Stylus: ["styl|stylus"], |
| 261 |
SVG: ["svg"], |
| 262 |
Swift: ["swift"], |
| 263 |
Tcl: ["tcl"], |
| 264 |
Terraform: ["tf", "tfvars", "terragrunt"], |
| 265 |
Tex: ["tex"], |
| 266 |
Text: ["txt"], |
| 267 |
Textile: ["textile"], |
| 268 |
Toml: ["toml"], |
| 269 |
TSX: ["tsx"], |
| 270 |
Turtle: ["ttl"], |
| 271 |
Twig: ["twig|swig"], |
| 272 |
Typescript: ["ts|mts|cts|typescript|str"], |
| 273 |
Vala: ["vala"], |
| 274 |
VBScript: ["vbs|vb"], |
| 275 |
Velocity: ["vm"], |
| 276 |
Verilog: ["v|vh|sv|svh"], |
| 277 |
VHDL: ["vhd|vhdl"], |
| 278 |
Visualforce: ["vfp|component|page"], |
| 279 |
Vue: ["vue"], |
| 280 |
Wollok: ["wlk|wpgm|wtest"], |
| 281 |
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"], |
| 282 |
XQuery: ["xq"], |
| 283 |
YAML: ["yaml|yml"], |
| 284 |
Zeek: ["zeek|bro"], |
| 285 |
Zig: ["zig"] |
| 286 |
}; |
| 287 |
var nameOverrides = { |
| 288 |
ObjectiveC: "Objective-C", |
| 289 |
CSharp: "C#", |
| 290 |
golang: "Go", |
| 291 |
C_Cpp: "C and C++", |
| 292 |
Csound_Document: "Csound Document", |
| 293 |
Csound_Orchestra: "Csound", |
| 294 |
Csound_Score: "Csound Score", |
| 295 |
coffee: "CoffeeScript", |
| 296 |
HTML_Ruby: "HTML (Ruby)", |
| 297 |
HTML_Elixir: "HTML (Elixir)", |
| 298 |
FTL: "FreeMarker", |
| 299 |
PHP_Laravel_blade: "PHP (Blade Template)", |
| 300 |
Perl6: "Perl 6", |
| 301 |
AutoHotKey: "AutoHotkey / AutoIt" |
| 302 |
}; |
| 303 |
var modesByName = {}; |
| 304 |
for (var name in supportedModes) { |
| 305 |
var data = supportedModes[name]; |
| 306 |
var displayName = (nameOverrides[name] || name).replace(/_/g, " "); |
| 307 |
var filename = name.toLowerCase(); |
| 308 |
var mode = new Mode(filename, displayName, data[0]); |
| 309 |
modesByName[filename] = mode; |
| 310 |
modes.push(mode); |
| 311 |
} |
| 312 |
module.exports = { |
| 313 |
getModeForPath: getModeForPath, |
| 314 |
modes: modes, |
| 315 |
modesByName: modesByName |
| 316 |
}; |
| 317 |
|
| 318 |
}); |
| 319 |
|
| 320 |
ace.define("ace/ext/themelist",["require","exports","module"], function(require, exports, module){ |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
☠|
| 326 |
|
| 327 |
"use strict"; |
| 328 |
var themeData = [ |
| 329 |
["Chrome"], |
| 330 |
["Clouds"], |
| 331 |
["Crimson Editor"], |
| 332 |
["Dawn"], |
| 333 |
["Dreamweaver"], |
| 334 |
["Eclipse"], |
| 335 |
["GitHub"], |
| 336 |
["IPlastic"], |
| 337 |
["Solarized Light"], |
| 338 |
["TextMate"], |
| 339 |
["Tomorrow"], |
| 340 |
["XCode"], |
| 341 |
["Kuroir"], |
| 342 |
["KatzenMilch"], |
| 343 |
["SQL Server", "sqlserver", "light"], |
| 344 |
["CloudEditor", "cloud_editor", "light"], |
| 345 |
["Ambiance", "ambiance", "dark"], |
| 346 |
["Chaos", "chaos", "dark"], |
| 347 |
["Clouds Midnight", "clouds_midnight", "dark"], |
| 348 |
["Dracula", "", "dark"], |
| 349 |
["Cobalt", "cobalt", "dark"], |
| 350 |
["Gruvbox", "gruvbox", "dark"], |
| 351 |
["Green on Black", "gob", "dark"], |
| 352 |
["idle Fingers", "idle_fingers", "dark"], |
| 353 |
["krTheme", "kr_theme", "dark"], |
| 354 |
["Merbivore", "merbivore", "dark"], |
| 355 |
["Merbivore Soft", "merbivore_soft", "dark"], |
| 356 |
["Mono Industrial", "mono_industrial", "dark"], |
| 357 |
["Monokai", "monokai", "dark"], |
| 358 |
["Nord Dark", "nord_dark", "dark"], |
| 359 |
["One Dark", "one_dark", "dark"], |
| 360 |
["Pastel on dark", "pastel_on_dark", "dark"], |
| 361 |
["Solarized Dark", "solarized_dark", "dark"], |
| 362 |
["Terminal", "terminal", "dark"], |
| 363 |
["Tomorrow Night", "tomorrow_night", "dark"], |
| 364 |
["Tomorrow Night Blue", "tomorrow_night_blue", "dark"], |
| 365 |
["Tomorrow Night Bright", "tomorrow_night_bright", "dark"], |
| 366 |
["Tomorrow Night 80s", "tomorrow_night_eighties", "dark"], |
| 367 |
["Twilight", "twilight", "dark"], |
| 368 |
["Vibrant Ink", "vibrant_ink", "dark"], |
| 369 |
["GitHub Dark", "github_dark", "dark"], |
| 370 |
["CloudEditor Dark", "cloud_editor_dark", "dark"] |
| 371 |
]; |
| 372 |
exports.themesByName = {}; |
| 373 |
exports.themes = themeData.map(function (data) { |
| 374 |
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase(); |
| 375 |
var theme = { |
| 376 |
caption: data[0], |
| 377 |
theme: "ace/theme/" + name, |
| 378 |
isDark: data[2] == "dark", |
| 379 |
name: name |
| 380 |
}; |
| 381 |
exports.themesByName[name] = theme; |
| 382 |
return theme; |
| 383 |
}); |
| 384 |
|
| 385 |
}); |
| 386 |
|
| 387 |
ace.define("ace/ext/options",["require","exports","module","ace/ext/menu_tools/overlay_page","ace/lib/dom","ace/lib/oop","ace/config","ace/lib/event_emitter","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module){"use strict"; |
| 388 |
require("./menu_tools/overlay_page"); |
| 389 |
var dom = require("../lib/dom"); |
| 390 |
var oop = require("../lib/oop"); |
| 391 |
var config = require("../config"); |
| 392 |
var EventEmitter = require("../lib/event_emitter").EventEmitter; |
| 393 |
var buildDom = dom.buildDom; |
| 394 |
var modelist = require("./modelist"); |
| 395 |
var themelist = require("./themelist"); |
| 396 |
var themes = { Bright: [], Dark: [] }; |
| 397 |
themelist.themes.forEach(function (x) { |
| 398 |
themes[x.isDark ? "Dark" : "Bright"].push({ caption: x.caption, value: x.theme }); |
| 399 |
}); |
| 400 |
var modes = modelist.modes.map(function (x) { |
| 401 |
return { caption: x.caption, value: x.mode }; |
| 402 |
}); |
| 403 |
var optionGroups = { |
| 404 |
Main: { |
| 405 |
Mode: { |
| 406 |
path: "mode", |
| 407 |
type: "select", |
| 408 |
items: modes |
| 409 |
}, |
| 410 |
Theme: { |
| 411 |
path: "theme", |
| 412 |
type: "select", |
| 413 |
items: themes |
| 414 |
}, |
| 415 |
"Keybinding": { |
| 416 |
type: "buttonBar", |
| 417 |
path: "keyboardHandler", |
| 418 |
items: [ |
| 419 |
{ caption: "Ace", value: null }, |
| 420 |
{ caption: "Vim", value: "ace/keyboard/vim" }, |
| 421 |
{ caption: "Emacs", value: "ace/keyboard/emacs" }, |
| 422 |
{ caption: "Sublime", value: "ace/keyboard/sublime" }, |
| 423 |
{ caption: "VSCode", value: "ace/keyboard/vscode" } |
| 424 |
] |
| 425 |
}, |
| 426 |
"Font Size": { |
| 427 |
path: "fontSize", |
| 428 |
type: "number", |
| 429 |
defaultValue: 12, |
| 430 |
defaults: [ |
| 431 |
{ caption: "12px", value: 12 }, |
| 432 |
{ caption: "24px", value: 24 } |
| 433 |
] |
| 434 |
}, |
| 435 |
"Soft Wrap": { |
| 436 |
type: "buttonBar", |
| 437 |
path: "wrap", |
| 438 |
items: [ |
| 439 |
{ caption: "Off", value: "off" }, |
| 440 |
{ caption: "View", value: "free" }, |
| 441 |
{ caption: "margin", value: "printMargin" }, |
| 442 |
{ caption: "40", value: "40" } |
| 443 |
] |
| 444 |
}, |
| 445 |
"Cursor Style": { |
| 446 |
path: "cursorStyle", |
| 447 |
items: [ |
| 448 |
{ caption: "Ace", value: "ace" }, |
| 449 |
{ caption: "Slim", value: "slim" }, |
| 450 |
{ caption: "Smooth", value: "smooth" }, |
| 451 |
{ caption: "Smooth And Slim", value: "smooth slim" }, |
| 452 |
{ caption: "Wide", value: "wide" } |
| 453 |
] |
| 454 |
}, |
| 455 |
"Folding": { |
| 456 |
path: "foldStyle", |
| 457 |
items: [ |
| 458 |
{ caption: "Manual", value: "manual" }, |
| 459 |
{ caption: "Mark begin", value: "markbegin" }, |
| 460 |
{ caption: "Mark begin and end", value: "markbeginend" } |
| 461 |
] |
| 462 |
}, |
| 463 |
"Soft Tabs": [{ |
| 464 |
path: "useSoftTabs" |
| 465 |
}, { |
| 466 |
ariaLabel: "Tab Size", |
| 467 |
path: "tabSize", |
| 468 |
type: "number", |
| 469 |
values: [2, 3, 4, 8, 16] |
| 470 |
}], |
| 471 |
"Overscroll": { |
| 472 |
type: "buttonBar", |
| 473 |
path: "scrollPastEnd", |
| 474 |
items: [ |
| 475 |
{ caption: "None", value: 0 }, |
| 476 |
{ caption: "Half", value: 0.5 }, |
| 477 |
{ caption: "Full", value: 1 } |
| 478 |
] |
| 479 |
} |
| 480 |
}, |
| 481 |
More: { |
| 482 |
"Atomic soft tabs": { |
| 483 |
path: "navigateWithinSoftTabs" |
| 484 |
}, |
| 485 |
"Enable Behaviours": { |
| 486 |
path: "behavioursEnabled" |
| 487 |
}, |
| 488 |
"Wrap with quotes": { |
| 489 |
path: "wrapBehavioursEnabled" |
| 490 |
}, |
| 491 |
"Enable Auto Indent": { |
| 492 |
path: "enableAutoIndent" |
| 493 |
}, |
| 494 |
"Full Line Selection": { |
| 495 |
type: "checkbox", |
| 496 |
values: "text|line", |
| 497 |
path: "selectionStyle" |
| 498 |
}, |
| 499 |
"Highlight Active Line": { |
| 500 |
path: "highlightActiveLine" |
| 501 |
}, |
| 502 |
"Show Invisibles": { |
| 503 |
path: "showInvisibles" |
| 504 |
}, |
| 505 |
"Show Indent Guides": { |
| 506 |
path: "displayIndentGuides" |
| 507 |
}, |
| 508 |
"Highlight Indent Guides": { |
| 509 |
path: "highlightIndentGuides" |
| 510 |
}, |
| 511 |
"Persistent HScrollbar": { |
| 512 |
path: "hScrollBarAlwaysVisible" |
| 513 |
}, |
| 514 |
"Persistent VScrollbar": { |
| 515 |
path: "vScrollBarAlwaysVisible" |
| 516 |
}, |
| 517 |
"Animate scrolling": { |
| 518 |
path: "animatedScroll" |
| 519 |
}, |
| 520 |
"Show Gutter": { |
| 521 |
path: "showGutter" |
| 522 |
}, |
| 523 |
"Show Line Numbers": { |
| 524 |
path: "showLineNumbers" |
| 525 |
}, |
| 526 |
"Relative Line Numbers": { |
| 527 |
path: "relativeLineNumbers" |
| 528 |
}, |
| 529 |
"Fixed Gutter Width": { |
| 530 |
path: "fixedWidthGutter" |
| 531 |
}, |
| 532 |
"Show Print Margin": [{ |
| 533 |
path: "showPrintMargin" |
| 534 |
}, { |
| 535 |
ariaLabel: "Print Margin", |
| 536 |
type: "number", |
| 537 |
path: "printMarginColumn" |
| 538 |
}], |
| 539 |
"Indented Soft Wrap": { |
| 540 |
path: "indentedSoftWrap" |
| 541 |
}, |
| 542 |
"Highlight selected word": { |
| 543 |
path: "highlightSelectedWord" |
| 544 |
}, |
| 545 |
"Fade Fold Widgets": { |
| 546 |
path: "fadeFoldWidgets" |
| 547 |
}, |
| 548 |
"Use textarea for IME": { |
| 549 |
path: "useTextareaForIME" |
| 550 |
}, |
| 551 |
"Merge Undo Deltas": { |
| 552 |
path: "mergeUndoDeltas", |
| 553 |
items: [ |
| 554 |
{ caption: "Always", value: "always" }, |
| 555 |
{ caption: "Never", value: "false" }, |
| 556 |
{ caption: "Timed", value: "true" } |
| 557 |
] |
| 558 |
}, |
| 559 |
"Elastic Tabstops": { |
| 560 |
path: "useElasticTabstops" |
| 561 |
}, |
| 562 |
"Incremental Search": { |
| 563 |
path: "useIncrementalSearch" |
| 564 |
}, |
| 565 |
"Read-only": { |
| 566 |
path: "readOnly" |
| 567 |
}, |
| 568 |
"Copy without selection": { |
| 569 |
path: "copyWithEmptySelection" |
| 570 |
}, |
| 571 |
"Live Autocompletion": { |
| 572 |
path: "enableLiveAutocompletion" |
| 573 |
}, |
| 574 |
"Custom scrollbar": { |
| 575 |
path: "customScrollbar" |
| 576 |
}, |
| 577 |
"Use SVG gutter icons": { |
| 578 |
path: "useSvgGutterIcons" |
| 579 |
}, |
| 580 |
"Annotations for folded lines": { |
| 581 |
path: "showFoldedAnnotations" |
| 582 |
}, |
| 583 |
"Keyboard Accessibility Mode": { |
| 584 |
path: "enableKeyboardAccessibility" |
| 585 |
}, |
| 586 |
"Gutter tooltip follows mouse": { |
| 587 |
path: "tooltipFollowsMouse", |
| 588 |
defaultValue: true |
| 589 |
} |
| 590 |
} |
| 591 |
}; |
| 592 |
var OptionPanel = (function () { |
| 593 |
function OptionPanel(editor, element) { |
| 594 |
this.editor = editor; |
| 595 |
this.container = element || document.createElement("div"); |
| 596 |
this.groups = []; |
| 597 |
this.options = {}; |
| 598 |
} |
| 599 |
OptionPanel.prototype.add = function (config) { |
| 600 |
if (config.Main) |
| 601 |
oop.mixin(optionGroups.Main, config.Main); |
| 602 |
if (config.More) |
| 603 |
oop.mixin(optionGroups.More, config.More); |
| 604 |
}; |
| 605 |
OptionPanel.prototype.render = function () { |
| 606 |
this.container.innerHTML = ""; |
| 607 |
buildDom(["table", { role: "presentation", id: "controls" }, |
| 608 |
this.renderOptionGroup(optionGroups.Main), |
| 609 |
["tr", null, ["td", { colspan: 2 }, |
| 610 |
["table", { role: "presentation", id: "more-controls" }, |
| 611 |
this.renderOptionGroup(optionGroups.More) |
| 612 |
] |
| 613 |
]], |
| 614 |
["tr", null, ["td", { colspan: 2 }, "version " + config.version]] |
| 615 |
], this.container); |
| 616 |
}; |
| 617 |
OptionPanel.prototype.renderOptionGroup = function (group) { |
| 618 |
return Object.keys(group).map(function (key, i) { |
| 619 |
var item = group[key]; |
| 620 |
if (!item.position) |
| 621 |
item.position = i / 10000; |
| 622 |
if (!item.label) |
| 623 |
item.label = key; |
| 624 |
return item; |
| 625 |
}).sort(function (a, b) { |
| 626 |
return a.position - b.position; |
| 627 |
}).map(function (item) { |
| 628 |
return this.renderOption(item.label, item); |
| 629 |
}, this); |
| 630 |
}; |
| 631 |
OptionPanel.prototype.renderOptionControl = function (key, option) { |
| 632 |
var self = this; |
| 633 |
if (Array.isArray(option)) { |
| 634 |
return option.map(function (x) { |
| 635 |
return self.renderOptionControl(key, x); |
| 636 |
}); |
| 637 |
} |
| 638 |
var control; |
| 639 |
var value = self.getOption(option); |
| 640 |
if (option.values && option.type != "checkbox") { |
| 641 |
if (typeof option.values == "string") |
| 642 |
option.values = option.values.split("|"); |
| 643 |
option.items = option.values.map(function (v) { |
| 644 |
return { value: v, name: v }; |
| 645 |
}); |
| 646 |
} |
| 647 |
if (option.type == "buttonBar") { |
| 648 |
control = ["div", { role: "group", "aria-labelledby": option.path + "-label" }, option.items.map(function (item) { |
| 649 |
return ["button", { |
| 650 |
value: item.value, |
| 651 |
ace_selected_button: value == item.value, |
| 652 |
'aria-pressed': value == item.value, |
| 653 |
onclick: function () { |
| 654 |
self.setOption(option, item.value); |
| 655 |
var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); |
| 656 |
for (var i = 0; i < nodes.length; i++) { |
| 657 |
nodes[i].removeAttribute("ace_selected_button"); |
| 658 |
nodes[i].setAttribute("aria-pressed", false); |
| 659 |
} |
| 660 |
this.setAttribute("ace_selected_button", true); |
| 661 |
this.setAttribute("aria-pressed", true); |
| 662 |
} |
| 663 |
}, item.desc || item.caption || item.name]; |
| 664 |
})]; |
| 665 |
} |
| 666 |
else if (option.type == "number") { |
| 667 |
control = ["input", { type: "number", value: value || option.defaultValue, style: "width:3em", oninput: function () { |
| 668 |
self.setOption(option, parseInt(this.value)); |
| 669 |
} }]; |
| 670 |
if (option.ariaLabel) { |
| 671 |
control[1]["aria-label"] = option.ariaLabel; |
| 672 |
} |
| 673 |
else { |
| 674 |
control[1].id = key; |
| 675 |
} |
| 676 |
if (option.defaults) { |
| 677 |
control = [control, option.defaults.map(function (item) { |
| 678 |
return ["button", { onclick: function () { |
| 679 |
var input = this.parentNode.firstChild; |
| 680 |
input.value = item.value; |
| 681 |
input.oninput(); |
| 682 |
} }, item.caption]; |
| 683 |
})]; |
| 684 |
} |
| 685 |
} |
| 686 |
else if (option.items) { |
| 687 |
var buildItems = function (items) { |
| 688 |
return items.map(function (item) { |
| 689 |
return ["option", { value: item.value || item.name }, item.desc || item.caption || item.name]; |
| 690 |
}); |
| 691 |
}; |
| 692 |
var items = Array.isArray(option.items) |
| 693 |
? buildItems(option.items) |
| 694 |
: Object.keys(option.items).map(function (key) { |
| 695 |
return ["optgroup", { "label": key }, buildItems(option.items[key])]; |
| 696 |
}); |
| 697 |
control = ["select", { id: key, value: value, onchange: function () { |
| 698 |
self.setOption(option, this.value); |
| 699 |
} }, items]; |
| 700 |
} |
| 701 |
else { |
| 702 |
if (typeof option.values == "string") |
| 703 |
option.values = option.values.split("|"); |
| 704 |
if (option.values) |
| 705 |
value = value == option.values[1]; |
| 706 |
control = ["input", { type: "checkbox", id: key, checked: value || null, onchange: function () { |
| 707 |
var value = this.checked; |
| 708 |
if (option.values) |
| 709 |
value = option.values[value ? 1 : 0]; |
| 710 |
self.setOption(option, value); |
| 711 |
} }]; |
| 712 |
if (option.type == "checkedNumber") { |
| 713 |
control = [control, []]; |
| 714 |
} |
| 715 |
} |
| 716 |
return control; |
| 717 |
}; |
| 718 |
OptionPanel.prototype.renderOption = function (key, option) { |
| 719 |
if (option.path && !option.onchange && !this.editor.$options[option.path]) |
| 720 |
return; |
| 721 |
var path = Array.isArray(option) ? option[0].path : option.path; |
| 722 |
this.options[path] = option; |
| 723 |
var safeKey = "-" + path; |
| 724 |
var safeId = path + "-label"; |
| 725 |
var control = this.renderOptionControl(safeKey, option); |
| 726 |
return ["tr", { class: "ace_optionsMenuEntry" }, ["td", |
| 727 |
["label", { for: safeKey, id: safeId }, key] |
| 728 |
], ["td", control]]; |
| 729 |
}; |
| 730 |
OptionPanel.prototype.setOption = function (option, value) { |
| 731 |
if (typeof option == "string") |
| 732 |
option = this.options[option]; |
| 733 |
if (value == "false") |
| 734 |
value = false; |
| 735 |
if (value == "true") |
| 736 |
value = true; |
| 737 |
if (value == "null") |
| 738 |
value = null; |
| 739 |
if (value == "undefined") |
| 740 |
value = undefined; |
| 741 |
if (typeof value == "string" && parseFloat(value).toString() == value) |
| 742 |
value = parseFloat(value); |
| 743 |
if (option.onchange) |
| 744 |
option.onchange(value); |
| 745 |
else if (option.path) |
| 746 |
this.editor.setOption(option.path, value); |
| 747 |
this._signal("setOption", { name: option.path, value: value }); |
| 748 |
}; |
| 749 |
OptionPanel.prototype.getOption = function (option) { |
| 750 |
if (option.getValue) |
| 751 |
return option.getValue(); |
| 752 |
return this.editor.getOption(option.path); |
| 753 |
}; |
| 754 |
return OptionPanel; |
| 755 |
}()); |
| 756 |
oop.implement(OptionPanel.prototype, EventEmitter); |
| 757 |
exports.OptionPanel = OptionPanel; |
| 758 |
|
| 759 |
}); (function() { |
| 760 |
ace.require(["ace/ext/options"], function(m) { |
| 761 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 762 |
module.exports = m; |
| 763 |
} |
| 764 |
}); |
| 765 |
})(); |
| 766 |
|