-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Junk that could exist anywhere: | ||
.DS_Store | ||
*.swp | ||
*.tmp | ||
*~ | ||
|
||
# Project files that should not be in the repo | ||
.* | ||
\#* | ||
!/.github | ||
!/.gitignore | ||
.*.gz | ||
*.tmTheme.js | ||
package-lock.json | ||
|
||
# A handy place to put stuff that git should ignore: | ||
/coverage | ||
/ignore/ | ||
node_modules/ | ||
jam/ | ||
* * | ||
|
||
.git-ref | ||
npm-debug.log | ||
deps/ | ||
dist | ||
|
||
lib/ace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<title>Ace-builds-cdn</title> | ||
</head> | ||
<body> | ||
<div id="container" style="height: 100px"></div> | ||
<script src="https://www.unpkg.com/ace-builds/src-noconflict/ace.js"></script> | ||
<script src="https://www.unpkg.com/ace-builds/src-noconflict/ext-language_tools.js"></script> | ||
<script> | ||
ace.config.setModuleUrl("ux/mode/custom", "./my/mode-custom.js"); | ||
var editor = ace.edit("container", { | ||
useWorker: false, | ||
theme: "ace/theme/eclipse", | ||
mode: "ux/mode/custom", | ||
enableBasicAutocompletion: true, | ||
enableSnippets: true, | ||
enableLiveAutocompletion: true, | ||
value: "CUSTOM_KEYWORD and some text" | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
36 changes: 36 additions & 0 deletions
36
samples/ace-builds-cdn/cusom-mode-example/my/mode-custom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ace.define('ux/mode/custom', [], (acequire, exports) => { | ||
const oop = acequire('ace/lib/oop'); | ||
const TextMode = acequire('ace/mode/text').Mode; | ||
const CustomHighlightRules = acequire('ux/mode/custom_highlight_rules').CustomHighlightRules; | ||
|
||
function Mode() { | ||
this.HighlightRules = CustomHighlightRules; | ||
} | ||
oop.inherits(Mode, TextMode); | ||
|
||
exports.Mode = Mode; | ||
}); | ||
|
||
ace.define('ux/mode/custom_highlight_rules', [], (acequire, exports) => { | ||
const oop = acequire('ace/lib/oop'); | ||
const TextHighlightRules = acequire('ace/mode/text_highlight_rules').TextHighlightRules; | ||
|
||
const CustomHighlightRules = function CustomHighlightRules() { | ||
this.$rules = { | ||
start: [ | ||
{ | ||
token: "keyword", | ||
regex: /[A-Z][A-Z\d]+/ | ||
}, | ||
{ | ||
token: "numeric", | ||
regex: /[\d]+/ | ||
} | ||
] | ||
} | ||
}; | ||
|
||
oop.inherits(CustomHighlightRules, TextHighlightRules); | ||
|
||
exports.CustomHighlightRules = CustomHighlightRules; | ||
}); |