ext-settings_menu.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. ace.define("ace/ext/menu_tools/element_generator",["require","exports","module"], function(require, exports, module) {
  2. 'use strict';
  3. module.exports.createOption = function createOption (obj) {
  4. var attribute;
  5. var el = document.createElement('option');
  6. for(attribute in obj) {
  7. if(obj.hasOwnProperty(attribute)) {
  8. if(attribute === 'selected') {
  9. el.setAttribute(attribute, obj[attribute]);
  10. } else {
  11. el[attribute] = obj[attribute];
  12. }
  13. }
  14. }
  15. return el;
  16. };
  17. module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
  18. var el = document.createElement('input');
  19. el.setAttribute('type', 'checkbox');
  20. el.setAttribute('id', id);
  21. el.setAttribute('name', id);
  22. el.setAttribute('value', checked);
  23. el.setAttribute('class', clss);
  24. if(checked) {
  25. el.setAttribute('checked', 'checked');
  26. }
  27. return el;
  28. };
  29. module.exports.createInput = function createInput (id, value, clss) {
  30. var el = document.createElement('input');
  31. el.setAttribute('type', 'text');
  32. el.setAttribute('id', id);
  33. el.setAttribute('name', id);
  34. el.setAttribute('value', value);
  35. el.setAttribute('class', clss);
  36. return el;
  37. };
  38. module.exports.createLabel = function createLabel (text, labelFor) {
  39. var el = document.createElement('label');
  40. el.setAttribute('for', labelFor);
  41. el.textContent = text;
  42. return el;
  43. };
  44. module.exports.createSelection = function createSelection (id, values, clss) {
  45. var el = document.createElement('select');
  46. el.setAttribute('id', id);
  47. el.setAttribute('name', id);
  48. el.setAttribute('class', clss);
  49. values.forEach(function(item) {
  50. el.appendChild(module.exports.createOption(item));
  51. });
  52. return el;
  53. };
  54. });
  55. ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
  56. "use strict";
  57. var modes = [];
  58. function getModeForPath(path) {
  59. var mode = modesByName.text;
  60. var fileName = path.split(/[\/\\]/).pop();
  61. for (var i = 0; i < modes.length; i++) {
  62. if (modes[i].supportsFile(fileName)) {
  63. mode = modes[i];
  64. break;
  65. }
  66. }
  67. return mode;
  68. }
  69. var Mode = function(name, caption, extensions) {
  70. this.name = name;
  71. this.caption = caption;
  72. this.mode = "ace/mode/" + name;
  73. this.extensions = extensions;
  74. var re;
  75. if (/\^/.test(extensions)) {
  76. re = extensions.replace(/\|(\^)?/g, function(a, b){
  77. return "$|" + (b ? "^" : "^.*\\.");
  78. }) + "$";
  79. } else {
  80. re = "^.*\\.(" + extensions + ")$";
  81. }
  82. this.extRe = new RegExp(re, "gi");
  83. };
  84. Mode.prototype.supportsFile = function(filename) {
  85. return filename.match(this.extRe);
  86. };
  87. var supportedModes = {
  88. ABAP: ["abap"],
  89. ABC: ["abc"],
  90. ActionScript:["as"],
  91. ADA: ["ada|adb"],
  92. Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
  93. AsciiDoc: ["asciidoc|adoc"],
  94. Assembly_x86:["asm|a"],
  95. AutoHotKey: ["ahk"],
  96. BatchFile: ["bat|cmd"],
  97. Bro: ["bro"],
  98. C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
  99. C9Search: ["c9search_results"],
  100. Cirru: ["cirru|cr"],
  101. Clojure: ["clj|cljs"],
  102. Cobol: ["CBL|COB"],
  103. coffee: ["coffee|cf|cson|^Cakefile"],
  104. ColdFusion: ["cfm"],
  105. CSharp: ["cs"],
  106. CSS: ["css"],
  107. Curly: ["curly"],
  108. D: ["d|di"],
  109. Dart: ["dart"],
  110. Diff: ["diff|patch"],
  111. Dockerfile: ["^Dockerfile"],
  112. Dot: ["dot"],
  113. Drools: ["drl"],
  114. Dummy: ["dummy"],
  115. DummySyntax: ["dummy"],
  116. Eiffel: ["e|ge"],
  117. EJS: ["ejs"],
  118. Elixir: ["ex|exs"],
  119. Elm: ["elm"],
  120. Erlang: ["erl|hrl"],
  121. Forth: ["frt|fs|ldr|fth|4th"],
  122. Fortran: ["f|f90"],
  123. FTL: ["ftl"],
  124. Gcode: ["gcode"],
  125. Gherkin: ["feature"],
  126. Gitignore: ["^.gitignore"],
  127. Glsl: ["glsl|frag|vert"],
  128. Gobstones: ["gbs"],
  129. golang: ["go"],
  130. GraphQLSchema: ["gql"],
  131. Groovy: ["groovy"],
  132. HAML: ["haml"],
  133. Handlebars: ["hbs|handlebars|tpl|mustache"],
  134. Haskell: ["hs"],
  135. Haskell_Cabal: ["cabal"],
  136. haXe: ["hx"],
  137. Hjson: ["hjson"],
  138. HTML: ["html|htm|xhtml"],
  139. HTML_Elixir: ["eex|html.eex"],
  140. HTML_Ruby: ["erb|rhtml|html.erb"],
  141. INI: ["ini|conf|cfg|prefs"],
  142. Io: ["io"],
  143. Jack: ["jack"],
  144. Jade: ["jade|pug"],
  145. Java: ["java"],
  146. JavaScript: ["js|jsm|jsx"],
  147. JSON: ["json"],
  148. JSONiq: ["jq"],
  149. JSP: ["jsp"],
  150. JSX: ["jsx"],
  151. Julia: ["jl"],
  152. Kotlin: ["kt|kts"],
  153. LaTeX: ["tex|latex|ltx|bib"],
  154. LESS: ["less"],
  155. Liquid: ["liquid"],
  156. Lisp: ["lisp"],
  157. LiveScript: ["ls"],
  158. LogiQL: ["logic|lql"],
  159. LSL: ["lsl"],
  160. Lua: ["lua"],
  161. LuaPage: ["lp"],
  162. Lucene: ["lucene"],
  163. Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
  164. Markdown: ["md|markdown"],
  165. Mask: ["mask"],
  166. MATLAB: ["matlab"],
  167. Maze: ["mz"],
  168. MEL: ["mel"],
  169. MUSHCode: ["mc|mush"],
  170. MySQL: ["mysql"],
  171. Nix: ["nix"],
  172. NSIS: ["nsi|nsh"],
  173. ObjectiveC: ["m|mm"],
  174. OCaml: ["ml|mli"],
  175. Pascal: ["pas|p"],
  176. Perl: ["pl|pm"],
  177. pgSQL: ["pgsql"],
  178. PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
  179. Pig: ["pig"],
  180. Powershell: ["ps1"],
  181. Praat: ["praat|praatscript|psc|proc"],
  182. Prolog: ["plg|prolog"],
  183. Properties: ["properties"],
  184. Protobuf: ["proto"],
  185. Python: ["py"],
  186. R: ["r"],
  187. Razor: ["cshtml|asp"],
  188. RDoc: ["Rd"],
  189. RHTML: ["Rhtml"],
  190. RST: ["rst"],
  191. Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
  192. Rust: ["rs"],
  193. SASS: ["sass"],
  194. SCAD: ["scad"],
  195. Scala: ["scala"],
  196. Scheme: ["scm|sm|rkt|oak|scheme"],
  197. SCSS: ["scss"],
  198. SH: ["sh|bash|^.bashrc"],
  199. SJS: ["sjs"],
  200. Smarty: ["smarty|tpl"],
  201. snippets: ["snippets"],
  202. Soy_Template:["soy"],
  203. Space: ["space"],
  204. SQL: ["sql"],
  205. SQLServer: ["sqlserver"],
  206. Stylus: ["styl|stylus"],
  207. SVG: ["svg"],
  208. Swift: ["swift"],
  209. Tcl: ["tcl"],
  210. Tex: ["tex"],
  211. Text: ["txt"],
  212. Textile: ["textile"],
  213. Toml: ["toml"],
  214. TSX: ["tsx"],
  215. Twig: ["twig|swig"],
  216. Typescript: ["ts|typescript|str"],
  217. Vala: ["vala"],
  218. VBScript: ["vbs|vb"],
  219. Velocity: ["vm"],
  220. Verilog: ["v|vh|sv|svh"],
  221. VHDL: ["vhd|vhdl"],
  222. Wollok: ["wlk|wpgm|wtest"],
  223. XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
  224. XQuery: ["xq"],
  225. YAML: ["yaml|yml"],
  226. Django: ["html"]
  227. };
  228. var nameOverrides = {
  229. ObjectiveC: "Objective-C",
  230. CSharp: "C#",
  231. golang: "Go",
  232. C_Cpp: "C and C++",
  233. coffee: "CoffeeScript",
  234. HTML_Ruby: "HTML (Ruby)",
  235. HTML_Elixir: "HTML (Elixir)",
  236. FTL: "FreeMarker"
  237. };
  238. var modesByName = {};
  239. for (var name in supportedModes) {
  240. var data = supportedModes[name];
  241. var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
  242. var filename = name.toLowerCase();
  243. var mode = new Mode(filename, displayName, data[0]);
  244. modesByName[filename] = mode;
  245. modes.push(mode);
  246. }
  247. module.exports = {
  248. getModeForPath: getModeForPath,
  249. modes: modes,
  250. modesByName: modesByName
  251. };
  252. });
  253. ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
  254. "use strict";
  255. require("ace/lib/fixoldbrowsers");
  256. var themeData = [
  257. ["Chrome" ],
  258. ["Clouds" ],
  259. ["Crimson Editor" ],
  260. ["Dawn" ],
  261. ["Dreamweaver" ],
  262. ["Eclipse" ],
  263. ["GitHub" ],
  264. ["IPlastic" ],
  265. ["Solarized Light"],
  266. ["TextMate" ],
  267. ["Tomorrow" ],
  268. ["XCode" ],
  269. ["Kuroir"],
  270. ["KatzenMilch"],
  271. ["SQL Server" ,"sqlserver" , "light"],
  272. ["Ambiance" ,"ambiance" , "dark"],
  273. ["Chaos" ,"chaos" , "dark"],
  274. ["Clouds Midnight" ,"clouds_midnight" , "dark"],
  275. ["Cobalt" ,"cobalt" , "dark"],
  276. ["Gruvbox" ,"gruvbox" , "dark"],
  277. ["Green on Black" ,"gob" , "dark"],
  278. ["idle Fingers" ,"idle_fingers" , "dark"],
  279. ["krTheme" ,"kr_theme" , "dark"],
  280. ["Merbivore" ,"merbivore" , "dark"],
  281. ["Merbivore Soft" ,"merbivore_soft" , "dark"],
  282. ["Mono Industrial" ,"mono_industrial" , "dark"],
  283. ["Monokai" ,"monokai" , "dark"],
  284. ["Pastel on dark" ,"pastel_on_dark" , "dark"],
  285. ["Solarized Dark" ,"solarized_dark" , "dark"],
  286. ["Terminal" ,"terminal" , "dark"],
  287. ["Tomorrow Night" ,"tomorrow_night" , "dark"],
  288. ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
  289. ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
  290. ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
  291. ["Twilight" ,"twilight" , "dark"],
  292. ["Vibrant Ink" ,"vibrant_ink" , "dark"]
  293. ];
  294. exports.themesByName = {};
  295. exports.themes = themeData.map(function(data) {
  296. var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
  297. var theme = {
  298. caption: data[0],
  299. theme: "ace/theme/" + name,
  300. isDark: data[2] == "dark",
  301. name: name
  302. };
  303. exports.themesByName[name] = theme;
  304. return theme;
  305. });
  306. });
  307. ace.define("ace/ext/menu_tools/add_editor_menu_options",["require","exports","module","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
  308. 'use strict';
  309. module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
  310. var modelist = require('../modelist');
  311. var themelist = require('../themelist');
  312. editor.menuOptions = {
  313. setNewLineMode: [{
  314. textContent: "unix",
  315. value: "unix"
  316. }, {
  317. textContent: "windows",
  318. value: "windows"
  319. }, {
  320. textContent: "auto",
  321. value: "auto"
  322. }],
  323. setTheme: [],
  324. setMode: [],
  325. setKeyboardHandler: [{
  326. textContent: "ace",
  327. value: ""
  328. }, {
  329. textContent: "vim",
  330. value: "ace/keyboard/vim"
  331. }, {
  332. textContent: "emacs",
  333. value: "ace/keyboard/emacs"
  334. }, {
  335. textContent: "textarea",
  336. value: "ace/keyboard/textarea"
  337. }, {
  338. textContent: "sublime",
  339. value: "ace/keyboard/sublime"
  340. }]
  341. };
  342. editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
  343. return {
  344. textContent: theme.caption,
  345. value: theme.theme
  346. };
  347. });
  348. editor.menuOptions.setMode = modelist.modes.map(function(mode) {
  349. return {
  350. textContent: mode.name,
  351. value: mode.mode
  352. };
  353. });
  354. };
  355. });
  356. ace.define("ace/ext/menu_tools/get_set_functions",["require","exports","module"], function(require, exports, module) {
  357. 'use strict';
  358. module.exports.getSetFunctions = function getSetFunctions (editor) {
  359. var out = [];
  360. var my = {
  361. 'editor' : editor,
  362. 'session' : editor.session,
  363. 'renderer' : editor.renderer
  364. };
  365. var opts = [];
  366. var skip = [
  367. 'setOption',
  368. 'setUndoManager',
  369. 'setDocument',
  370. 'setValue',
  371. 'setBreakpoints',
  372. 'setScrollTop',
  373. 'setScrollLeft',
  374. 'setSelectionStyle',
  375. 'setWrapLimitRange'
  376. ];
  377. ['renderer', 'session', 'editor'].forEach(function(esra) {
  378. var esr = my[esra];
  379. var clss = esra;
  380. for(var fn in esr) {
  381. if(skip.indexOf(fn) === -1) {
  382. if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
  383. opts.push(fn);
  384. out.push({
  385. 'functionName' : fn,
  386. 'parentObj' : esr,
  387. 'parentName' : clss
  388. });
  389. }
  390. }
  391. }
  392. });
  393. return out;
  394. };
  395. });
  396. ace.define("ace/ext/menu_tools/generate_settings_menu",["require","exports","module","ace/ext/menu_tools/element_generator","ace/ext/menu_tools/add_editor_menu_options","ace/ext/menu_tools/get_set_functions","ace/ace"], function(require, exports, module) {
  397. 'use strict';
  398. var egen = require('./element_generator');
  399. var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
  400. var getSetFunctions = require('./get_set_functions').getSetFunctions;
  401. module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
  402. var elements = [];
  403. function cleanupElementsList() {
  404. elements.sort(function(a, b) {
  405. var x = a.getAttribute('contains');
  406. var y = b.getAttribute('contains');
  407. return x.localeCompare(y);
  408. });
  409. }
  410. function wrapElements() {
  411. var topmenu = document.createElement('div');
  412. topmenu.setAttribute('id', 'ace_settingsmenu');
  413. elements.forEach(function(element) {
  414. topmenu.appendChild(element);
  415. });
  416. var el = topmenu.appendChild(document.createElement('div'));
  417. var version = require("../../ace").version;
  418. el.style.padding = "1em";
  419. el.textContent = "Ace version " + version;
  420. return topmenu;
  421. }
  422. function createNewEntry(obj, clss, item, val) {
  423. var el;
  424. var div = document.createElement('div');
  425. div.setAttribute('contains', item);
  426. div.setAttribute('class', 'ace_optionsMenuEntry');
  427. div.setAttribute('style', 'clear: both;');
  428. div.appendChild(egen.createLabel(
  429. item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
  430. item
  431. ));
  432. if (Array.isArray(val)) {
  433. el = egen.createSelection(item, val, clss);
  434. el.addEventListener('change', function(e) {
  435. try{
  436. editor.menuOptions[e.target.id].forEach(function(x) {
  437. if(x.textContent !== e.target.textContent) {
  438. delete x.selected;
  439. }
  440. });
  441. obj[e.target.id](e.target.value);
  442. } catch (err) {
  443. throw new Error(err);
  444. }
  445. });
  446. } else if(typeof val === 'boolean') {
  447. el = egen.createCheckbox(item, val, clss);
  448. el.addEventListener('change', function(e) {
  449. try{
  450. obj[e.target.id](!!e.target.checked);
  451. } catch (err) {
  452. throw new Error(err);
  453. }
  454. });
  455. } else {
  456. el = egen.createInput(item, val, clss);
  457. el.addEventListener('change', function(e) {
  458. try{
  459. if(e.target.value === 'true') {
  460. obj[e.target.id](true);
  461. } else if(e.target.value === 'false') {
  462. obj[e.target.id](false);
  463. } else {
  464. obj[e.target.id](e.target.value);
  465. }
  466. } catch (err) {
  467. throw new Error(err);
  468. }
  469. });
  470. }
  471. el.style.cssText = 'float:right;';
  472. div.appendChild(el);
  473. return div;
  474. }
  475. function makeDropdown(item, esr, clss, fn) {
  476. var val = editor.menuOptions[item];
  477. var currentVal = esr[fn]();
  478. if (typeof currentVal == 'object')
  479. currentVal = currentVal.$id;
  480. val.forEach(function(valuex) {
  481. if (valuex.value === currentVal)
  482. valuex.selected = 'selected';
  483. });
  484. return createNewEntry(esr, clss, item, val);
  485. }
  486. function handleSet(setObj) {
  487. var item = setObj.functionName;
  488. var esr = setObj.parentObj;
  489. var clss = setObj.parentName;
  490. var val;
  491. var fn = item.replace(/^set/, 'get');
  492. if(editor.menuOptions[item] !== undefined) {
  493. elements.push(makeDropdown(item, esr, clss, fn));
  494. } else if(typeof esr[fn] === 'function') {
  495. try {
  496. val = esr[fn]();
  497. if(typeof val === 'object') {
  498. val = val.$id;
  499. }
  500. elements.push(
  501. createNewEntry(esr, clss, item, val)
  502. );
  503. } catch (e) {
  504. }
  505. }
  506. }
  507. addEditorMenuOptions(editor);
  508. getSetFunctions(editor).forEach(function(setObj) {
  509. handleSet(setObj);
  510. });
  511. cleanupElementsList();
  512. return wrapElements();
  513. };
  514. });
  515. ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
  516. 'use strict';
  517. var dom = require("../../lib/dom");
  518. var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
  519. background-color: #F7F7F7;\
  520. color: black;\
  521. box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
  522. padding: 1em 0.5em 2em 1em;\
  523. overflow: auto;\
  524. position: absolute;\
  525. margin: 0;\
  526. bottom: 0;\
  527. right: 0;\
  528. top: 0;\
  529. z-index: 9991;\
  530. cursor: default;\
  531. }\
  532. .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
  533. box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
  534. background-color: rgba(255, 255, 255, 0.6);\
  535. color: black;\
  536. }\
  537. .ace_optionsMenuEntry:hover {\
  538. background-color: rgba(100, 100, 100, 0.1);\
  539. -webkit-transition: all 0.5s;\
  540. transition: all 0.3s\
  541. }\
  542. .ace_closeButton {\
  543. background: rgba(245, 146, 146, 0.5);\
  544. border: 1px solid #F48A8A;\
  545. border-radius: 50%;\
  546. padding: 7px;\
  547. position: absolute;\
  548. right: -8px;\
  549. top: -8px;\
  550. z-index: 1000;\
  551. }\
  552. .ace_closeButton{\
  553. background: rgba(245, 146, 146, 0.9);\
  554. }\
  555. .ace_optionsMenuKey {\
  556. color: darkslateblue;\
  557. font-weight: bold;\
  558. }\
  559. .ace_optionsMenuCommand {\
  560. color: darkcyan;\
  561. font-weight: normal;\
  562. }";
  563. dom.importCssString(cssText);
  564. module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
  565. top = top ? 'top: ' + top + ';' : '';
  566. bottom = bottom ? 'bottom: ' + bottom + ';' : '';
  567. right = right ? 'right: ' + right + ';' : '';
  568. left = left ? 'left: ' + left + ';' : '';
  569. var closer = document.createElement('div');
  570. var contentContainer = document.createElement('div');
  571. function documentEscListener(e) {
  572. if (e.keyCode === 27) {
  573. closer.click();
  574. }
  575. }
  576. closer.style.cssText = 'margin: 0; padding: 0; ' +
  577. 'position: fixed; top:0; bottom:0; left:0; right:0;' +
  578. 'z-index: 9990; ' +
  579. 'background-color: rgba(0, 0, 0, 0.3);';
  580. closer.addEventListener('click', function() {
  581. document.removeEventListener('keydown', documentEscListener);
  582. closer.parentNode.removeChild(closer);
  583. editor.focus();
  584. closer = null;
  585. });
  586. document.addEventListener('keydown', documentEscListener);
  587. contentContainer.style.cssText = top + right + bottom + left;
  588. contentContainer.addEventListener('click', function(e) {
  589. e.stopPropagation();
  590. });
  591. var wrapper = dom.createElement("div");
  592. wrapper.style.position = "relative";
  593. var closeButton = dom.createElement("div");
  594. closeButton.className = "ace_closeButton";
  595. closeButton.addEventListener('click', function() {
  596. closer.click();
  597. });
  598. wrapper.appendChild(closeButton);
  599. contentContainer.appendChild(wrapper);
  600. contentContainer.appendChild(contentElement);
  601. closer.appendChild(contentContainer);
  602. document.body.appendChild(closer);
  603. editor.blur();
  604. };
  605. });
  606. ace.define("ace/ext/settings_menu",["require","exports","module","ace/ext/menu_tools/generate_settings_menu","ace/ext/menu_tools/overlay_page","ace/editor"], function(require, exports, module) {
  607. "use strict";
  608. var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
  609. var overlayPage = require('./menu_tools/overlay_page').overlayPage;
  610. function showSettingsMenu(editor) {
  611. var sm = document.getElementById('ace_settingsmenu');
  612. if (!sm)
  613. overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
  614. }
  615. module.exports.init = function(editor) {
  616. var Editor = require("ace/editor").Editor;
  617. Editor.prototype.showSettingsMenu = function() {
  618. showSettingsMenu(this);
  619. };
  620. };
  621. });
  622. (function() {
  623. ace.require(["ace/ext/settings_menu"], function() {});
  624. })();