qword 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +5 -0
- package/client/options.js +6 -4
- package/dist/qword.js +1 -1
- package/dist/qword.js.map +1 -1
- package/dist-dev/qword.js +1 -1
- package/package.json +1 -1
- package/modules/cm-searchbox/ChangeLog +0 -60
- package/modules/cm-searchbox/LICENSE +0 -21
- package/modules/cm-searchbox/README.md +0 -27
- package/modules/cm-searchbox/bower.json +0 -26
- package/modules/cm-searchbox/img/searchbox.png +0 -0
- package/modules/cm-searchbox/lib/searchbox.js +0 -679
- package/modules/cm-searchbox/package.json +0 -27
- package/modules/cm-show-invisibles/ChangeLog +0 -108
- package/modules/cm-show-invisibles/LICENSE +0 -21
- package/modules/cm-show-invisibles/README.md +0 -25
- package/modules/cm-show-invisibles/bower.json +0 -25
- package/modules/cm-show-invisibles/lib/show-invisibles.js +0 -131
- package/modules/cm-show-invisibles/package.json +0 -34
- package/modules/codemirror-emmet/README.md +0 -56
- package/modules/codemirror-emmet/dist/emmet.js +0 -48661
- package/modules/codemirror-emmet/dist/emmet.min.js +0 -8
- package/modules/codemirror-emmet/dist/emmetPlugin.js +0 -840
- package/modules/codemirror-emmet/dist/emmetPlugin.min.js +0 -1
- package/modules/codemirror-emmet/dist/index.html +0 -46
- package/modules/codemirror-emmet/editor.js +0 -204
- package/modules/codemirror-emmet/gulpfile.js +0 -54
- package/modules/codemirror-emmet/index.html +0 -68
- package/modules/codemirror-emmet/package.json +0 -36
- package/modules/codemirror-emmet/plugin.js +0 -201
- package/modules/codemirror-emmet/shim.js +0 -19
- package/modules/codemirror-emmet/vendor/almond.js +0 -410
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.css +0 -270
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.js +0 -7339
- package/modules/codemirror-emmet/vendor/codemirror/v4/css.js +0 -701
- package/modules/codemirror-emmet/vendor/codemirror/v4/htmlmixed.js +0 -117
- package/modules/codemirror-emmet/vendor/codemirror/v4/xml.js +0 -349
- package/modules/execon/ChangeLog +0 -86
- package/modules/execon/LICENSE +0 -20
- package/modules/execon/README.md +0 -154
- package/modules/execon/bower.json +0 -25
- package/modules/execon/lib/exec.js +0 -244
- package/modules/execon/package.json +0 -23
- package/modules/jshint/README.md +0 -114
- package/modules/jshint/dist/jshint-rhino.js +0 -32143
- package/modules/jshint/dist/jshint.js +0 -32141
- package/modules/jshint/package.json +0 -77
- package/modules/loadremote/ChangeLog +0 -23
- package/modules/loadremote/LICENSE +0 -21
- package/modules/loadremote/README.md +0 -53
- package/modules/loadremote/bower.json +0 -27
- package/modules/loadremote/lib/loadremote.js +0 -147
- package/modules/loadremote/package.json +0 -26
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(t,e){"function"==typeof define&&define.amd?define(e):t.emmetPlugin=e()}(this,function(){var t,e,n;return function(i){function r(t,e){return C.call(t,e)}function o(t,e){var n,i,r,o,s,c,a,u,l,f,m=e&&e.split("/"),d=x.map,p=d&&d["*"]||{};if(t&&"."===t.charAt(0))if(e){for(m=m.slice(0,m.length-1),t=m.concat(t.split("/")),u=0;u<t.length;u+=1)if(f=t[u],"."===f)t.splice(u,1),u-=1;else if(".."===f){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((m||p)&&d){for(n=t.split("/"),u=n.length;u>0;u-=1){if(i=n.slice(0,u).join("/"),m)for(l=m.length;l>0;l-=1)if(r=d[m.slice(0,l).join("/")],r&&(r=r[i])){o=r,s=u;break}if(o)break;!c&&p&&p[i]&&(c=p[i],a=u)}!o&&c&&(o=c,s=a),o&&(n.splice(0,s,o),t=n.join("/"))}return t}function s(t,e){return function(){return d.apply(i,v.call(arguments,0).concat([t,e]))}}function c(t){return function(e){return o(e,t)}}function a(t){return function(e){g[t]=e}}function u(t){if(r(_,t)){var e=_[t];delete _[t],b[t]=!0,m.apply(i,e)}if(!r(g,t)&&!r(b,t))throw new Error("No "+t);return g[t]}function l(t){var e,n=t?t.indexOf("!"):-1;return n>-1&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function f(t){return function(){return x&&x.config&&x.config[t]||{}}}var m,d,p,h,g={},_={},x={},b={},C=Object.prototype.hasOwnProperty,v=[].slice;p=function(t,e){var n,i=l(t),r=i[0];return t=i[1],r&&(r=o(r,e),n=u(r)),r?t=n&&n.normalize?n.normalize(t,c(e)):o(t,e):(t=o(t,e),i=l(t),r=i[0],t=i[1],r&&(n=u(r))),{f:r?r+"!"+t:t,n:t,pr:r,p:n}},h={require:function(t){return s(t)},exports:function(t){var e=g[t];return"undefined"!=typeof e?e:g[t]={}},module:function(t){return{id:t,uri:"",exports:g[t],config:f(t)}}},m=function(t,e,n,o){var c,l,f,m,d,x,C=[];if(o=o||t,"function"==typeof n){for(e=!e.length&&n.length?["require","exports","module"]:e,d=0;d<e.length;d+=1)if(m=p(e[d],o),l=m.f,"require"===l)C[d]=h.require(t);else if("exports"===l)C[d]=h.exports(t),x=!0;else if("module"===l)c=C[d]=h.module(t);else if(r(g,l)||r(_,l)||r(b,l))C[d]=u(l);else{if(!m.p)throw new Error(t+" missing "+l);m.p.load(m.n,s(o,!0),a(l),{}),C[d]=g[l]}f=n.apply(g[t],C),t&&(c&&c.exports!==i&&c.exports!==g[t]?g[t]=c.exports:f===i&&x||(g[t]=f))}else t&&(g[t]=n)},t=e=d=function(t,e,n,r,o){return"string"==typeof t?h[t]?h[t](e):u(p(t,e).f):(t.splice||(x=t,e.splice?(t=e,e=n,n=null):t=i),e=e||function(){},"function"==typeof n&&(n=r,r=o),r?m(i,t,e,n):setTimeout(function(){m(i,t,e,n)},4),d)},d.config=function(t){return x=t,x.deps&&d(x.deps,x.callback),d},t._defined=g,n=function(t,e,n){e.splice||(n=e,e=[]),r(g,t)||r(_,t)||(_[t]=[t,e,n])},n.amd={jQuery:!0}}(),n("vendor/almond",function(){}),n("emmet/emmet",function(){return emmet}),n("emmet/utils/common",function(){return emmet.require("utils/common")}),n("emmet/utils/action",function(){return emmet.require("utils/action")}),n("emmet/assets/resources",function(){return emmet.require("assets/resources")}),n("emmet/assets/tabStops",function(){return emmet.require("assets/tabStops")}),n("shim",function(){}),n("editor",["emmet/utils/common","emmet/utils/action","emmet/assets/resources","emmet/assets/tabStops"],function(t,e,n,i){function r(t,e){return arguments.length>2&&"object"!=typeof e&&(e={line:arguments[1],ch:arguments[2]}),t.indexFromPos(e)}function o(t,e){return t.posFromIndex(e)}return{context:null,selectionIndex:0,modeMap:{"text/html":"html","application/xml":"xml","text/xsl":"xsl","text/css":"css","text/x-less":"less","text/x-scss":"scss","text/x-sass":"sass"},setupContext:function(e,i){this.context=e,this.selectionIndex=i||0;var r=" ";e.getOption("indentWithTabs")||(r=t.repeatString(" ",e.getOption("indentUnit"))),n.setVariable("indentation",r)},selectionList:function(){var t=this.context;return t.listSelections().map(function(e){var n=r(t,e.anchor),i=r(t,e.head);return{start:Math.min(n,i),end:Math.max(n,i)}})},getCaretPos:function(){return this.getSelectionRange().start},setCaretPos:function(t){this.createSelection(t)},getSelectionRange:function(){return this.selectionList()[this.selectionIndex]},createSelection:function(t,e){"undefined"==typeof e&&(e=t);var n=this.selectionList(),i=this.context;n[this.selectionIndex]={start:t,end:e},this.context.setSelections(n.map(function(t){return{head:o(i,t.start),anchor:o(i,t.end)}}))},getSelection:function(){var t=this.getSelectionRange();return t.start=o(this.context,t.start),t.end=o(this.context,t.end),this.context.getRange(t.start,t.end)},getCurrentLineRange:function(){var t=o(this.context,this.getCaretPos());return{start:r(this.context,t.line,0),end:r(this.context,t.line,this.context.getLine(t.line).length)}},getCurrentLine:function(){var t=o(this.context,this.getCaretPos());return this.context.getLine(t.line)||""},replaceContent:function(e,n,r,s){"undefined"==typeof r&&(r="undefined"==typeof n?this.getContent().length:n),"undefined"==typeof n&&(n=0),s||(e=t.padString(e,t.getLinePaddingFromPosition(this.getContent(),n)));var c=i.extract(e,{escape:function(t){return t}});e=c.text;var a=c.tabstops[0]||{start:e.length,end:e.length};a.start+=n,a.end+=n,this.context.replaceRange(e,o(this.context,n),o(this.context,r)),this.createSelection(a.start,a.end)},getContent:function(){return this.context.getValue()},getSyntax:function(){var t=this.context.getOption("mode");return this.modeMap[t]||e.detectSyntax(this,t)},getProfileName:function(){return this.context.getOption("profile")?this.context.getOption("profile"):e.detectProfile(this)},prompt:function(t){return prompt(t)},getFilePath:function(){return location.href},isValidSyntax:function(){return n.hasSyntax(this.getSyntax())}}}),n("plugin",["./editor","emmet/emmet"],function(t,e){function n(){if(CodeMirror.version>="3.1")return CodeMirror.Pass;throw CodeMirror.Pass}function i(e){return function(n){t.setupContext(n);var i;return n.operation(function(){i=o(e,n)}),i}}function r(e){return function(n){t.setupContext(n);var i=t.selectionList(),r=null;return n.operation(function(){for(var s=0,c=i.length;c>s&&(t.selectionIndex=s,r=o(e,n),r!==CodeMirror.Pass);s++);}),r}}function o(i,r){if("expand_abbreviation_with_tab"==i&&(r.somethingSelected()||!t.isValidSyntax()))return n();var o=!1;try{if(o=e.run(i,t),!o&&"insert_formatted_line_break_only"==i)return n()}catch(s){}return o}function s(t){return a?t:t.replace("Cmd","Ctrl")}function c(t,e){t=s(t),CodeMirror.keyMap["default"][t]="emmet."+e}var a=/Mac/.test(navigator.platform),u={"Cmd-E":"expand_abbreviation",Tab:"expand_abbreviation_with_tab","Cmd-D":"balance_outward","Shift-Cmd-D":"balance_inward","Cmd-M":"matching_pair","Shift-Cmd-A":"wrap_with_abbreviation","Ctrl-Alt-Right":"next_edit_point","Ctrl-Alt-Left":"prev_edit_point","Cmd-L":"select_line","Cmd-Shift-M":"merge_lines","Cmd-/":"toggle_comment","Cmd-J":"split_join_tag","Cmd-K":"remove_tag","Shift-Cmd-Y":"evaluate_math_expression","Ctrl-Up":"increment_number_by_1","Ctrl-Down":"decrement_number_by_1","Ctrl-Alt-Up":"increment_number_by_01","Ctrl-Alt-Down":"decrement_number_by_01","Shift-Ctrl-Up":"increment_number_by_10","Shift-Ctrl-Down":"decrement_number_by_10","Shift-Cmd-.":"select_next_item","Shift-Cmd-,":"select_previous_item","Cmd-B":"reflect_css_value",Enter:"insert_formatted_line_break_only"},l=["prev_edit_point","next_edit_point","merge_lines","reflect_css_value","select_next_item","select_previous_item","wrap_with_abbreviation","update_tag","insert_formatted_line_break_only"];return CodeMirror.defineOption?CodeMirror.defineOption("profile","html"):CodeMirror.defaults.profile="html",Object.keys(u).forEach(function(t){var e=u[t],n="emmet."+e;CodeMirror.commands[n]||(CodeMirror.commands[n]=~l.indexOf(e)?i(e):r(e)),c(t,e)}),{emmet:e,editor:t,setKeymap:function(t){Object.keys(t).forEach(function(e){c(e,t[e])})},clearKeymap:function(){var t=CodeMirror.keyMap["default"],e=/^emmet\./;Object.keys(t).forEach(function(n){e.test(t[n])&&delete t[n]})},addKeybinding:c,removeKeybinding:function(t){t=s(t);var e=CodeMirror.keyMap["default"];t in e?delete e[t]:(t="emmet."+t,Object.keys(e).forEach(function(n){e[n]===t&&delete e[n]}))}}}),e("plugin")});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Emmet for CodeMirror 4</title>
|
|
5
|
-
<link rel="stylesheet" href="../vendor/codemirror/v4/codemirror.css" />
|
|
6
|
-
<script src="../vendor/codemirror/v4/codemirror.js"></script>
|
|
7
|
-
<script src="../vendor/codemirror/v4/xml.js"></script>
|
|
8
|
-
<script src="../vendor/codemirror/v4/css.js"></script>
|
|
9
|
-
<script src="../vendor/codemirror/v4/htmlmixed.js"></script>
|
|
10
|
-
<script src="./emmet.min.js"></script>
|
|
11
|
-
|
|
12
|
-
<style>
|
|
13
|
-
.CodeMirror {
|
|
14
|
-
border: 1px solid black;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.cm-delimit {
|
|
18
|
-
color: #fa4;
|
|
19
|
-
}
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
<body>
|
|
23
|
-
<h1>Emmet for CodeMirror 4</h1>
|
|
24
|
-
|
|
25
|
-
<form><textarea id="code" name="code">
|
|
26
|
-
<html style="color: green">
|
|
27
|
-
<!-- this is a comment -->
|
|
28
|
-
<head>
|
|
29
|
-
<title>HTML Example</title>
|
|
30
|
-
</head>
|
|
31
|
-
<body>
|
|
32
|
-
The indentation tries to be <em>somewhat &quot;do what
|
|
33
|
-
I mean&quot;</em>... but might not match your style.
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
36
|
-
</textarea></form>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
40
|
-
mode : "text/html",
|
|
41
|
-
lineNumbers : true,
|
|
42
|
-
profile: 'xhtml' /* define Emmet output profile */
|
|
43
|
-
});
|
|
44
|
-
</script>
|
|
45
|
-
</body>
|
|
46
|
-
</html>
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Emmet Editor interface implementation for CodeMirror.
|
|
3
|
-
* Interface is optimized for multiple cursor usage: authors
|
|
4
|
-
* should run acttion multiple times and update `selectionIndex`
|
|
5
|
-
* property on each iteration.
|
|
6
|
-
*/
|
|
7
|
-
define(['emmet/utils/common', 'emmet/utils/action', 'emmet/assets/resources', 'emmet/assets/tabStops'], function(utils, actionUtils, res, tabStops) {
|
|
8
|
-
/**
|
|
9
|
-
* Converts CM’s inner representation of character
|
|
10
|
-
* position (line, ch) to character index in text
|
|
11
|
-
* @param {CodeMirror} cm CodeMirror instance
|
|
12
|
-
* @param {Object} pos Position object
|
|
13
|
-
* @return {Number}
|
|
14
|
-
*/
|
|
15
|
-
function posToIndex(cm, pos) {
|
|
16
|
-
if (arguments.length > 2 && typeof pos !== 'object') {
|
|
17
|
-
pos = {line: arguments[1], ch: arguments[2]}
|
|
18
|
-
}
|
|
19
|
-
return cm.indexFromPos(pos);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Converts charater index in text to CM’s internal object representation
|
|
24
|
-
* @param {CodeMirror} cm CodeMirror instance
|
|
25
|
-
* @param {Number} ix Character index in CM document
|
|
26
|
-
* @return {Object}
|
|
27
|
-
*/
|
|
28
|
-
function indexToPos(cm, ix) {
|
|
29
|
-
return cm.posFromIndex(ix);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
context: null,
|
|
34
|
-
selectionIndex: 0,
|
|
35
|
-
modeMap: {
|
|
36
|
-
'text/html': 'html',
|
|
37
|
-
'application/xml': 'xml',
|
|
38
|
-
'text/xsl': 'xsl',
|
|
39
|
-
'text/css': 'css',
|
|
40
|
-
'text/x-less': 'less',
|
|
41
|
-
'text/x-scss': 'scss',
|
|
42
|
-
'text/x-sass': 'sass'
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
setupContext: function(ctx, selIndex) {
|
|
46
|
-
this.context = ctx;
|
|
47
|
-
this.selectionIndex = selIndex || 0;
|
|
48
|
-
var indentation = '\t';
|
|
49
|
-
if (!ctx.getOption('indentWithTabs')) {
|
|
50
|
-
indentation = utils.repeatString(' ', ctx.getOption('indentUnit'));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
res.setVariable('indentation', indentation);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns list of selections for current CodeMirror instance.
|
|
58
|
-
* @return {Array}
|
|
59
|
-
*/
|
|
60
|
-
selectionList: function() {
|
|
61
|
-
var cm = this.context;
|
|
62
|
-
return cm.listSelections().map(function(sel) {
|
|
63
|
-
var anchor = posToIndex(cm, sel.anchor);
|
|
64
|
-
var head = posToIndex(cm, sel.head);
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
start: Math.min(anchor, head),
|
|
68
|
-
end: Math.max(anchor, head)
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
getCaretPos: function() {
|
|
74
|
-
return this.getSelectionRange().start;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
setCaretPos: function(pos) {
|
|
78
|
-
this.createSelection(pos);
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Returns current selection range (for current selection index)
|
|
83
|
-
* @return {Object}
|
|
84
|
-
*/
|
|
85
|
-
getSelectionRange: function() {
|
|
86
|
-
return this.selectionList()[this.selectionIndex];
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
createSelection: function(start, end) {
|
|
90
|
-
if (typeof end == 'undefined') {
|
|
91
|
-
end = start;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var sels = this.selectionList();
|
|
95
|
-
var cm = this.context;
|
|
96
|
-
sels[this.selectionIndex] = {start: start, end: end};
|
|
97
|
-
this.context.setSelections(sels.map(function(sel) {
|
|
98
|
-
return {
|
|
99
|
-
head: indexToPos(cm, sel.start),
|
|
100
|
-
anchor: indexToPos(cm, sel.end)
|
|
101
|
-
};
|
|
102
|
-
}));
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Returns current selection
|
|
107
|
-
* @return {String}
|
|
108
|
-
*/
|
|
109
|
-
getSelection: function() {
|
|
110
|
-
var sel = this.getSelectionRange();
|
|
111
|
-
sel.start = indexToPos(this.context, sel.start);
|
|
112
|
-
sel.end = indexToPos(this.context, sel.end);
|
|
113
|
-
return this.context.getRange(sel.start, sel.end);
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
getCurrentLineRange: function() {
|
|
117
|
-
var caret = indexToPos(this.context, this.getCaretPos());
|
|
118
|
-
return {
|
|
119
|
-
start: posToIndex(this.context, caret.line, 0),
|
|
120
|
-
end: posToIndex(this.context, caret.line, this.context.getLine(caret.line).length)
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
getCurrentLine: function() {
|
|
125
|
-
var caret = indexToPos(this.context, this.getCaretPos());
|
|
126
|
-
return this.context.getLine(caret.line) || '';
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
replaceContent: function(value, start, end, noIndent) {
|
|
130
|
-
if (typeof end == 'undefined') {
|
|
131
|
-
end = (typeof start == 'undefined') ? this.getContent().length : start;
|
|
132
|
-
}
|
|
133
|
-
if (typeof start == 'undefined') {
|
|
134
|
-
start = 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// indent new value
|
|
138
|
-
if (!noIndent) {
|
|
139
|
-
value = utils.padString(value, utils.getLinePaddingFromPosition(this.getContent(), start));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// find new caret position
|
|
143
|
-
var tabstopData = tabStops.extract(value, {
|
|
144
|
-
escape: function(ch) {
|
|
145
|
-
return ch;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
value = tabstopData.text;
|
|
149
|
-
|
|
150
|
-
var firstTabStop = tabstopData.tabstops[0] || {start: value.length, end: value.length};
|
|
151
|
-
firstTabStop.start += start;
|
|
152
|
-
firstTabStop.end += start;
|
|
153
|
-
|
|
154
|
-
this.context.replaceRange(value, indexToPos(this.context, start), indexToPos(this.context, end));
|
|
155
|
-
this.createSelection(firstTabStop.start, firstTabStop.end);
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
getContent: function() {
|
|
159
|
-
return this.context.getValue();
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
getSyntax: function() {
|
|
163
|
-
var syntax = this.context.getOption('mode');
|
|
164
|
-
return this.modeMap[syntax] || actionUtils.detectSyntax(this, syntax);
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Returns current output profile name (@see emmet#setupProfile)
|
|
169
|
-
* @return {String}
|
|
170
|
-
*/
|
|
171
|
-
getProfileName: function() {
|
|
172
|
-
if (this.context.getOption('profile')) {
|
|
173
|
-
return this.context.getOption('profile');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return actionUtils.detectProfile(this);
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Ask user to enter something
|
|
181
|
-
* @param {String} title Dialog title
|
|
182
|
-
* @return {String} Entered data
|
|
183
|
-
*/
|
|
184
|
-
prompt: function(title) {
|
|
185
|
-
return prompt(title);
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Returns current editor's file path
|
|
190
|
-
* @return {String}
|
|
191
|
-
*/
|
|
192
|
-
getFilePath: function() {
|
|
193
|
-
return location.href;
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Check if current editor syntax is valid, e.g. is supported by Emmet
|
|
198
|
-
* @return {Boolean}
|
|
199
|
-
*/
|
|
200
|
-
isValidSyntax: function() {
|
|
201
|
-
return res.hasSyntax(this.getSyntax());
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var gulp = require('gulp');
|
|
3
|
-
var requirejs = require('gulp-requirejs');
|
|
4
|
-
var uglify = require('gulp-uglify');
|
|
5
|
-
var rename = require('gulp-rename');
|
|
6
|
-
|
|
7
|
-
gulp.task('default', function() {
|
|
8
|
-
// load JSON data
|
|
9
|
-
var snippets = fs.readFileSync('./node_modules/emmet/lib/snippets.json', {encoding: 'utf8'});
|
|
10
|
-
var caniuse = fs.readFileSync('./node_modules/emmet/lib/caniuse.json', {encoding: 'utf8'});
|
|
11
|
-
|
|
12
|
-
var loadData = 'var emmet = require("emmet/emmet");emmet.loadUserData({' +
|
|
13
|
-
'snippets: ' + snippets + ',' +
|
|
14
|
-
'caniuse: ' + caniuse +
|
|
15
|
-
'});';
|
|
16
|
-
|
|
17
|
-
return requirejs({
|
|
18
|
-
baseUrl: './',
|
|
19
|
-
name: 'vendor/almond',
|
|
20
|
-
include: ['./plugin'],
|
|
21
|
-
out: 'emmet.js',
|
|
22
|
-
paths: {
|
|
23
|
-
emmet: 'node_modules/emmet/lib',
|
|
24
|
-
lodash: 'node_modules/emmet/node_modules/lodash/lodash'
|
|
25
|
-
},
|
|
26
|
-
wrap: {
|
|
27
|
-
start: '(function (root, factory) {if (typeof define === "function" && define.amd) {define(factory);} else {root.emmetPlugin = factory();}}(this, function () {',
|
|
28
|
-
end: ';' + loadData +
|
|
29
|
-
'var plugin = require(\'plugin\');plugin.require = require;plugin.define = define;' +
|
|
30
|
-
'return plugin;}));'
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
.pipe(gulp.dest('./dist'))
|
|
34
|
-
.pipe(rename('emmet.min.js'))
|
|
35
|
-
.pipe(uglify())
|
|
36
|
-
.pipe(gulp.dest('./dist'));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
gulp.task('plugin', function() {
|
|
40
|
-
return requirejs({
|
|
41
|
-
baseUrl: './',
|
|
42
|
-
name: 'vendor/almond',
|
|
43
|
-
include: ['./shim', './plugin'],
|
|
44
|
-
out: 'emmetPlugin.js',
|
|
45
|
-
wrap: {
|
|
46
|
-
start: '(function (root, factory) {if (typeof define === "function" && define.amd) {define(factory);} else {root.emmetPlugin = factory();}}(this, function () {',
|
|
47
|
-
end: ';return require(\'plugin\');}));'
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
.pipe(gulp.dest('./dist'))
|
|
51
|
-
.pipe(rename('emmetPlugin.min.js'))
|
|
52
|
-
.pipe(uglify())
|
|
53
|
-
.pipe(gulp.dest('./dist'));
|
|
54
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Emmet for CodeMirror 4</title>
|
|
5
|
-
<link rel="stylesheet" href="./vendor/codemirror/v4/codemirror.css" />
|
|
6
|
-
<script src="./vendor/codemirror/v4/codemirror.js"></script>
|
|
7
|
-
<script src="./vendor/codemirror/v4/xml.js"></script>
|
|
8
|
-
<script src="./vendor/codemirror/v4/css.js"></script>
|
|
9
|
-
<script src="./vendor/codemirror/v4/htmlmixed.js"></script>
|
|
10
|
-
<script src="./node_modules/requirejs/require.js"></script>
|
|
11
|
-
|
|
12
|
-
<style>
|
|
13
|
-
.CodeMirror {
|
|
14
|
-
border: 1px solid black;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.cm-delimit {
|
|
18
|
-
color: #fa4;
|
|
19
|
-
}
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
<body>
|
|
23
|
-
<h1>Emmet for CodeMirror 4</h1>
|
|
24
|
-
|
|
25
|
-
<form><textarea id="code" name="code">
|
|
26
|
-
<html style="color: green">
|
|
27
|
-
<!-- this is a comment -->
|
|
28
|
-
<head>
|
|
29
|
-
<title>HTML Example</title>
|
|
30
|
-
</head>
|
|
31
|
-
<body>
|
|
32
|
-
The indentation tries to be <em>somewhat &quot;do what
|
|
33
|
-
I mean&quot;</em>... but might not match your style.
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
36
|
-
</textarea></form>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
40
|
-
mode : "text/html",
|
|
41
|
-
lineNumbers : true,
|
|
42
|
-
profile: 'xhtml' /* define Emmet output profile */
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
requirejs.config({
|
|
46
|
-
baseUrl: './',
|
|
47
|
-
paths: {
|
|
48
|
-
emmet: 'node_modules/emmet/lib',
|
|
49
|
-
lodash: 'node_modules/emmet/node_modules/lodash/lodash'
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
requirejs(['./plugin', 'emmet/emmet'], function(plugin, emmet) {
|
|
54
|
-
var loadJSON = function(url) {
|
|
55
|
-
var xhr = new XMLHttpRequest();
|
|
56
|
-
xhr.open('GET', url, false);
|
|
57
|
-
xhr.send(null);
|
|
58
|
-
return JSON.parse(xhr.responseText);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
emmet.loadUserData({
|
|
62
|
-
snippets: loadJSON('node_modules/emmet/lib/snippets.json'),
|
|
63
|
-
caniuse: loadJSON('node_modules/emmet/lib/caniuse.json')
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
</script>
|
|
67
|
-
</body>
|
|
68
|
-
</html>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "emmet-codemirror",
|
|
3
|
-
"version": "1.1.0",
|
|
4
|
-
"description": "Emmet plugin for CodeMirror",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
-
},
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git://github.com/emmetio/codemirror.git"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"emmet",
|
|
14
|
-
"codemirror",
|
|
15
|
-
"html",
|
|
16
|
-
"css",
|
|
17
|
-
"coding",
|
|
18
|
-
"speed"
|
|
19
|
-
],
|
|
20
|
-
"author": "Sergey Chikuyonok",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/emmetio/codemirror/issues"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/emmetio/codemirror",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"emmet": "^1.1.2"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"gulp": "^3.6.0",
|
|
31
|
-
"requirejs": "^2.1.11",
|
|
32
|
-
"gulp-uglify": "^0.2.1",
|
|
33
|
-
"gulp-requirejs": "^0.1.3",
|
|
34
|
-
"gulp-rename": "^1.2.0"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Emmet plugin for CodeMirror
|
|
3
|
-
*/
|
|
4
|
-
define(['./editor', 'emmet/emmet'], function(editor, emmet) {
|
|
5
|
-
var mac = /Mac/.test(navigator.platform);
|
|
6
|
-
var defaultKeymap = {
|
|
7
|
-
'Cmd-E': 'expand_abbreviation',
|
|
8
|
-
'Tab': 'expand_abbreviation_with_tab',
|
|
9
|
-
'Cmd-D': 'balance_outward',
|
|
10
|
-
'Shift-Cmd-D': 'balance_inward',
|
|
11
|
-
'Cmd-M': 'matching_pair',
|
|
12
|
-
'Shift-Cmd-A': 'wrap_with_abbreviation',
|
|
13
|
-
'Ctrl-Alt-Right': 'next_edit_point',
|
|
14
|
-
'Ctrl-Alt-Left': 'prev_edit_point',
|
|
15
|
-
'Cmd-L': 'select_line',
|
|
16
|
-
'Cmd-Shift-M': 'merge_lines',
|
|
17
|
-
'Cmd-/': 'toggle_comment',
|
|
18
|
-
'Cmd-J': 'split_join_tag',
|
|
19
|
-
'Cmd-K': 'remove_tag',
|
|
20
|
-
'Shift-Cmd-Y': 'evaluate_math_expression',
|
|
21
|
-
|
|
22
|
-
'Ctrl-Up': 'increment_number_by_1',
|
|
23
|
-
'Ctrl-Down': 'decrement_number_by_1',
|
|
24
|
-
'Ctrl-Alt-Up': 'increment_number_by_01',
|
|
25
|
-
'Ctrl-Alt-Down': 'decrement_number_by_01',
|
|
26
|
-
'Shift-Ctrl-Up': 'increment_number_by_10',
|
|
27
|
-
'Shift-Ctrl-Down': 'decrement_number_by_10',
|
|
28
|
-
|
|
29
|
-
'Shift-Cmd-.': 'select_next_item',
|
|
30
|
-
'Shift-Cmd-,': 'select_previous_item',
|
|
31
|
-
'Cmd-B': 'reflect_css_value',
|
|
32
|
-
|
|
33
|
-
'Enter': 'insert_formatted_line_break_only'
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// actions that should be performed in single selection mode
|
|
37
|
-
var singleSelectionActions = [
|
|
38
|
-
'prev_edit_point', 'next_edit_point', 'merge_lines',
|
|
39
|
-
'reflect_css_value', 'select_next_item', 'select_previous_item',
|
|
40
|
-
'wrap_with_abbreviation', 'update_tag', 'insert_formatted_line_break_only'
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
// add “profile” property to CodeMirror defaults so in won’t be lost
|
|
44
|
-
// then CM instance is instantiated with “profile” property
|
|
45
|
-
if (CodeMirror.defineOption) {
|
|
46
|
-
CodeMirror.defineOption('profile', 'html');
|
|
47
|
-
} else {
|
|
48
|
-
CodeMirror.defaults.profile = 'html';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function noop() {
|
|
52
|
-
if (CodeMirror.version >= '3.1') {
|
|
53
|
-
return CodeMirror.Pass;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
throw CodeMirror.Pass;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Emmet action decorator: creates a command function
|
|
61
|
-
* for CodeMirror and executes Emmet action as single
|
|
62
|
-
* undo command
|
|
63
|
-
* @param {String} name Action name
|
|
64
|
-
* @return {Function}
|
|
65
|
-
*/
|
|
66
|
-
function actionDecorator(name) {
|
|
67
|
-
return function(cm) {
|
|
68
|
-
editor.setupContext(cm);
|
|
69
|
-
var result;
|
|
70
|
-
cm.operation(function() {
|
|
71
|
-
result = runAction(name, cm);
|
|
72
|
-
});
|
|
73
|
-
return result;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Same as `actionDecorator()` but executes action
|
|
79
|
-
* with multiple selections
|
|
80
|
-
* @param {String} name Action name
|
|
81
|
-
* @return {Function}
|
|
82
|
-
*/
|
|
83
|
-
function multiSelectionActionDecorator(name) {
|
|
84
|
-
return function(cm) {
|
|
85
|
-
editor.setupContext(cm);
|
|
86
|
-
var selections = editor.selectionList();
|
|
87
|
-
var result = null;
|
|
88
|
-
cm.operation(function() {
|
|
89
|
-
for (var i = 0, il = selections.length; i < il; i++) {
|
|
90
|
-
editor.selectionIndex = i;
|
|
91
|
-
result = runAction(name, cm);
|
|
92
|
-
if (result === CodeMirror.Pass) {
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return result;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Runs Emmet action
|
|
103
|
-
* @param {String} name Action name
|
|
104
|
-
* @param {CodeMirror} cm CodeMirror instance
|
|
105
|
-
* @return {Boolean} Returns `true` if action is performed
|
|
106
|
-
* successfully
|
|
107
|
-
*/
|
|
108
|
-
function runAction(name, cm) {
|
|
109
|
-
if (name == 'expand_abbreviation_with_tab' && (cm.somethingSelected() || !editor.isValidSyntax())) {
|
|
110
|
-
// pass through Tab key handler if there's a selection
|
|
111
|
-
return noop();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var result = false;
|
|
115
|
-
try {
|
|
116
|
-
result = emmet.run(name, editor);
|
|
117
|
-
if (!result && name == 'insert_formatted_line_break_only') {
|
|
118
|
-
return noop();
|
|
119
|
-
}
|
|
120
|
-
} catch (e) {}
|
|
121
|
-
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function systemKeybinding(key) {
|
|
126
|
-
return !mac ? key.replace('Cmd', 'Ctrl') : key;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Adds given `key` as keybinding for Emmet `action`
|
|
131
|
-
* @param {String} key Keyboard shortcut
|
|
132
|
-
* @param {String} action Emmet action name
|
|
133
|
-
*/
|
|
134
|
-
function addKeybinding(key, action) {
|
|
135
|
-
key = systemKeybinding(key);
|
|
136
|
-
CodeMirror.keyMap['default'][key] = 'emmet.' + action;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// add actions and default keybindings
|
|
140
|
-
Object.keys(defaultKeymap).forEach(function(key) {
|
|
141
|
-
var action = defaultKeymap[key];
|
|
142
|
-
var cmCommand = 'emmet.' + action;
|
|
143
|
-
if (!CodeMirror.commands[cmCommand]) {
|
|
144
|
-
CodeMirror.commands[cmCommand] = ~singleSelectionActions.indexOf(action)
|
|
145
|
-
? actionDecorator(action)
|
|
146
|
-
: multiSelectionActionDecorator(action);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
addKeybinding(key, action);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
emmet: emmet,
|
|
154
|
-
editor: editor,
|
|
155
|
-
/**
|
|
156
|
-
* Adds new keybindings for Emmet action. The expected format
|
|
157
|
-
* of `keymap` object is the same as default `keymap`.
|
|
158
|
-
* @param {Object} keymap
|
|
159
|
-
*/
|
|
160
|
-
setKeymap: function(keymap) {
|
|
161
|
-
Object.keys(keymap).forEach(function(key) {
|
|
162
|
-
addKeybinding(key, keymap[key]);
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Clears all Emmet keybindings
|
|
168
|
-
*/
|
|
169
|
-
clearKeymap: function() {
|
|
170
|
-
var cmMap = CodeMirror.keyMap['default'];
|
|
171
|
-
var reEmmetAction = /^emmet\./;
|
|
172
|
-
Object.keys(cmMap).forEach(function(p) {
|
|
173
|
-
if (reEmmetAction.test(cmMap[p])) {
|
|
174
|
-
delete cmMap[p];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
addKeybinding: addKeybinding,
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Removes given keybinding or any keybinging bound to
|
|
183
|
-
* given action name
|
|
184
|
-
* @param {String} name Either keybinding or Emmet action name
|
|
185
|
-
*/
|
|
186
|
-
removeKeybinding: function(name) {
|
|
187
|
-
name = systemKeybinding(name);
|
|
188
|
-
var cmMap = CodeMirror.keyMap['default'];
|
|
189
|
-
if (name in cmMap) {
|
|
190
|
-
delete cmMap[name];
|
|
191
|
-
} else {
|
|
192
|
-
name = 'emmet.' + name;
|
|
193
|
-
Object.keys(cmMap).forEach(function(p) {
|
|
194
|
-
if (cmMap[p] === name) {
|
|
195
|
-
delete cmMap[p];
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
define('emmet/emmet', function() {
|
|
2
|
-
return emmet;
|
|
3
|
-
});
|
|
4
|
-
|
|
5
|
-
define('emmet/utils/common', function() {
|
|
6
|
-
return emmet.require('utils/common');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
define('emmet/utils/action', function() {
|
|
10
|
-
return emmet.require('utils/action');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
define('emmet/assets/resources', function() {
|
|
14
|
-
return emmet.require('assets/resources');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
define('emmet/assets/tabStops', function() {
|
|
18
|
-
return emmet.require('assets/tabStops');
|
|
19
|
-
});
|