Skip to content

Commit af708fc

Browse files
committed
增加SearchBox
1 parent 02f68d1 commit af708fc

File tree

6 files changed

+1653
-2
lines changed

6 files changed

+1653
-2
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 1.12.5
2+
3+
## 新增
4+
1. 新增支持快捷导入JS文件格式
5+
2. 新增插件仓库,支持将代码保存为插件,加载时自动启动
6+
7+
## 修改
8+
1. 修改部分提示为中文
9+
2. 修改构建脚本,构建的代码补全库新增"return"字段
10+
3. 修改补全文档解释,增加返回值提示,增加无参数提示
11+
112
# 1.12.4
213

314
## 新增

iframe/main/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828
</div>
2929
</div>
3030

31-
<!-- Ace 资源(全静态加载) -->
31+
<!-- Ace 插件资源等 -->
3232
<script src="/iframe/script/Ace_Editor/ace.js"></script>
3333
<script src="/iframe/script/Ace_Editor/ext-language_tools.js"></script>
3434
<script src="/iframe/script/Ace_Editor/mode-javascript.js"></script>
35+
<script src="/iframe/script/Ace_Editor/ext-searchbox.js"></script>
36+
<script src="/iframe/script/Ace_Editor/ext-options.js"></script>
37+
<script src="/iframe/script/Ace_Editor/ext-modelist.js"></script>
38+
<script src="/iframe/script/Ace_Editor/ext-themelist.js"></script>
3539
<!-- 以下全都是ACE的风格文件,如果有需要可以自己添加 东西都在Ace_Editor文件夹里-->
3640
<script src="/iframe/script/Ace_Editor/theme-monokai.js"></script>
3741
<script src="/iframe/script/Ace_Editor/theme-github.js"></script>
@@ -45,8 +49,10 @@
4549
<script>
4650
//初始化Ace 编辑器
4751
const editor = ace.edit('editor');
52+
4853
ACE_Init(editor);
4954

55+
5056
// 注册放大缩小代码支持
5157
let currentFontSize = 14;
5258
ACE_ChangeCodeSize(editor, currentFontSize, showToast);
@@ -58,7 +64,7 @@
5864
const light_theme = document.getElementById('theme-light');
5965
const dark_theme = document.getElementById('theme-dark');
6066
GetTheme(editor, light_theme, dark_theme);
61-
67+
6268
//扫描插件并执行
6369
ExtStore_LoadAndRunAllPlugins();
6470

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
2+
"use strict";
3+
4+
var modes = [];
5+
function getModeForPath(path) {
6+
var mode = modesByName.text;
7+
var fileName = path.split(/[\/\\]/).pop();
8+
for (var i = 0; i < modes.length; i++) {
9+
if (modes[i].supportsFile(fileName)) {
10+
mode = modes[i];
11+
break;
12+
}
13+
}
14+
return mode;
15+
}
16+
17+
var Mode = function(name, caption, extensions) {
18+
this.name = name;
19+
this.caption = caption;
20+
this.mode = "ace/mode/" + name;
21+
this.extensions = extensions;
22+
var re;
23+
if (/\^/.test(extensions)) {
24+
re = extensions.replace(/\|(\^)?/g, function(a, b){
25+
return "$|" + (b ? "^" : "^.*\\.");
26+
}) + "$";
27+
} else {
28+
re = "^.*\\.(" + extensions + ")$";
29+
}
30+
31+
this.extRe = new RegExp(re, "gi");
32+
};
33+
34+
Mode.prototype.supportsFile = function(filename) {
35+
return filename.match(this.extRe);
36+
};
37+
var supportedModes = {
38+
ABAP: ["abap"],
39+
ABC: ["abc"],
40+
ActionScript:["as"],
41+
ADA: ["ada|adb"],
42+
Alda: ["alda"],
43+
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
44+
Apex: ["apex|cls|trigger|tgr"],
45+
AQL: ["aql"],
46+
AsciiDoc: ["asciidoc|adoc"],
47+
ASL: ["dsl|asl|asl.json"],
48+
Assembly_x86:["asm|a"],
49+
AutoHotKey: ["ahk"],
50+
BatchFile: ["bat|cmd"],
51+
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
52+
C9Search: ["c9search_results"],
53+
Cirru: ["cirru|cr"],
54+
Clojure: ["clj|cljs"],
55+
Cobol: ["CBL|COB"],
56+
coffee: ["coffee|cf|cson|^Cakefile"],
57+
ColdFusion: ["cfm"],
58+
Crystal: ["cr"],
59+
CSharp: ["cs"],
60+
Csound_Document: ["csd"],
61+
Csound_Orchestra: ["orc"],
62+
Csound_Score: ["sco"],
63+
CSS: ["css"],
64+
Curly: ["curly"],
65+
D: ["d|di"],
66+
Dart: ["dart"],
67+
Diff: ["diff|patch"],
68+
Dockerfile: ["^Dockerfile"],
69+
Dot: ["dot"],
70+
Drools: ["drl"],
71+
Edifact: ["edi"],
72+
Eiffel: ["e|ge"],
73+
EJS: ["ejs"],
74+
Elixir: ["ex|exs"],
75+
Elm: ["elm"],
76+
Erlang: ["erl|hrl"],
77+
Forth: ["frt|fs|ldr|fth|4th"],
78+
Fortran: ["f|f90"],
79+
FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
80+
FSL: ["fsl"],
81+
FTL: ["ftl"],
82+
Gcode: ["gcode"],
83+
Gherkin: ["feature"],
84+
Gitignore: ["^.gitignore"],
85+
Glsl: ["glsl|frag|vert"],
86+
Gobstones: ["gbs"],
87+
golang: ["go"],
88+
GraphQLSchema: ["gql"],
89+
Groovy: ["groovy"],
90+
HAML: ["haml"],
91+
Handlebars: ["hbs|handlebars|tpl|mustache"],
92+
Haskell: ["hs"],
93+
Haskell_Cabal: ["cabal"],
94+
haXe: ["hx"],
95+
Hjson: ["hjson"],
96+
HTML: ["html|htm|xhtml|vue|we|wpy"],
97+
HTML_Elixir: ["eex|html.eex"],
98+
HTML_Ruby: ["erb|rhtml|html.erb"],
99+
INI: ["ini|conf|cfg|prefs"],
100+
Io: ["io"],
101+
Ion: ["ion"],
102+
Jack: ["jack"],
103+
Jade: ["jade|pug"],
104+
Java: ["java"],
105+
JavaScript: ["js|jsm|jsx"],
106+
JSON: ["json"],
107+
JSON5: ["json5"],
108+
JSONiq: ["jq"],
109+
JSP: ["jsp"],
110+
JSSM: ["jssm|jssm_state"],
111+
JSX: ["jsx"],
112+
Julia: ["jl"],
113+
Kotlin: ["kt|kts"],
114+
LaTeX: ["tex|latex|ltx|bib"],
115+
Latte: ["latte"],
116+
LESS: ["less"],
117+
Liquid: ["liquid"],
118+
Lisp: ["lisp"],
119+
LiveScript: ["ls"],
120+
LogiQL: ["logic|lql"],
121+
LSL: ["lsl"],
122+
Lua: ["lua"],
123+
LuaPage: ["lp"],
124+
Lucene: ["lucene"],
125+
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
126+
Markdown: ["md|markdown"],
127+
Mask: ["mask"],
128+
MATLAB: ["matlab"],
129+
Maze: ["mz"],
130+
MediaWiki: ["wiki|mediawiki"],
131+
MEL: ["mel"],
132+
MIPS: ["s|asm"],
133+
MIXAL: ["mixal"],
134+
MUSHCode: ["mc|mush"],
135+
MySQL: ["mysql"],
136+
Nginx: ["nginx|conf"],
137+
Nim: ["nim"],
138+
Nix: ["nix"],
139+
NSIS: ["nsi|nsh"],
140+
Nunjucks: ["nunjucks|nunjs|nj|njk"],
141+
ObjectiveC: ["m|mm"],
142+
OCaml: ["ml|mli"],
143+
PartiQL: ["partiql|pql"],
144+
Pascal: ["pas|p"],
145+
Perl: ["pl|pm"],
146+
pgSQL: ["pgsql"],
147+
PHP_Laravel_blade: ["blade.php"],
148+
PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
149+
Pig: ["pig"],
150+
Powershell: ["ps1"],
151+
Praat: ["praat|praatscript|psc|proc"],
152+
Prisma: ["prisma"],
153+
Prolog: ["plg|prolog"],
154+
Properties: ["properties"],
155+
Protobuf: ["proto"],
156+
Puppet: ["epp|pp"],
157+
Python: ["py"],
158+
QML: ["qml"],
159+
R: ["r"],
160+
Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"],
161+
Razor: ["cshtml|asp"],
162+
RDoc: ["Rd"],
163+
Red: ["red|reds"],
164+
RHTML: ["Rhtml"],
165+
RST: ["rst"],
166+
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
167+
Rust: ["rs"],
168+
SaC: ["sac"],
169+
SASS: ["sass"],
170+
SCAD: ["scad"],
171+
Scala: ["scala|sbt"],
172+
Scheme: ["scm|sm|rkt|oak|scheme"],
173+
Scrypt: ["scrypt"],
174+
SCSS: ["scss"],
175+
SH: ["sh|bash|^.bashrc"],
176+
SJS: ["sjs"],
177+
Slim: ["slim|skim"],
178+
Smarty: ["smarty|tpl"],
179+
Smithy: ["smithy"],
180+
snippets: ["snippets"],
181+
Soy_Template:["soy"],
182+
Space: ["space"],
183+
SQL: ["sql"],
184+
SQLServer: ["sqlserver"],
185+
Stylus: ["styl|stylus"],
186+
SVG: ["svg"],
187+
Swift: ["swift"],
188+
Tcl: ["tcl"],
189+
Terraform: ["tf", "tfvars", "terragrunt"],
190+
Tex: ["tex"],
191+
Text: ["txt"],
192+
Textile: ["textile"],
193+
Toml: ["toml"],
194+
TSX: ["tsx"],
195+
Twig: ["twig|swig"],
196+
Typescript: ["ts|typescript|str"],
197+
Vala: ["vala"],
198+
VBScript: ["vbs|vb"],
199+
Velocity: ["vm"],
200+
Verilog: ["v|vh|sv|svh"],
201+
VHDL: ["vhd|vhdl"],
202+
Visualforce: ["vfp|component|page"],
203+
Wollok: ["wlk|wpgm|wtest"],
204+
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
205+
XQuery: ["xq"],
206+
YAML: ["yaml|yml"],
207+
Zeek: ["zeek|bro"],
208+
Django: ["html"]
209+
};
210+
211+
var nameOverrides = {
212+
ObjectiveC: "Objective-C",
213+
CSharp: "C#",
214+
golang: "Go",
215+
C_Cpp: "C and C++",
216+
Csound_Document: "Csound Document",
217+
Csound_Orchestra: "Csound",
218+
Csound_Score: "Csound Score",
219+
coffee: "CoffeeScript",
220+
HTML_Ruby: "HTML (Ruby)",
221+
HTML_Elixir: "HTML (Elixir)",
222+
FTL: "FreeMarker",
223+
PHP_Laravel_blade: "PHP (Blade Template)",
224+
Perl6: "Perl 6",
225+
AutoHotKey: "AutoHotkey / AutoIt"
226+
};
227+
228+
var modesByName = {};
229+
for (var name in supportedModes) {
230+
var data = supportedModes[name];
231+
var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
232+
var filename = name.toLowerCase();
233+
var mode = new Mode(filename, displayName, data[0]);
234+
modesByName[filename] = mode;
235+
modes.push(mode);
236+
}
237+
238+
module.exports = {
239+
getModeForPath: getModeForPath,
240+
modes: modes,
241+
modesByName: modesByName
242+
};
243+
244+
}); (function() {
245+
window.require(["ace/ext/modelist"], function(m) {
246+
if (typeof module == "object" && typeof exports == "object" && module) {
247+
module.exports = m;
248+
}
249+
});
250+
})();
251+

0 commit comments

Comments
 (0)