bee_api 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bee_api +84 -0
- data/lib/mdpreview.rb +80 -0
- data/lib/mdpreview/translator.rb +60 -0
- data/lib/mdpreview/version.rb +3 -0
- data/test/mdptest.rb +100 -0
- data/vendor/HISTORY.md +237 -0
- data/vendor/Jakefile.js +316 -0
- data/vendor/LICENSE +176 -0
- data/vendor/NOTICE +17 -0
- data/vendor/README.md +102 -0
- data/vendor/app/chrome/documentation.txt +12 -0
- data/vendor/app/chrome/manifest.json +24 -0
- data/vendor/app/web/ajax.js +43 -0
- data/vendor/app/web/app.css +292 -0
- data/vendor/app/web/app.js +377 -0
- data/vendor/app/web/beta/index.html +17 -0
- data/vendor/app/web/datapolicy.txt +48 -0
- data/vendor/app/web/doc/doc.css +60 -0
- data/vendor/app/web/doc/img/actions_menu.png +0 -0
- data/vendor/app/web/doc/img/button_actions_menu.png +0 -0
- data/vendor/app/web/doc/img/button_dragarea.png +0 -0
- data/vendor/app/web/doc/img/jsoneditor.png +0 -0
- data/vendor/app/web/doc/img/jsonformatter.png +0 -0
- data/vendor/app/web/doc/img/main_menu.png +0 -0
- data/vendor/app/web/doc/img/splitter.png +0 -0
- data/vendor/app/web/doc/index.html +201 -0
- data/vendor/app/web/favicon.ico +0 -0
- data/vendor/app/web/fileretriever.css +54 -0
- data/vendor/app/web/fileretriever.js +567 -0
- data/vendor/app/web/fileretriever.php +120 -0
- data/vendor/app/web/googlea47c4a0b36d11021.html +1 -0
- data/vendor/app/web/hash.js +133 -0
- data/vendor/app/web/img/description.txt +20 -0
- data/vendor/app/web/img/header_background.png +0 -0
- data/vendor/app/web/img/icon_128.png +0 -0
- data/vendor/app/web/img/icon_16.png +0 -0
- data/vendor/app/web/img/icon_gray.svg +151 -0
- data/vendor/app/web/img/icon_gray_16.svg +150 -0
- data/vendor/app/web/img/icon_orange.svg +151 -0
- data/vendor/app/web/img/logo.png +0 -0
- data/vendor/app/web/img/logo.xcf +0 -0
- data/vendor/app/web/img/logo_app.png +0 -0
- data/vendor/app/web/img/logo_app.xcf +0 -0
- data/vendor/app/web/index.html +191 -0
- data/vendor/app/web/notify.js +150 -0
- data/vendor/app/web/queryparams.js +71 -0
- data/vendor/app/web/robots.txt +0 -0
- data/vendor/app/web/splitter.js +179 -0
- data/vendor/app/web/test.html +224 -0
- data/vendor/component.json +33 -0
- data/vendor/docs/api.md +188 -0
- data/vendor/docs/usage.md +137 -0
- data/vendor/examples/01_basic_usage.html +45 -0
- data/vendor/examples/02_viewer.html +38 -0
- data/vendor/examples/03_switch_mode.html +98 -0
- data/vendor/examples/cur.file +1 -0
- data/vendor/examples/jquery.js +2 -0
- data/vendor/examples/meta.js +1 -0
- data/vendor/examples/requirejs_demo/requirejs_demo.html +19 -0
- data/vendor/examples/requirejs_demo/scripts/main.js +25 -0
- data/vendor/examples/requirejs_demo/scripts/require.js +35 -0
- data/vendor/img/jsoneditor-icons.png +0 -0
- data/vendor/jsoneditor-min.css +1 -0
- data/vendor/jsoneditor-min.js +34 -0
- data/vendor/jsoneditor.css +597 -0
- data/vendor/jsoneditor.js +6069 -0
- data/vendor/jsoneditor/css/contextmenu.css +219 -0
- data/vendor/jsoneditor/css/img/description.txt +13 -0
- data/vendor/jsoneditor/css/img/export.sh +16 -0
- data/vendor/jsoneditor/css/img/jsoneditor-icons.png +0 -0
- data/vendor/jsoneditor/css/img/jsoneditor-icons.svg +861 -0
- data/vendor/jsoneditor/css/jsoneditor.css +220 -0
- data/vendor/jsoneditor/css/menu.css +81 -0
- data/vendor/jsoneditor/css/searchbox.css +73 -0
- data/vendor/jsoneditor/js/appendnode.js +211 -0
- data/vendor/jsoneditor/js/contextmenu.js +440 -0
- data/vendor/jsoneditor/js/header.js +32 -0
- data/vendor/jsoneditor/js/highlighter.js +82 -0
- data/vendor/jsoneditor/js/history.js +218 -0
- data/vendor/jsoneditor/js/jsoneditor.js +206 -0
- data/vendor/jsoneditor/js/module.js +50 -0
- data/vendor/jsoneditor/js/node.js +2864 -0
- data/vendor/jsoneditor/js/searchbox.js +288 -0
- data/vendor/jsoneditor/js/texteditor.js +311 -0
- data/vendor/jsoneditor/js/treeeditor.js +770 -0
- data/vendor/jsoneditor/js/util.js +582 -0
- data/vendor/lib/ace/ace.js +11 -0
- data/vendor/lib/ace/mode-json.js +1 -0
- data/vendor/lib/ace/theme-jsoneditor.js +144 -0
- data/vendor/lib/ace/theme-textmate.js +163 -0
- data/vendor/lib/ace/worker-json.js +1 -0
- data/vendor/lib/jsonlint/README.md +62 -0
- data/vendor/lib/jsonlint/jsonlint.js +432 -0
- data/vendor/misc/screenshots/actionsmenu_640x400.png +0 -0
- data/vendor/misc/screenshots/codeeditor_640x400.png +0 -0
- data/vendor/misc/screenshots/description.json +17 -0
- data/vendor/misc/screenshots/jsoneditoronline.png +0 -0
- data/vendor/misc/screenshots/jsoneditoronline_640x400.png +0 -0
- data/vendor/misc/screenshots/search_640x400.png +0 -0
- data/vendor/misc/screenshots/small_tile.xcf +0 -0
- data/vendor/misc/screenshots/small_tile_440x280.png +0 -0
- data/vendor/misc/todo.txt +101 -0
- data/vendor/package.json +28 -0
- data/vendor/test/couchdbeditor.html +100 -0
- data/vendor/test/largefile.json +12605 -0
- data/vendor/test/test_ace.html +60 -0
- data/vendor/test/test_editable_div.html +449 -0
- metadata +154 -0
@@ -0,0 +1,440 @@
|
|
1
|
+
/**
|
2
|
+
* A context menu
|
3
|
+
* @param {Object[]} items Array containing the menu structure
|
4
|
+
* TODO: describe structure
|
5
|
+
* @param {Object} [options] Object with options. Available options:
|
6
|
+
* {function} close Callback called when the
|
7
|
+
* context menu is being closed.
|
8
|
+
* @constructor
|
9
|
+
*/
|
10
|
+
function ContextMenu (items, options) {
|
11
|
+
this.dom = {};
|
12
|
+
|
13
|
+
var me = this;
|
14
|
+
var dom = this.dom;
|
15
|
+
this.anchor = undefined;
|
16
|
+
this.items = items;
|
17
|
+
this.eventListeners = {};
|
18
|
+
this.selection = undefined; // holds the selection before the menu was opened
|
19
|
+
this.visibleSubmenu = undefined;
|
20
|
+
this.onClose = options ? options.close : undefined;
|
21
|
+
|
22
|
+
// create a container element
|
23
|
+
var menu = document.createElement('div');
|
24
|
+
menu.className = 'jsoneditor-contextmenu';
|
25
|
+
dom.menu = menu;
|
26
|
+
|
27
|
+
// create a list to hold the menu items
|
28
|
+
var list = document.createElement('ul');
|
29
|
+
list.className = 'menu';
|
30
|
+
menu.appendChild(list);
|
31
|
+
dom.list = list;
|
32
|
+
dom.items = []; // list with all buttons
|
33
|
+
|
34
|
+
// create a (non-visible) button to set the focus to the menu
|
35
|
+
var focusButton = document.createElement('button');
|
36
|
+
dom.focusButton = focusButton;
|
37
|
+
var li = document.createElement('li');
|
38
|
+
li.style.overflow = 'hidden';
|
39
|
+
li.style.height = '0';
|
40
|
+
li.appendChild(focusButton);
|
41
|
+
list.appendChild(li);
|
42
|
+
|
43
|
+
function createMenuItems (list, domItems, items) {
|
44
|
+
items.forEach(function (item) {
|
45
|
+
if (item.type == 'separator') {
|
46
|
+
// create a separator
|
47
|
+
var separator = document.createElement('div');
|
48
|
+
separator.className = 'separator';
|
49
|
+
li = document.createElement('li');
|
50
|
+
li.appendChild(separator);
|
51
|
+
list.appendChild(li);
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
var domItem = {};
|
55
|
+
|
56
|
+
// create a menu item
|
57
|
+
var li = document.createElement('li');
|
58
|
+
list.appendChild(li);
|
59
|
+
|
60
|
+
// create a button in the menu item
|
61
|
+
var button = document.createElement('button');
|
62
|
+
button.className = item.className;
|
63
|
+
domItem.button = button;
|
64
|
+
if (item.title) {
|
65
|
+
button.title = item.title;
|
66
|
+
}
|
67
|
+
if (item.click) {
|
68
|
+
button.onclick = function () {
|
69
|
+
me.hide();
|
70
|
+
item.click();
|
71
|
+
};
|
72
|
+
}
|
73
|
+
li.appendChild(button);
|
74
|
+
|
75
|
+
// create the contents of the button
|
76
|
+
if (item.submenu) {
|
77
|
+
// add the icon to the button
|
78
|
+
var divIcon = document.createElement('div');
|
79
|
+
divIcon.className = 'icon';
|
80
|
+
button.appendChild(divIcon);
|
81
|
+
button.appendChild(document.createTextNode(item.text));
|
82
|
+
|
83
|
+
var buttonSubmenu;
|
84
|
+
if (item.click) {
|
85
|
+
// submenu and a button with a click handler
|
86
|
+
button.className += ' default';
|
87
|
+
|
88
|
+
var buttonExpand = document.createElement('button');
|
89
|
+
domItem.buttonExpand = buttonExpand;
|
90
|
+
buttonExpand.className = 'expand';
|
91
|
+
buttonExpand.innerHTML = '<div class="expand"></div>';
|
92
|
+
li.appendChild(buttonExpand);
|
93
|
+
if (item.submenuTitle) {
|
94
|
+
buttonExpand.title = item.submenuTitle;
|
95
|
+
}
|
96
|
+
|
97
|
+
buttonSubmenu = buttonExpand;
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
// submenu and a button without a click handler
|
101
|
+
var divExpand = document.createElement('div');
|
102
|
+
divExpand.className = 'expand';
|
103
|
+
button.appendChild(divExpand);
|
104
|
+
|
105
|
+
buttonSubmenu = button;
|
106
|
+
}
|
107
|
+
|
108
|
+
// attach a handler to expand/collapse the submenu
|
109
|
+
buttonSubmenu.onclick = function () {
|
110
|
+
me._onExpandItem(domItem);
|
111
|
+
buttonSubmenu.focus();
|
112
|
+
};
|
113
|
+
|
114
|
+
// create the submenu
|
115
|
+
var domSubItems = [];
|
116
|
+
domItem.subItems = domSubItems;
|
117
|
+
var ul = document.createElement('ul');
|
118
|
+
domItem.ul = ul;
|
119
|
+
ul.className = 'menu';
|
120
|
+
ul.style.height = '0';
|
121
|
+
li.appendChild(ul);
|
122
|
+
createMenuItems(ul, domSubItems, item.submenu);
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
// no submenu, just a button with clickhandler
|
126
|
+
button.innerHTML = '<div class="icon"></div>' + item.text;
|
127
|
+
}
|
128
|
+
|
129
|
+
domItems.push(domItem);
|
130
|
+
}
|
131
|
+
});
|
132
|
+
}
|
133
|
+
createMenuItems(list, this.dom.items, items);
|
134
|
+
|
135
|
+
// TODO: when the editor is small, show the submenu on the right instead of inline?
|
136
|
+
|
137
|
+
// calculate the max height of the menu with one submenu expanded
|
138
|
+
this.maxHeight = 0; // height in pixels
|
139
|
+
items.forEach(function (item) {
|
140
|
+
var height = (items.length + (item.submenu ? item.submenu.length : 0)) * 24;
|
141
|
+
me.maxHeight = Math.max(me.maxHeight, height);
|
142
|
+
});
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Get the currently visible buttons
|
147
|
+
* @return {Array.<HTMLElement>} buttons
|
148
|
+
* @private
|
149
|
+
*/
|
150
|
+
ContextMenu.prototype._getVisibleButtons = function () {
|
151
|
+
var buttons = [];
|
152
|
+
var me = this;
|
153
|
+
this.dom.items.forEach(function (item) {
|
154
|
+
buttons.push(item.button);
|
155
|
+
if (item.buttonExpand) {
|
156
|
+
buttons.push(item.buttonExpand);
|
157
|
+
}
|
158
|
+
if (item.subItems && item == me.expandedItem) {
|
159
|
+
item.subItems.forEach(function (subItem) {
|
160
|
+
buttons.push(subItem.button);
|
161
|
+
if (subItem.buttonExpand) {
|
162
|
+
buttons.push(subItem.buttonExpand);
|
163
|
+
}
|
164
|
+
// TODO: change to fully recursive method
|
165
|
+
});
|
166
|
+
}
|
167
|
+
});
|
168
|
+
|
169
|
+
return buttons;
|
170
|
+
};
|
171
|
+
|
172
|
+
// currently displayed context menu, a singleton. We may only have one visible context menu
|
173
|
+
ContextMenu.visibleMenu = undefined;
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Attach the menu to an anchor
|
177
|
+
* @param {HTMLElement} anchor
|
178
|
+
*/
|
179
|
+
ContextMenu.prototype.show = function (anchor) {
|
180
|
+
this.hide();
|
181
|
+
|
182
|
+
// calculate whether the menu fits below the anchor
|
183
|
+
var windowHeight = util.getWindowHeight();
|
184
|
+
var anchorHeight = anchor.offsetHeight;
|
185
|
+
var menuHeight = this.maxHeight;
|
186
|
+
|
187
|
+
// position the menu
|
188
|
+
var left = util.getAbsoluteLeft(anchor);
|
189
|
+
var top = util.getAbsoluteTop(anchor);
|
190
|
+
if (top + anchorHeight + menuHeight < windowHeight) {
|
191
|
+
// display the menu below the anchor
|
192
|
+
this.dom.menu.style.left = left + 'px';
|
193
|
+
this.dom.menu.style.top = (top + anchorHeight) + 'px';
|
194
|
+
this.dom.menu.style.bottom = '';
|
195
|
+
}
|
196
|
+
else {
|
197
|
+
// display the menu above the anchor
|
198
|
+
this.dom.menu.style.left = left + 'px';
|
199
|
+
this.dom.menu.style.top = '';
|
200
|
+
this.dom.menu.style.bottom = (windowHeight - top) + 'px';
|
201
|
+
}
|
202
|
+
|
203
|
+
// attach the menu to the document
|
204
|
+
document.body.appendChild(this.dom.menu);
|
205
|
+
|
206
|
+
// create and attach event listeners
|
207
|
+
var me = this;
|
208
|
+
var list = this.dom.list;
|
209
|
+
this.eventListeners.mousedown = util.addEventListener(
|
210
|
+
document, 'mousedown', function (event) {
|
211
|
+
// hide menu on click outside of the menu
|
212
|
+
event = event || window.event;
|
213
|
+
var target = event.target || event.srcElement;
|
214
|
+
if ((target != list) && !me._isChildOf(target, list)) {
|
215
|
+
me.hide();
|
216
|
+
util.stopPropagation(event);
|
217
|
+
util.preventDefault(event);
|
218
|
+
}
|
219
|
+
});
|
220
|
+
this.eventListeners.mousewheel = util.addEventListener(
|
221
|
+
document, 'mousewheel', function () {
|
222
|
+
// hide the menu on mouse scroll
|
223
|
+
util.stopPropagation(event);
|
224
|
+
util.preventDefault(event);
|
225
|
+
});
|
226
|
+
this.eventListeners.keydown = util.addEventListener(
|
227
|
+
document, 'keydown', function (event) {
|
228
|
+
me._onKeyDown(event);
|
229
|
+
});
|
230
|
+
|
231
|
+
// move focus to the first button in the context menu
|
232
|
+
this.selection = util.getSelection();
|
233
|
+
this.anchor = anchor;
|
234
|
+
setTimeout(function () {
|
235
|
+
me.dom.focusButton.focus();
|
236
|
+
}, 0);
|
237
|
+
|
238
|
+
if (ContextMenu.visibleMenu) {
|
239
|
+
ContextMenu.visibleMenu.hide();
|
240
|
+
}
|
241
|
+
ContextMenu.visibleMenu = this;
|
242
|
+
};
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Hide the context menu if visible
|
246
|
+
*/
|
247
|
+
ContextMenu.prototype.hide = function () {
|
248
|
+
// remove the menu from the DOM
|
249
|
+
if (this.dom.menu.parentNode) {
|
250
|
+
this.dom.menu.parentNode.removeChild(this.dom.menu);
|
251
|
+
if (this.onClose) {
|
252
|
+
this.onClose();
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
// remove all event listeners
|
257
|
+
// all event listeners are supposed to be attached to document.
|
258
|
+
for (var name in this.eventListeners) {
|
259
|
+
if (this.eventListeners.hasOwnProperty(name)) {
|
260
|
+
var fn = this.eventListeners[name];
|
261
|
+
if (fn) {
|
262
|
+
util.removeEventListener(document, name, fn);
|
263
|
+
}
|
264
|
+
delete this.eventListeners[name];
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
if (ContextMenu.visibleMenu == this) {
|
269
|
+
ContextMenu.visibleMenu = undefined;
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Expand a submenu
|
275
|
+
* Any currently expanded submenu will be hided.
|
276
|
+
* @param {Object} domItem
|
277
|
+
* @private
|
278
|
+
*/
|
279
|
+
ContextMenu.prototype._onExpandItem = function (domItem) {
|
280
|
+
var me = this;
|
281
|
+
var alreadyVisible = (domItem == this.expandedItem);
|
282
|
+
|
283
|
+
// hide the currently visible submenu
|
284
|
+
var expandedItem = this.expandedItem;
|
285
|
+
if (expandedItem) {
|
286
|
+
//var ul = expandedItem.ul;
|
287
|
+
expandedItem.ul.style.height = '0';
|
288
|
+
expandedItem.ul.style.padding = '';
|
289
|
+
setTimeout(function () {
|
290
|
+
if (me.expandedItem != expandedItem) {
|
291
|
+
expandedItem.ul.style.display = '';
|
292
|
+
util.removeClassName(expandedItem.ul.parentNode, 'selected');
|
293
|
+
}
|
294
|
+
}, 300); // timeout duration must match the css transition duration
|
295
|
+
this.expandedItem = undefined;
|
296
|
+
}
|
297
|
+
|
298
|
+
if (!alreadyVisible) {
|
299
|
+
var ul = domItem.ul;
|
300
|
+
ul.style.display = 'block';
|
301
|
+
var height = ul.clientHeight; // force a reflow in Firefox
|
302
|
+
setTimeout(function () {
|
303
|
+
if (me.expandedItem == domItem) {
|
304
|
+
ul.style.height = (ul.childNodes.length * 24) + 'px';
|
305
|
+
ul.style.padding = '5px 10px';
|
306
|
+
}
|
307
|
+
}, 0);
|
308
|
+
util.addClassName(ul.parentNode, 'selected');
|
309
|
+
this.expandedItem = domItem;
|
310
|
+
}
|
311
|
+
};
|
312
|
+
|
313
|
+
/**
|
314
|
+
* Handle onkeydown event
|
315
|
+
* @param {Event} event
|
316
|
+
* @private
|
317
|
+
*/
|
318
|
+
ContextMenu.prototype._onKeyDown = function (event) {
|
319
|
+
event = event || window.event;
|
320
|
+
var target = event.target || event.srcElement;
|
321
|
+
var keynum = event.which || event.keyCode;
|
322
|
+
var handled = false;
|
323
|
+
var buttons, targetIndex, prevButton, nextButton;
|
324
|
+
|
325
|
+
if (keynum == 27) { // ESC
|
326
|
+
// hide the menu on ESC key
|
327
|
+
|
328
|
+
// restore previous selection and focus
|
329
|
+
if (this.selection) {
|
330
|
+
util.setSelection(this.selection);
|
331
|
+
}
|
332
|
+
if (this.anchor) {
|
333
|
+
this.anchor.focus();
|
334
|
+
}
|
335
|
+
|
336
|
+
this.hide();
|
337
|
+
|
338
|
+
handled = true;
|
339
|
+
}
|
340
|
+
else if (keynum == 9) { // Tab
|
341
|
+
if (!event.shiftKey) { // Tab
|
342
|
+
buttons = this._getVisibleButtons();
|
343
|
+
targetIndex = buttons.indexOf(target);
|
344
|
+
if (targetIndex == buttons.length - 1) {
|
345
|
+
// move to first button
|
346
|
+
buttons[0].focus();
|
347
|
+
handled = true;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
else { // Shift+Tab
|
351
|
+
buttons = this._getVisibleButtons();
|
352
|
+
targetIndex = buttons.indexOf(target);
|
353
|
+
if (targetIndex == 0) {
|
354
|
+
// move to last button
|
355
|
+
buttons[buttons.length - 1].focus();
|
356
|
+
handled = true;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
else if (keynum == 37) { // Arrow Left
|
361
|
+
if (target.className == 'expand') {
|
362
|
+
buttons = this._getVisibleButtons();
|
363
|
+
targetIndex = buttons.indexOf(target);
|
364
|
+
prevButton = buttons[targetIndex - 1];
|
365
|
+
if (prevButton) {
|
366
|
+
prevButton.focus();
|
367
|
+
}
|
368
|
+
}
|
369
|
+
handled = true;
|
370
|
+
}
|
371
|
+
else if (keynum == 38) { // Arrow Up
|
372
|
+
buttons = this._getVisibleButtons();
|
373
|
+
targetIndex = buttons.indexOf(target);
|
374
|
+
prevButton = buttons[targetIndex - 1];
|
375
|
+
if (prevButton && prevButton.className == 'expand') {
|
376
|
+
// skip expand button
|
377
|
+
prevButton = buttons[targetIndex - 2];
|
378
|
+
}
|
379
|
+
if (!prevButton) {
|
380
|
+
// move to last button
|
381
|
+
prevButton = buttons[buttons.length - 1];
|
382
|
+
}
|
383
|
+
if (prevButton) {
|
384
|
+
prevButton.focus();
|
385
|
+
}
|
386
|
+
handled = true;
|
387
|
+
}
|
388
|
+
else if (keynum == 39) { // Arrow Right
|
389
|
+
buttons = this._getVisibleButtons();
|
390
|
+
targetIndex = buttons.indexOf(target);
|
391
|
+
nextButton = buttons[targetIndex + 1];
|
392
|
+
if (nextButton && nextButton.className == 'expand') {
|
393
|
+
nextButton.focus();
|
394
|
+
}
|
395
|
+
handled = true;
|
396
|
+
}
|
397
|
+
else if (keynum == 40) { // Arrow Down
|
398
|
+
buttons = this._getVisibleButtons();
|
399
|
+
targetIndex = buttons.indexOf(target);
|
400
|
+
nextButton = buttons[targetIndex + 1];
|
401
|
+
if (nextButton && nextButton.className == 'expand') {
|
402
|
+
// skip expand button
|
403
|
+
nextButton = buttons[targetIndex + 2];
|
404
|
+
}
|
405
|
+
if (!nextButton) {
|
406
|
+
// move to first button
|
407
|
+
nextButton = buttons[0];
|
408
|
+
}
|
409
|
+
if (nextButton) {
|
410
|
+
nextButton.focus();
|
411
|
+
handled = true;
|
412
|
+
}
|
413
|
+
handled = true;
|
414
|
+
}
|
415
|
+
// TODO: arrow left and right
|
416
|
+
|
417
|
+
if (handled) {
|
418
|
+
util.stopPropagation(event);
|
419
|
+
util.preventDefault(event);
|
420
|
+
}
|
421
|
+
};
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Test if an element is a child of a parent element.
|
425
|
+
* @param {Element} child
|
426
|
+
* @param {Element} parent
|
427
|
+
* @return {boolean} isChild
|
428
|
+
*/
|
429
|
+
ContextMenu.prototype._isChildOf = function (child, parent) {
|
430
|
+
var e = child.parentNode;
|
431
|
+
while (e) {
|
432
|
+
if (e == parent) {
|
433
|
+
return true;
|
434
|
+
}
|
435
|
+
e = e.parentNode;
|
436
|
+
}
|
437
|
+
|
438
|
+
return false;
|
439
|
+
};
|
440
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*!
|
2
|
+
* jsoneditor.js
|
3
|
+
*
|
4
|
+
* @brief
|
5
|
+
* JSONEditor is a web-based tool to view, edit, and format JSON.
|
6
|
+
* It shows data a clear, editable treeview.
|
7
|
+
*
|
8
|
+
* Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
|
9
|
+
*
|
10
|
+
* @license
|
11
|
+
* This json editor is open sourced with the intention to use the editor as
|
12
|
+
* a component in your own application. Not to just copy and monetize the editor
|
13
|
+
* as it is.
|
14
|
+
*
|
15
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
16
|
+
* use this file except in compliance with the License. You may obtain a copy
|
17
|
+
* of the License at
|
18
|
+
*
|
19
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
*
|
21
|
+
* Unless required by applicable law or agreed to in writing, software
|
22
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
23
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
24
|
+
* License for the specific language governing permissions and limitations under
|
25
|
+
* the License.
|
26
|
+
*
|
27
|
+
* Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org
|
28
|
+
*
|
29
|
+
* @author Jos de Jong, <wjosdejong@gmail.com>
|
30
|
+
* @version @@version
|
31
|
+
* @date @@date
|
32
|
+
*/
|