44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/menus/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "NWJS-menu-demo",
3 | "main": "index.html",
4 | "window": {
5 | "show": false,
6 | "position": "center",
7 | "width": 500,
8 | "height": 500
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/mini-code-edit/README.md:
--------------------------------------------------------------------------------
1 | # Mini code editor
2 |
3 | A non-trivial sample with basic features of a code editor, like syntax detection and syntax highlight. If also uses the extended FileSystem API that allows a user to select files from the disk so the app can read and write to that file.
4 |
5 | **This demo requires node-webkit >= v0.3.0**
6 |
7 | ## Screen shot
8 |
9 | 
10 |
11 | ## APIs
12 |
13 | * [Window](https://github.com/nwjs/nw.js/wiki/Window)
14 | * [Menu](https://github.com/nwjs/nw.js/wiki/Menu)
15 | * [MenuItem](https://github.com/nwjs/nw.js/wiki/MenuItem)
16 | * [Clipboard](https://github.com/nwjs/nw.js/wiki/Clipboard)
17 | * [fs module](http://nodejs.org/api/fs.html)
18 |
--------------------------------------------------------------------------------
/mini-code-edit/assets/icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nwutils/nw-sample-apps/f3eae74d5a968acf0f321a3f3b4fa30add1b5fd9/mini-code-edit/assets/icon-128.png
--------------------------------------------------------------------------------
/mini-code-edit/assets/screenshot-640x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nwutils/nw-sample-apps/f3eae74d5a968acf0f321a3f3b4fa30add1b5fd9/mini-code-edit/assets/screenshot-640x400.png
--------------------------------------------------------------------------------
/mini-code-edit/assets/tile-440x280.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nwutils/nw-sample-apps/f3eae74d5a968acf0f321a3f3b4fa30add1b5fd9/mini-code-edit/assets/tile-440x280.png
--------------------------------------------------------------------------------
/mini-code-edit/cm/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2012 by Marijn Haverbeke
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 | Please note that some subdirectories of the CodeMirror distribution
22 | include their own LICENSE files, and are released under different
23 | licences.
24 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/README.md:
--------------------------------------------------------------------------------
1 | # CodeMirror 2
2 |
3 | CodeMirror 2 is a rewrite of [CodeMirror
4 | 1](http://github.com/marijnh/CodeMirror). The docs live
5 | [here](http://codemirror.net/doc/manual.html), and the project page is
6 | [http://codemirror.net/](http://codemirror.net/).
7 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/demo/changemode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Mode-Changing Demo
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
CodeMirror: Mode-Changing demo
17 |
18 |
25 |
26 |
On changes to the content of the above editor, a (crude) script
27 | tries to auto-detect the language used, and switches the editor to
28 | either JavaScript or Scheme mode based on that.
The emacs keybindings are enabled by
35 | including keymap/emacs.js and setting
36 | the keyMap option to "emacs". Because
37 | CodeMirror's internal API is quite different from Emacs, they are only
38 | a loose approximation of actual emacs bindings, though.
39 |
40 |
Also note that a lot of browsers disallow certain keys from being
41 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the
42 | result that idiomatic use of Emacs keys will constantly close your tab
43 | or open a new window.
Demonstration of a mode that parses HTML, highlighting
51 | the Mustache templating
52 | directives inside of it by using the code
53 | in overlay.js. View
54 | source to see the 15 lines of code needed to accomplish this.
If this is a function, it will be called for each token with
41 | two arguments, the token's text and the token's style class (may
42 | be null for unstyled tokens). If it is a DOM node,
43 | the tokens will be converted to span elements as in
44 | an editor, and inserted into the node
45 | (through innerHTML).
The vim keybindings are enabled by
35 | including keymap/vim.js and setting
36 | the keyMap option to "vim". Because
37 | CodeMirror's internal API is quite different from Vim, they are only
38 | a loose approximation of actual vim bindings, though.
Tabs inside the editor are spans with the
45 | class cm-tab, and can be styled. This demo uses
46 | an :after pseudo-class CSS hack that will not work on old
47 | browsers. You can use a more conservative technique like a background
48 | image as an alternative.
So you found a problem in CodeMirror. By all means, report it! Bug
22 | reports from users are the main drive behind improvements to
23 | CodeMirror. But first, please read over these points:
24 |
25 |
26 |
CodeMirror is maintained by volunteers. They don't owe you
27 | anything, so be polite. Reports with an indignant or belligerent
28 | tone tend to be moved to the bottom of the pile.
29 |
30 |
Include information about the browser in which the
31 | problem occurred. Even if you tested several browsers, and
32 | the problem occurred in all of them, mention this fact in the bug
33 | report. Also include browser version numbers and the operating
34 | system that you're on.
35 |
36 |
Mention which release of CodeMirror you're using. Preferably,
37 | try also with the current development snapshot, to ensure the
38 | problem has not already been fixed.
39 |
40 |
Mention very precisely what went wrong. "X is broken" is not a
41 | good bug report. What did you expect to happen? What happened
42 | instead? Describe the exact steps a maintainer has to take to make
43 | the problem occur. We can not fix something that we can not
44 | observe.
45 |
46 |
If the problem can not be reproduced in any of the demos
47 | included in the CodeMirror distribution, please provide an HTML
48 | document that demonstrates the problem. The best way to do this is
49 | to go to jsbin.com, enter
50 | it there, press save, and include the resulting link in your bug
51 | report.
';
9 | return dialog;
10 | }
11 |
12 | CodeMirror.defineExtension("openDialog", function(template, callback) {
13 | var dialog = dialogDiv(this, template);
14 | var closed = false, me = this;
15 | function close() {
16 | if (closed) return;
17 | closed = true;
18 | dialog.parentNode.removeChild(dialog);
19 | }
20 | var inp = dialog.getElementsByTagName("input")[0];
21 | if (inp) {
22 | CodeMirror.connect(inp, "keydown", function(e) {
23 | if (e.keyCode == 13 || e.keyCode == 27) {
24 | CodeMirror.e_stop(e);
25 | close();
26 | me.focus();
27 | if (e.keyCode == 13) callback(inp.value);
28 | }
29 | });
30 | inp.focus();
31 | CodeMirror.connect(inp, "blur", close);
32 | }
33 | return close;
34 | });
35 |
36 | CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
37 | var dialog = dialogDiv(this, template);
38 | var buttons = dialog.getElementsByTagName("button");
39 | var closed = false, me = this, blurring = 1;
40 | function close() {
41 | if (closed) return;
42 | closed = true;
43 | dialog.parentNode.removeChild(dialog);
44 | me.focus();
45 | }
46 | buttons[0].focus();
47 | for (var i = 0; i < buttons.length; ++i) {
48 | var b = buttons[i];
49 | (function(callback) {
50 | CodeMirror.connect(b, "click", function(e) {
51 | CodeMirror.e_preventDefault(e);
52 | close();
53 | if (callback) callback(me);
54 | });
55 | })(callbacks[i]);
56 | CodeMirror.connect(b, "blur", function() {
57 | --blurring;
58 | setTimeout(function() { if (blurring <= 0) close(); }, 200);
59 | });
60 | CodeMirror.connect(b, "focus", function() { ++blurring; });
61 | }
62 | });
63 | })();
64 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/lib/util/loadmode.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
3 |
4 | var loading = {};
5 | function splitCallback(cont, n) {
6 | var countDown = n;
7 | return function() { if (--countDown == 0) cont(); }
8 | }
9 | function ensureDeps(mode, cont) {
10 | var deps = CodeMirror.modes[mode].dependencies;
11 | if (!deps) return cont();
12 | var missing = [];
13 | for (var i = 0; i < deps.length; ++i) {
14 | if (!CodeMirror.modes.hasOwnProperty(deps[i]))
15 | missing.push(deps[i]);
16 | }
17 | if (!missing.length) return cont();
18 | var split = splitCallback(cont, missing.length);
19 | for (var i = 0; i < missing.length; ++i)
20 | CodeMirror.requireMode(missing[i], split);
21 | }
22 |
23 | CodeMirror.requireMode = function(mode, cont) {
24 | if (typeof mode != "string") mode = mode.name;
25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
27 |
28 | var script = document.createElement("script");
29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode);
30 | var others = document.getElementsByTagName("script")[0];
31 | others.parentNode.insertBefore(script, others);
32 | var list = loading[mode] = [cont];
33 | var count = 0, poll = setInterval(function() {
34 | if (++count > 100) return clearInterval(poll);
35 | if (CodeMirror.modes.hasOwnProperty(mode)) {
36 | clearInterval(poll);
37 | loading[mode] = null;
38 | ensureDeps(mode, function() {
39 | for (var i = 0; i < list.length; ++i) list[i]();
40 | });
41 | }
42 | }, 200);
43 | };
44 |
45 | CodeMirror.autoLoadMode = function(instance, mode) {
46 | if (!CodeMirror.modes.hasOwnProperty(mode))
47 | CodeMirror.requireMode(mode, function() {
48 | instance.setOption("mode", instance.getOption("mode"));
49 | });
50 | };
51 | }());
52 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/lib/util/match-highlighter.js:
--------------------------------------------------------------------------------
1 | // Define match-highlighter commands. Depends on searchcursor.js
2 | // Use by attaching the following function call to the onCursorActivity event:
3 | //myCodeMirror.matchHighlight(minChars);
4 | // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
5 |
6 | (function() {
7 | var DEFAULT_MIN_CHARS = 2;
8 |
9 | function MatchHighlightState() {
10 | this.marked = [];
11 | }
12 | function getMatchHighlightState(cm) {
13 | return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
14 | }
15 |
16 | function clearMarks(cm) {
17 | var state = getMatchHighlightState(cm);
18 | for (var i = 0; i < state.marked.length; ++i)
19 | state.marked[i].clear();
20 | state.marked = [];
21 | }
22 |
23 | function markDocument(cm, className, minChars) {
24 | clearMarks(cm);
25 | minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
26 | if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
27 | var state = getMatchHighlightState(cm);
28 | var query = cm.getSelection();
29 | cm.operation(function() {
30 | if (cm.lineCount() < 2000) { // This is too expensive on big documents.
31 | for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
32 | //Only apply matchhighlight to the matches other than the one actually selected
33 | if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
34 | state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
35 | }
36 | }
37 | });
38 | }
39 | }
40 |
41 | CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
42 | markDocument(this, className, minChars);
43 | });
44 | })();
45 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/lib/util/overlay.js:
--------------------------------------------------------------------------------
1 | // Utility function that allows modes to be combined. The mode given
2 | // as the base argument takes care of most of the normal mode
3 | // functionality, but a second (typically simple) mode is used, which
4 | // can override the style of text. Both modes get to parse all of the
5 | // text, but when both assign a non-null style to a piece of code, the
6 | // overlay wins, unless the combine argument was true, in which case
7 | // the styles are combined.
8 |
9 | CodeMirror.overlayParser = function(base, overlay, combine) {
10 | return {
11 | startState: function() {
12 | return {
13 | base: CodeMirror.startState(base),
14 | overlay: CodeMirror.startState(overlay),
15 | basePos: 0, baseCur: null,
16 | overlayPos: 0, overlayCur: null
17 | };
18 | },
19 | copyState: function(state) {
20 | return {
21 | base: CodeMirror.copyState(base, state.base),
22 | overlay: CodeMirror.copyState(overlay, state.overlay),
23 | basePos: state.basePos, baseCur: null,
24 | overlayPos: state.overlayPos, overlayCur: null
25 | };
26 | },
27 |
28 | token: function(stream, state) {
29 | if (stream.start == state.basePos) {
30 | state.baseCur = base.token(stream, state.base);
31 | state.basePos = stream.pos;
32 | }
33 | if (stream.start == state.overlayPos) {
34 | stream.pos = stream.start;
35 | state.overlayCur = overlay.token(stream, state.overlay);
36 | state.overlayPos = stream.pos;
37 | }
38 | stream.pos = Math.min(state.basePos, state.overlayPos);
39 | if (stream.eol()) state.basePos = state.overlayPos = 0;
40 |
41 | if (state.overlayCur == null) return state.baseCur;
42 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
43 | else return state.overlayCur;
44 | },
45 |
46 | indent: base.indent && function(state, textAfter) {
47 | return base.indent(state.base, textAfter);
48 | },
49 | electricChars: base.electricChars
50 | };
51 | };
52 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/lib/util/runmode.js:
--------------------------------------------------------------------------------
1 | CodeMirror.runMode = function(string, modespec, callback, options) {
2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
3 | var isNode = callback.nodeType == 1;
4 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
5 | if (isNode) {
6 | var node = callback, accum = [], col = 0;
7 | callback = function(text, style) {
8 | if (text == "\n") {
9 | accum.push(" ");
10 | col = 0;
11 | return;
12 | }
13 | var escaped = "";
14 | // HTML-escape and replace tabs
15 | for (var pos = 0;;) {
16 | var idx = text.indexOf("\t", pos);
17 | if (idx == -1) {
18 | escaped += CodeMirror.htmlEscape(text.slice(pos));
19 | col += text.length - pos;
20 | break;
21 | } else {
22 | col += idx - pos;
23 | escaped += CodeMirror.htmlEscape(text.slice(pos, idx));
24 | var size = tabSize - col % tabSize;
25 | col += size;
26 | for (var i = 0; i < size; ++i) escaped += " ";
27 | pos = idx + 1;
28 | }
29 | }
30 |
31 | if (style)
32 | accum.push("" + escaped + "");
33 | else
34 | accum.push(escaped);
35 | }
36 | }
37 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
38 | for (var i = 0, e = lines.length; i < e; ++i) {
39 | if (i) callback("\n");
40 | var stream = new CodeMirror.StringStream(lines[i]);
41 | while (!stream.eol()) {
42 | var style = mode.token(stream, state);
43 | callback(stream.current(), style, i, stream.start);
44 | stream.start = stream.pos;
45 | }
46 | }
47 | if (isNode)
48 | node.innerHTML = accum.join("");
49 | };
50 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/lib/util/simple-hint.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-completions {
2 | position: absolute;
3 | z-index: 10;
4 | overflow: hidden;
5 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
6 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
7 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
8 | }
9 | .CodeMirror-completions select {
10 | background: #fafafa;
11 | outline: none;
12 | border: none;
13 | padding: 0;
14 | margin: 0;
15 | font-family: monospace;
16 | }
17 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/clojure/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Clojure mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
CodeMirror: Clojure mode
13 |
59 |
62 |
63 |
MIME types defined:text/x-clojure.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/coffeescript/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2011 Jeff Pickhardt
4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/css/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: CSS mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
44 | JavaScript, CSS and XML. Other dependancies include those of the scriping language chosen.
Loosely based on Franciszek
64 | Wawrzak's CodeMirror
65 | 1 mode. One configuration parameter is
66 | supported, specials, to which you can provide an
67 | array of strings to have those identifiers highlighted with
68 | the lua-special style.
31 |
32 |
33 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/pascal/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 souceLair
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/pascal/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Pascal mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
CodeMirror: Pascal mode
13 |
14 |
37 |
38 |
45 |
46 |
MIME types defined:text/x-pascal.
47 |
48 |
49 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/perl/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by Sabaca under the MIT license.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/perl/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Perl mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/properties/properties.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("properties", function() {
2 | return {
3 | token: function(stream, state) {
4 | var sol = stream.sol() || state.afterSection;
5 | var eol = stream.eol();
6 |
7 | state.afterSection = false;
8 |
9 | if (sol) {
10 | if (state.nextMultiline) {
11 | state.inMultiline = true;
12 | state.nextMultiline = false;
13 | } else {
14 | state.position = "def";
15 | }
16 | }
17 |
18 | if (eol && ! state.nextMultiline) {
19 | state.inMultiline = false;
20 | state.position = "def";
21 | }
22 |
23 | if (sol) {
24 | while(stream.eatSpace());
25 | }
26 |
27 | var ch = stream.next();
28 |
29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) {
30 | state.position = "comment";
31 | stream.skipToEnd();
32 | return "comment";
33 | } else if (sol && ch === "[") {
34 | state.afterSection = true;
35 | stream.skipTo("]"); stream.eat("]");
36 | return "header";
37 | } else if (ch === "=" || ch === ":") {
38 | state.position = "quote";
39 | return null;
40 | } else if (ch === "\\" && state.position === "quote") {
41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234
42 | // Multiline value
43 | state.nextMultiline = true;
44 | }
45 | }
46 |
47 | return state.position;
48 | },
49 |
50 | startState: function() {
51 | return {
52 | position : "def", // Current position, "def", "quote" or "comment"
53 | nextMultiline : false, // Is the next line multiline value
54 | inMultiline : false, // Is the current line a multiline value
55 | afterSection : false // Did we just open a section
56 | };
57 | }
58 |
59 | };
60 | });
61 |
62 | CodeMirror.defineMIME("text/x-properties", "properties");
63 | CodeMirror.defineMIME("text/x-ini", "properties");
64 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/python/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010 Timothy Farrell
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/r/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/rpm/changes/changes.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("changes", function(config, modeConfig) {
2 | var headerSeperator = /^-+$/;
3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/;
5 |
6 | return {
7 | token: function(stream) {
8 | if (stream.sol()) {
9 | if (stream.match(headerSeperator)) { return 'tag'; }
10 | if (stream.match(headerLine)) { return 'tag'; }
11 | }
12 | if (stream.match(simpleEmail)) { return 'string'; }
13 | stream.next();
14 | return null;
15 | }
16 | };
17 | });
18 |
19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes");
20 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/rpm/changes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: RPM changes mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
CodeMirror: RPM changes mode
13 |
14 |
41 |
50 |
51 |
MIME types defined:text/x-rpm-changes.
52 |
53 |
54 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/rpm/spec/spec.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;}
2 | .cm-s-default span.cm-macro {color: #b218b2;}
3 | .cm-s-default span.cm-section {color: green; font-weight: bold;}
4 | .cm-s-default span.cm-script {color: red;}
5 | .cm-s-default span.cm-issue {color: yellow;}
6 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/ruby/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc. nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/rust/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Rust mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
The XML mode supports two configuration parameters:
32 |
33 |
htmlMode (boolean)
34 |
This switches the mode to parse HTML instead of XML. This
35 | means attributes do not have to be quoted, and some elements
36 | (such as br) do not require a closing tag.
37 |
alignCDATA (boolean)
38 |
Setting this to true will force the opening tag of CDATA
39 | blocks to not be indented.
40 |
41 |
42 |
MIME types defined:application/xml, text/html.
43 |
44 |
45 |
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/xquery/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by MarkLogic Corporation
2 | Author: Mike Brevoort
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
--------------------------------------------------------------------------------
/mini-code-edit/cm/mode/xquery/test/index.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |