updated build
This commit is contained in:
parent
1e7efe70e1
commit
0c1c39d14f
28 changed files with 1147 additions and 937 deletions
|
|
@ -175,9 +175,9 @@ var lookup = function(moduleName) {
|
|||
|
||||
define('pilot/index', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/types/basic', 'pilot/types/command', 'pilot/types/settings', 'pilot/commands/settings', 'pilot/commands/basic', 'pilot/settings/canon', 'pilot/canon'], function(require, exports, module) {
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/fixoldbrowsers');
|
||||
require('pilot/fixoldbrowsers');
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/types/basic').startup(data, reason);
|
||||
require('pilot/types/command').startup(data, reason);
|
||||
require('pilot/types/settings').startup(data, reason);
|
||||
|
|
@ -3313,6 +3313,7 @@ exports.keyCodeToString = function(keyCode) {
|
|||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -3335,16 +3336,45 @@ var EventEmitter = {};
|
|||
EventEmitter._emit =
|
||||
EventEmitter._dispatchEvent = function(eventName, e) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners || !listeners.length) return;
|
||||
var listeners = this._eventRegistry[eventName] || [];
|
||||
var defaultHandler = this._defaultHandlers[eventName];
|
||||
if (!listeners.length && !defaultHandler)
|
||||
return;
|
||||
|
||||
var e = e || {};
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
}
|
||||
|
||||
if (!e.preventDefault) {
|
||||
e.preventDefault = function() {
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
}
|
||||
|
||||
for (var i=0; i<listeners.length; i++) {
|
||||
listeners[i](e);
|
||||
if (e.propagationStopped)
|
||||
break;
|
||||
}
|
||||
|
||||
if (defaultHandler && !e.defaultPrevented)
|
||||
defaultHandler(e);
|
||||
};
|
||||
|
||||
EventEmitter.setDefaultHandler = function(eventName, callback) {
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
if (this._defaultHandlers[eventName])
|
||||
throw new Error("The default handler for '" + eventName + "' is already set");
|
||||
|
||||
this._defaultHandlers[eventName] = callback;
|
||||
};
|
||||
|
||||
EventEmitter.on =
|
||||
|
|
@ -3352,12 +3382,11 @@ EventEmitter.addEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
}
|
||||
if (listeners.indexOf(callback) == -1) {
|
||||
if (!listeners)
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
|
||||
if (listeners.indexOf(callback) == -1)
|
||||
listeners.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeListener =
|
||||
|
|
@ -3365,18 +3394,17 @@ EventEmitter.removeEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
if (!listeners)
|
||||
return;
|
||||
|
||||
var index = listeners.indexOf(callback);
|
||||
if (index !== -1) {
|
||||
if (index !== -1)
|
||||
listeners.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeAllListeners = function(eventName) {
|
||||
if (this._eventRegistry) this._eventRegistry[eventName] = [];
|
||||
}
|
||||
};
|
||||
|
||||
exports.EventEmitter = EventEmitter;
|
||||
|
||||
|
|
@ -3651,9 +3679,8 @@ exports.deferredCall = function(fcn) {
|
|||
};
|
||||
|
||||
var deferred = function(timeout) {
|
||||
if (!timer) {
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
}
|
||||
deferred.cancel();
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
return deferred;
|
||||
}
|
||||
|
||||
|
|
@ -6295,7 +6322,6 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return callback(e, hashId, keyCode);
|
||||
}
|
||||
|
||||
|
|
@ -6328,7 +6354,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
addListener(el, "keypress", function(e) {
|
||||
var keyId = e.keyIdentifier || e.keyCode;
|
||||
if (lastDown !== keyId) {
|
||||
return normalizeCommandKeys(callback, e, e.keyCode);
|
||||
return normalizeCommandKeys(callback, e, lastDown);
|
||||
} else {
|
||||
lastDown = null;
|
||||
}
|
||||
|
|
@ -6982,7 +7008,7 @@ exports.Range = Range;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
|
||||
|
|
@ -6991,7 +7017,7 @@ var event = require("pilot/event");
|
|||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse_handler").MouseHandler;
|
||||
var MouseHandler = require("ace/mouse/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
|
|
@ -8221,7 +8247,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var text = dom.createElement("textarea");
|
||||
if (useragent.isTouchPad)
|
||||
text.setAttribute('x-palm-disable-auto-cap',true);
|
||||
text.setAttribute("x-palm-disable-auto-cap", true);
|
||||
|
||||
text.style.left = "-10000px";
|
||||
parentNode.appendChild(text);
|
||||
|
||||
|
|
@ -8237,7 +8264,7 @@ var TextInput = function(parentNode, host) {
|
|||
try {
|
||||
text.select();
|
||||
} catch (e) {}
|
||||
};
|
||||
}
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
|
|
@ -8333,10 +8360,10 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if ("onpropertychange" in text && !("oninput" in text))
|
||||
event.addListener(text, "propertychange", onPropertyChange);
|
||||
|
|
@ -8484,23 +8511,16 @@ exports.TextInput = TextInput;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
define('ace/mouse/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'ace/mouse/default_handlers', 'ace/mouse/mouse_event'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
var DefaultHandlers = require("ace/mouse/default_handlers").DefaultHandlers;
|
||||
var MouseEvent = require("ace/mouse/mouse_event").MouseEvent;
|
||||
|
||||
var MouseHandler = function(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
this.browserFocus = new BrowserFocus();
|
||||
this.defaultHandlers = new DefaultHandlers(editor);
|
||||
event.addListener(editor.container, "mousedown", function(e) {
|
||||
editor.focus();
|
||||
return event.preventDefault(e);
|
||||
|
|
@ -8511,6 +8531,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
var mouseTarget = editor.renderer.getMouseEventTarget();
|
||||
event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
|
||||
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
|
|
@ -8528,32 +8549,121 @@ var MouseHandler = function(editor) {
|
|||
return this.$scrollSpeed;
|
||||
};
|
||||
|
||||
this.$getEventPosition = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
var pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.editor.session.getLength()-1));
|
||||
return pos;
|
||||
};
|
||||
|
||||
this.$distance = function(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
};
|
||||
|
||||
this.onMouseDown = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor._dispatchEvent("mousedown", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
this.editor._dispatchEvent("mousemove", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
this.editor._dispatchEvent("dblclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
this.editor._dispatchEvent("tripleclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor._dispatchEvent("quadclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var mouseEvent = new MouseEvent(e, this.editor);
|
||||
mouseEvent.speed = this.$scrollSpeed * 2;
|
||||
mouseEvent.wheelX = e.wheelX;
|
||||
mouseEvent.wheelY = e.wheelY;
|
||||
|
||||
this.editor._dispatchEvent("mousewheel", mouseEvent);
|
||||
};
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/event_emitter', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
|
||||
function DefaultHandlers(editor) {
|
||||
this.editor = editor;
|
||||
this.$clickSelection = null;
|
||||
this.browserFocus = new BrowserFocus();
|
||||
|
||||
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(this));
|
||||
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(this));
|
||||
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(this));
|
||||
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(this));
|
||||
editor.setDefaultHandler("mousewheel", this.onScroll.bind(this));
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
this.onMouseDown = function(ev) {
|
||||
var inSelection = ev.inSelection();
|
||||
var pageX = ev.pageX;
|
||||
var pageY = ev.pageY;
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var self = this;
|
||||
var _self = this;
|
||||
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
var selectionEmpty = selectionRange.isEmpty();
|
||||
var inSelection = !editor.getReadOnly()
|
||||
&& !selectionEmpty
|
||||
&& selectionRange.contains(pos.row, pos.column);
|
||||
|
||||
var state = STATE_UNKNOWN;
|
||||
|
||||
// if this click caused the editor to be focused should not clear the
|
||||
|
|
@ -8562,14 +8672,14 @@ var MouseHandler = function(editor) {
|
|||
inSelection && (
|
||||
!this.browserFocus.isFocused()
|
||||
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|
||||
|| !this.editor.isFocused()
|
||||
|| !editor.isFocused()
|
||||
)
|
||||
) {
|
||||
this.editor.focus();
|
||||
editor.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var button = event.getButton(e);
|
||||
var button = ev.getButton();
|
||||
if (button !== 0) {
|
||||
if (selectionEmpty) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
|
|
@ -8579,7 +8689,8 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Select the fold as the user clicks it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
|
|
@ -8611,7 +8722,7 @@ var MouseHandler = function(editor) {
|
|||
else if (state == STATE_DRAG)
|
||||
onMouseDragSelectionEnd();
|
||||
|
||||
self.$clickSelection = null;
|
||||
_self.$clickSelection = null;
|
||||
state = STATE_UNKNOWN;
|
||||
};
|
||||
|
||||
|
|
@ -8619,7 +8730,7 @@ var MouseHandler = function(editor) {
|
|||
dom.removeCssClass(editor.container, "ace_dragging");
|
||||
editor.session.removeMarker(dragSelectionMarker);
|
||||
|
||||
if (!self.$clickSelection) {
|
||||
if (!editor.$mouseHandler.$clickSelection) {
|
||||
if (!dragCursor) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
|
|
@ -8649,16 +8760,16 @@ var MouseHandler = function(editor) {
|
|||
return;
|
||||
|
||||
if (state == STATE_UNKNOWN) {
|
||||
var distance = self.$distance(pageX, pageY, mousePageX, mousePageY);
|
||||
var distance = calcDistance(pageX, pageY, mousePageX, mousePageY);
|
||||
var time = (new Date()).getTime();
|
||||
|
||||
|
||||
if (distance > DRAG_OFFSET) {
|
||||
state = STATE_SELECT;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
onStartSelect(cursor);
|
||||
} else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
}
|
||||
else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
|
|
@ -8676,10 +8787,11 @@ var MouseHandler = function(editor) {
|
|||
};
|
||||
|
||||
function onStartSelect(pos) {
|
||||
if (e.shiftKey)
|
||||
editor.selection.selectToPosition(pos)
|
||||
if (ev.getShiftKey()) {
|
||||
editor.selection.selectToPosition(pos);
|
||||
}
|
||||
else {
|
||||
if (!self.$clickSelection) {
|
||||
if (!_self.$clickSelection) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
|
|
@ -8688,17 +8800,20 @@ var MouseHandler = function(editor) {
|
|||
}
|
||||
|
||||
var onUpdateSelectionInterval = function() {
|
||||
var anchor;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
var anchor = self.$clickSelection.end;
|
||||
} else {
|
||||
var anchor = self.$clickSelection.start;
|
||||
if (_self.$clickSelection) {
|
||||
if (_self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(_self.$clickSelection);
|
||||
}
|
||||
else {
|
||||
if (_self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
anchor = _self.$clickSelection.end;
|
||||
}
|
||||
else {
|
||||
anchor = _self.$clickSelection.start;
|
||||
}
|
||||
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
|
||||
editor.selection.selectToPosition(cursor);
|
||||
|
|
@ -8721,48 +8836,57 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
|
||||
var timerId = setInterval(onSelectionInterval, 20);
|
||||
|
||||
return event.preventDefault(e);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
|
||||
this.onDoubleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var pos = this.$getEventPosition(e);
|
||||
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
editor.session.expandFold(fold);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor.moveCursorToPosition(pos);
|
||||
this.editor.selection.selectLine();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectLine();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor.selectAll();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onQuadClick = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.selectAll();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
|
||||
this.onScroll = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
|
||||
if (editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed))
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
}).call(DefaultHandlers.prototype);
|
||||
|
||||
exports.DefaultHandlers = DefaultHandlers;
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
function calcDistance(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
}
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
|
|
@ -8868,7 +8992,139 @@ var BrowserFocus = function(win) {
|
|||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
*/
|
||||
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
||||
this.domEvent = domEvent;
|
||||
this.editor = editor;
|
||||
|
||||
this.pageX = event.getDocumentX(domEvent);
|
||||
this.pageY = event.getDocumentY(domEvent);
|
||||
|
||||
this.$pos = null;
|
||||
this.$inSelection = null;
|
||||
|
||||
this.propagationStopped = false;
|
||||
this.defaultPrevented = false;
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.stopPropagation = function() {
|
||||
event.stopPropagation(this.domEvent);
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
|
||||
this.preventDefault = function() {
|
||||
event.preventDefault(this.domEvent);
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the document position below the mouse cursor
|
||||
*
|
||||
* @return {Object} 'row' and 'column' of the document position
|
||||
*/
|
||||
this.getDocumentPosition = function() {
|
||||
if (this.$pos)
|
||||
return this.$pos;
|
||||
|
||||
var pageX = event.getDocumentX(this.domEvent);
|
||||
var pageY = event.getDocumentY(this.domEvent);
|
||||
this.$pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
this.$pos.row = Math.max(0, Math.min(this.$pos.row, this.editor.session.getLength()-1));
|
||||
return this.$pos;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the mouse cursor is inside of the text selection
|
||||
*
|
||||
* @return {Boolean} whether the mouse cursor is inside of the selection
|
||||
*/
|
||||
this.inSelection = function() {
|
||||
if (this.$inSelection !== null)
|
||||
return this.$inSelection;
|
||||
|
||||
var editor = this.editor;
|
||||
|
||||
if (editor.getReadOnly()) {
|
||||
this.$inSelection = false;
|
||||
}
|
||||
else {
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
if (selectionRange.isEmpty())
|
||||
this.$inSelection = false;
|
||||
else {
|
||||
var pos = this.getDocumentPosition();
|
||||
this.$inSelection = selectionRange.contains(pos.row, pos.column);
|
||||
}
|
||||
}
|
||||
return this.$inSelection;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the clicked mouse button
|
||||
*
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
*/
|
||||
this.getButton = function() {
|
||||
return event.getButton(this.domEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Boolean} whether the shift key was pressed when the event was emitted
|
||||
*/
|
||||
this.getShiftKey = function() {
|
||||
return this.domEvent.shiftKey;
|
||||
};
|
||||
|
||||
}).call(MouseEvent.prototype);
|
||||
|
||||
});/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
|
@ -17238,7 +17494,10 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
|||
};
|
||||
|
||||
this.emit = function(event, data) {
|
||||
this.$worker.postMessage({event: event, data: data});
|
||||
try {
|
||||
this.$worker.postMessage({event: event, data: data});
|
||||
}
|
||||
catch(ex) {}
|
||||
};
|
||||
|
||||
}).call(WorkerClient.prototype);
|
||||
|
|
@ -26599,238 +26858,6 @@ define("text!build/demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text!build/textarea/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
" \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2, H3, H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2 {\n" +
|
||||
" font-size:28px;\n" +
|
||||
" color:#263842;\n" +
|
||||
" padding-bottom:6px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H3 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:22px;\n" +
|
||||
" color:#253741;\n" +
|
||||
" margin-top:43px;\n" +
|
||||
" margin-bottom:8px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:21px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" margin-bottom:4px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P {\n" +
|
||||
" padding:13px 0;\n" +
|
||||
" margin:0;\n" +
|
||||
" line-height:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL{\n" +
|
||||
" line-height : 22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"PRE{\n" +
|
||||
" background : #333;\n" +
|
||||
" color : white;\n" +
|
||||
" padding : 10px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header {\n" +
|
||||
" height : 227px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background: url(images/background.png) repeat-x 0 0;\n" +
|
||||
" border-bottom:1px solid #c9e8fa; \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .signature {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:11px;\n" +
|
||||
" color:#ebe4d6;\n" +
|
||||
" position:absolute;\n" +
|
||||
" bottom:5px;\n" +
|
||||
" right:42px;\n" +
|
||||
" letter-spacing : 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".content {\n" +
|
||||
" width:970px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin:0 auto;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content {\n" +
|
||||
" height:184px;\n" +
|
||||
" margin-top:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .logo {\n" +
|
||||
" width : 282px;\n" +
|
||||
" height : 184px;\n" +
|
||||
" background:url(images/logo.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:0;\n" +
|
||||
" left:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .title {\n" +
|
||||
" width : 605px;\n" +
|
||||
" height : 58px;\n" +
|
||||
" background:url(images/ace.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:98px;\n" +
|
||||
" left:329px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper {\n" +
|
||||
" background:url(images/body_background.png) repeat-x 0 0;\n" +
|
||||
" min-height:250px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content {\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" width:1000px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column1 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:315px;\n" +
|
||||
" margin-right:31px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column2 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:600px;\n" +
|
||||
" padding-top:47px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github {\n" +
|
||||
" width:310px;\n" +
|
||||
" height:80px;\n" +
|
||||
" background:url(images/fork_on_github.png) no-repeat 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin-top:49px;\n" +
|
||||
" cursor:pointer;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github:hover {\n" +
|
||||
" background-position:0 -80px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".divider {\n" +
|
||||
" height:3px;\n" +
|
||||
" background-color:#bedaea;\n" +
|
||||
" margin-bottom:3px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".menu {\n" +
|
||||
" padding:23px 0 0 24px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.content-list {\n" +
|
||||
" padding:15px;\n" +
|
||||
" margin:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:0 0 20px 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" line-height : 16px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" padding:7px 0;\n" +
|
||||
" border-bottom:1px dotted #d6e2e7;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI:last-child {\n" +
|
||||
" border-bottom:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P#first{\n" +
|
||||
" background : rgba(255,255,255,0.5);\n" +
|
||||
" padding : 20px;\n" +
|
||||
" font-size : 16px;\n" +
|
||||
" line-height : 24px;\n" +
|
||||
" margin : 0 0 20px 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#footer {\n" +
|
||||
" height:40px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background:url(images/bottombar.png) repeat-x 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" margin-top:40px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:8px 11px 0 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" float:right;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI {\n" +
|
||||
" color:white;\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:12px;\n" +
|
||||
" display:inline-block;\n" +
|
||||
" margin:0 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A {\n" +
|
||||
" color:#8dd0ff;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"");
|
||||
|
||||
define("text!build_support/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
|
|
@ -27113,50 +27140,6 @@ define("text!demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text!deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
||||
"\n" +
|
||||
"@import url(\"booya.css\") print,screen;\n" +
|
||||
"@import \"whatup.css\" screen;\n" +
|
||||
"@import \"wicked.css\";\n" +
|
||||
"\n" +
|
||||
"@namespace \"http://www.w3.org/1999/xhtml\";\n" +
|
||||
"@namespace svg \"http://www.w3.org/2000/svg\";\n" +
|
||||
"\n" +
|
||||
"li.inline #foo {\n" +
|
||||
" background: url(\"something.png\");\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px;\n" +
|
||||
" padding-right: 7px;\n" +
|
||||
" border-right: 1px dotted #066;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"li.last.first {\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px !important;\n" +
|
||||
" padding-right: 3px;\n" +
|
||||
" border-right: 0px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"@media print {\n" +
|
||||
" li.inline {\n" +
|
||||
" color: black;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"@charset \"UTF-8\"; \n" +
|
||||
"\n" +
|
||||
"@page {\n" +
|
||||
" margin: 10%;\n" +
|
||||
" counter-increment: page;\n" +
|
||||
"\n" +
|
||||
" @top-center {\n" +
|
||||
" font-family: sans-serif;\n" +
|
||||
" font-weight: bold;\n" +
|
||||
" font-size: 2em;\n" +
|
||||
" content: counter(page);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
|
||||
define("text!doc/site/iphone.css", [], "#wrapper {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
|
|
@ -27587,6 +27570,17 @@ define("text!lib/ace/css/editor.css", [], "@import url(//fonts.googleapis.com/cs
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/bar.css", [], "body * {\n" +
|
||||
" color: red !important;\n" +
|
||||
"}");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/demo.css", [], "");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/foo.css", [], "@import \"bar.css\" screen;\n" +
|
||||
"body {\n" +
|
||||
" background: black !important;\n" +
|
||||
"}");
|
||||
|
||||
define("text!node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }\n" +
|
||||
"body { max-width: 60em; }\n" +
|
||||
".title { text-align: center; }\n" +
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
Ace
|
||||
version 0.2.0
|
||||
commit a923766627ac0aa599be30d2fa15ce5bb4c9bc44
|
||||
commit 1e7efe70e11937142cc1801f763081b46bacced4
|
||||
|
||||
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -1300,9 +1300,9 @@ define('ace/ace', ['require', 'exports', 'module' , 'pilot/index', 'pilot/fixold
|
|||
|
||||
define('pilot/index', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/types/basic', 'pilot/types/command', 'pilot/types/settings', 'pilot/commands/settings', 'pilot/commands/basic', 'pilot/settings/canon', 'pilot/canon'], function(require, exports, module) {
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/fixoldbrowsers');
|
||||
require('pilot/fixoldbrowsers');
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/types/basic').startup(data, reason);
|
||||
require('pilot/types/command').startup(data, reason);
|
||||
require('pilot/types/settings').startup(data, reason);
|
||||
|
|
@ -3392,6 +3392,7 @@ exports.keyCodeToString = function(keyCode) {
|
|||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -3414,16 +3415,45 @@ var EventEmitter = {};
|
|||
EventEmitter._emit =
|
||||
EventEmitter._dispatchEvent = function(eventName, e) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners || !listeners.length) return;
|
||||
var listeners = this._eventRegistry[eventName] || [];
|
||||
var defaultHandler = this._defaultHandlers[eventName];
|
||||
if (!listeners.length && !defaultHandler)
|
||||
return;
|
||||
|
||||
var e = e || {};
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
}
|
||||
|
||||
if (!e.preventDefault) {
|
||||
e.preventDefault = function() {
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
}
|
||||
|
||||
for (var i=0; i<listeners.length; i++) {
|
||||
listeners[i](e);
|
||||
if (e.propagationStopped)
|
||||
break;
|
||||
}
|
||||
|
||||
if (defaultHandler && !e.defaultPrevented)
|
||||
defaultHandler(e);
|
||||
};
|
||||
|
||||
EventEmitter.setDefaultHandler = function(eventName, callback) {
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
if (this._defaultHandlers[eventName])
|
||||
throw new Error("The default handler for '" + eventName + "' is already set");
|
||||
|
||||
this._defaultHandlers[eventName] = callback;
|
||||
};
|
||||
|
||||
EventEmitter.on =
|
||||
|
|
@ -3431,12 +3461,11 @@ EventEmitter.addEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
}
|
||||
if (listeners.indexOf(callback) == -1) {
|
||||
if (!listeners)
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
|
||||
if (listeners.indexOf(callback) == -1)
|
||||
listeners.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeListener =
|
||||
|
|
@ -3444,18 +3473,17 @@ EventEmitter.removeEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
if (!listeners)
|
||||
return;
|
||||
|
||||
var index = listeners.indexOf(callback);
|
||||
if (index !== -1) {
|
||||
if (index !== -1)
|
||||
listeners.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeAllListeners = function(eventName) {
|
||||
if (this._eventRegistry) this._eventRegistry[eventName] = [];
|
||||
}
|
||||
};
|
||||
|
||||
exports.EventEmitter = EventEmitter;
|
||||
|
||||
|
|
@ -3730,9 +3758,8 @@ exports.deferredCall = function(fcn) {
|
|||
};
|
||||
|
||||
var deferred = function(timeout) {
|
||||
if (!timer) {
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
}
|
||||
deferred.cancel();
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
return deferred;
|
||||
}
|
||||
|
||||
|
|
@ -5628,7 +5655,6 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return callback(e, hashId, keyCode);
|
||||
}
|
||||
|
||||
|
|
@ -5661,7 +5687,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
addListener(el, "keypress", function(e) {
|
||||
var keyId = e.keyIdentifier || e.keyCode;
|
||||
if (lastDown !== keyId) {
|
||||
return normalizeCommandKeys(callback, e, e.keyCode);
|
||||
return normalizeCommandKeys(callback, e, lastDown);
|
||||
} else {
|
||||
lastDown = null;
|
||||
}
|
||||
|
|
@ -5711,7 +5737,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
|
||||
|
|
@ -5720,7 +5746,7 @@ var event = require("pilot/event");
|
|||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse_handler").MouseHandler;
|
||||
var MouseHandler = require("ace/mouse/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
|
|
@ -6950,7 +6976,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var text = dom.createElement("textarea");
|
||||
if (useragent.isTouchPad)
|
||||
text.setAttribute('x-palm-disable-auto-cap',true);
|
||||
text.setAttribute("x-palm-disable-auto-cap", true);
|
||||
|
||||
text.style.left = "-10000px";
|
||||
parentNode.appendChild(text);
|
||||
|
||||
|
|
@ -6966,7 +6993,7 @@ var TextInput = function(parentNode, host) {
|
|||
try {
|
||||
text.select();
|
||||
} catch (e) {}
|
||||
};
|
||||
}
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
|
|
@ -7062,10 +7089,10 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if ("onpropertychange" in text && !("oninput" in text))
|
||||
event.addListener(text, "propertychange", onPropertyChange);
|
||||
|
|
@ -7213,23 +7240,16 @@ exports.TextInput = TextInput;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
define('ace/mouse/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'ace/mouse/default_handlers', 'ace/mouse/mouse_event'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
var DefaultHandlers = require("ace/mouse/default_handlers").DefaultHandlers;
|
||||
var MouseEvent = require("ace/mouse/mouse_event").MouseEvent;
|
||||
|
||||
var MouseHandler = function(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
this.browserFocus = new BrowserFocus();
|
||||
this.defaultHandlers = new DefaultHandlers(editor);
|
||||
event.addListener(editor.container, "mousedown", function(e) {
|
||||
editor.focus();
|
||||
return event.preventDefault(e);
|
||||
|
|
@ -7240,6 +7260,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
var mouseTarget = editor.renderer.getMouseEventTarget();
|
||||
event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
|
||||
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
|
|
@ -7257,32 +7278,121 @@ var MouseHandler = function(editor) {
|
|||
return this.$scrollSpeed;
|
||||
};
|
||||
|
||||
this.$getEventPosition = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
var pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.editor.session.getLength()-1));
|
||||
return pos;
|
||||
};
|
||||
|
||||
this.$distance = function(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
};
|
||||
|
||||
this.onMouseDown = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor._dispatchEvent("mousedown", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
this.editor._dispatchEvent("mousemove", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
this.editor._dispatchEvent("dblclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
this.editor._dispatchEvent("tripleclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor._dispatchEvent("quadclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var mouseEvent = new MouseEvent(e, this.editor);
|
||||
mouseEvent.speed = this.$scrollSpeed * 2;
|
||||
mouseEvent.wheelX = e.wheelX;
|
||||
mouseEvent.wheelY = e.wheelY;
|
||||
|
||||
this.editor._dispatchEvent("mousewheel", mouseEvent);
|
||||
};
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/event_emitter', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
|
||||
function DefaultHandlers(editor) {
|
||||
this.editor = editor;
|
||||
this.$clickSelection = null;
|
||||
this.browserFocus = new BrowserFocus();
|
||||
|
||||
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(this));
|
||||
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(this));
|
||||
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(this));
|
||||
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(this));
|
||||
editor.setDefaultHandler("mousewheel", this.onScroll.bind(this));
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
this.onMouseDown = function(ev) {
|
||||
var inSelection = ev.inSelection();
|
||||
var pageX = ev.pageX;
|
||||
var pageY = ev.pageY;
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var self = this;
|
||||
var _self = this;
|
||||
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
var selectionEmpty = selectionRange.isEmpty();
|
||||
var inSelection = !editor.getReadOnly()
|
||||
&& !selectionEmpty
|
||||
&& selectionRange.contains(pos.row, pos.column);
|
||||
|
||||
var state = STATE_UNKNOWN;
|
||||
|
||||
// if this click caused the editor to be focused should not clear the
|
||||
|
|
@ -7291,14 +7401,14 @@ var MouseHandler = function(editor) {
|
|||
inSelection && (
|
||||
!this.browserFocus.isFocused()
|
||||
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|
||||
|| !this.editor.isFocused()
|
||||
|| !editor.isFocused()
|
||||
)
|
||||
) {
|
||||
this.editor.focus();
|
||||
editor.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var button = event.getButton(e);
|
||||
var button = ev.getButton();
|
||||
if (button !== 0) {
|
||||
if (selectionEmpty) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
|
|
@ -7308,7 +7418,8 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Select the fold as the user clicks it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
|
|
@ -7340,7 +7451,7 @@ var MouseHandler = function(editor) {
|
|||
else if (state == STATE_DRAG)
|
||||
onMouseDragSelectionEnd();
|
||||
|
||||
self.$clickSelection = null;
|
||||
_self.$clickSelection = null;
|
||||
state = STATE_UNKNOWN;
|
||||
};
|
||||
|
||||
|
|
@ -7348,7 +7459,7 @@ var MouseHandler = function(editor) {
|
|||
dom.removeCssClass(editor.container, "ace_dragging");
|
||||
editor.session.removeMarker(dragSelectionMarker);
|
||||
|
||||
if (!self.$clickSelection) {
|
||||
if (!editor.$mouseHandler.$clickSelection) {
|
||||
if (!dragCursor) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
|
|
@ -7378,16 +7489,16 @@ var MouseHandler = function(editor) {
|
|||
return;
|
||||
|
||||
if (state == STATE_UNKNOWN) {
|
||||
var distance = self.$distance(pageX, pageY, mousePageX, mousePageY);
|
||||
var distance = calcDistance(pageX, pageY, mousePageX, mousePageY);
|
||||
var time = (new Date()).getTime();
|
||||
|
||||
|
||||
if (distance > DRAG_OFFSET) {
|
||||
state = STATE_SELECT;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
onStartSelect(cursor);
|
||||
} else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
}
|
||||
else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
|
|
@ -7405,10 +7516,11 @@ var MouseHandler = function(editor) {
|
|||
};
|
||||
|
||||
function onStartSelect(pos) {
|
||||
if (e.shiftKey)
|
||||
editor.selection.selectToPosition(pos)
|
||||
if (ev.getShiftKey()) {
|
||||
editor.selection.selectToPosition(pos);
|
||||
}
|
||||
else {
|
||||
if (!self.$clickSelection) {
|
||||
if (!_self.$clickSelection) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
|
|
@ -7417,17 +7529,20 @@ var MouseHandler = function(editor) {
|
|||
}
|
||||
|
||||
var onUpdateSelectionInterval = function() {
|
||||
var anchor;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
var anchor = self.$clickSelection.end;
|
||||
} else {
|
||||
var anchor = self.$clickSelection.start;
|
||||
if (_self.$clickSelection) {
|
||||
if (_self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(_self.$clickSelection);
|
||||
}
|
||||
else {
|
||||
if (_self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
anchor = _self.$clickSelection.end;
|
||||
}
|
||||
else {
|
||||
anchor = _self.$clickSelection.start;
|
||||
}
|
||||
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
|
||||
editor.selection.selectToPosition(cursor);
|
||||
|
|
@ -7450,48 +7565,57 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
|
||||
var timerId = setInterval(onSelectionInterval, 20);
|
||||
|
||||
return event.preventDefault(e);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
|
||||
this.onDoubleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var pos = this.$getEventPosition(e);
|
||||
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
editor.session.expandFold(fold);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor.moveCursorToPosition(pos);
|
||||
this.editor.selection.selectLine();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectLine();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor.selectAll();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onQuadClick = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.selectAll();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
|
||||
this.onScroll = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
|
||||
if (editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed))
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
}).call(DefaultHandlers.prototype);
|
||||
|
||||
exports.DefaultHandlers = DefaultHandlers;
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
function calcDistance(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
}
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
|
|
@ -7597,7 +7721,139 @@ var BrowserFocus = function(win) {
|
|||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
*/
|
||||
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
||||
this.domEvent = domEvent;
|
||||
this.editor = editor;
|
||||
|
||||
this.pageX = event.getDocumentX(domEvent);
|
||||
this.pageY = event.getDocumentY(domEvent);
|
||||
|
||||
this.$pos = null;
|
||||
this.$inSelection = null;
|
||||
|
||||
this.propagationStopped = false;
|
||||
this.defaultPrevented = false;
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.stopPropagation = function() {
|
||||
event.stopPropagation(this.domEvent);
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
|
||||
this.preventDefault = function() {
|
||||
event.preventDefault(this.domEvent);
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the document position below the mouse cursor
|
||||
*
|
||||
* @return {Object} 'row' and 'column' of the document position
|
||||
*/
|
||||
this.getDocumentPosition = function() {
|
||||
if (this.$pos)
|
||||
return this.$pos;
|
||||
|
||||
var pageX = event.getDocumentX(this.domEvent);
|
||||
var pageY = event.getDocumentY(this.domEvent);
|
||||
this.$pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
this.$pos.row = Math.max(0, Math.min(this.$pos.row, this.editor.session.getLength()-1));
|
||||
return this.$pos;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the mouse cursor is inside of the text selection
|
||||
*
|
||||
* @return {Boolean} whether the mouse cursor is inside of the selection
|
||||
*/
|
||||
this.inSelection = function() {
|
||||
if (this.$inSelection !== null)
|
||||
return this.$inSelection;
|
||||
|
||||
var editor = this.editor;
|
||||
|
||||
if (editor.getReadOnly()) {
|
||||
this.$inSelection = false;
|
||||
}
|
||||
else {
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
if (selectionRange.isEmpty())
|
||||
this.$inSelection = false;
|
||||
else {
|
||||
var pos = this.getDocumentPosition();
|
||||
this.$inSelection = selectionRange.contains(pos.row, pos.column);
|
||||
}
|
||||
}
|
||||
return this.$inSelection;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the clicked mouse button
|
||||
*
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
*/
|
||||
this.getButton = function() {
|
||||
return event.getButton(this.domEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Boolean} whether the shift key was pressed when the event was emitted
|
||||
*/
|
||||
this.getShiftKey = function() {
|
||||
return this.domEvent.shiftKey;
|
||||
};
|
||||
|
||||
}).call(MouseEvent.prototype);
|
||||
|
||||
});/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
|
@ -15911,238 +16167,6 @@ define("text!build/demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text!build/textarea/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
" \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2, H3, H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2 {\n" +
|
||||
" font-size:28px;\n" +
|
||||
" color:#263842;\n" +
|
||||
" padding-bottom:6px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H3 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:22px;\n" +
|
||||
" color:#253741;\n" +
|
||||
" margin-top:43px;\n" +
|
||||
" margin-bottom:8px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:21px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" margin-bottom:4px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P {\n" +
|
||||
" padding:13px 0;\n" +
|
||||
" margin:0;\n" +
|
||||
" line-height:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL{\n" +
|
||||
" line-height : 22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"PRE{\n" +
|
||||
" background : #333;\n" +
|
||||
" color : white;\n" +
|
||||
" padding : 10px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header {\n" +
|
||||
" height : 227px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background: url(images/background.png) repeat-x 0 0;\n" +
|
||||
" border-bottom:1px solid #c9e8fa; \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .signature {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:11px;\n" +
|
||||
" color:#ebe4d6;\n" +
|
||||
" position:absolute;\n" +
|
||||
" bottom:5px;\n" +
|
||||
" right:42px;\n" +
|
||||
" letter-spacing : 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".content {\n" +
|
||||
" width:970px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin:0 auto;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content {\n" +
|
||||
" height:184px;\n" +
|
||||
" margin-top:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .logo {\n" +
|
||||
" width : 282px;\n" +
|
||||
" height : 184px;\n" +
|
||||
" background:url(images/logo.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:0;\n" +
|
||||
" left:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .title {\n" +
|
||||
" width : 605px;\n" +
|
||||
" height : 58px;\n" +
|
||||
" background:url(images/ace.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:98px;\n" +
|
||||
" left:329px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper {\n" +
|
||||
" background:url(images/body_background.png) repeat-x 0 0;\n" +
|
||||
" min-height:250px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content {\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" width:1000px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column1 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:315px;\n" +
|
||||
" margin-right:31px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column2 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:600px;\n" +
|
||||
" padding-top:47px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github {\n" +
|
||||
" width:310px;\n" +
|
||||
" height:80px;\n" +
|
||||
" background:url(images/fork_on_github.png) no-repeat 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin-top:49px;\n" +
|
||||
" cursor:pointer;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github:hover {\n" +
|
||||
" background-position:0 -80px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".divider {\n" +
|
||||
" height:3px;\n" +
|
||||
" background-color:#bedaea;\n" +
|
||||
" margin-bottom:3px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".menu {\n" +
|
||||
" padding:23px 0 0 24px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.content-list {\n" +
|
||||
" padding:15px;\n" +
|
||||
" margin:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:0 0 20px 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" line-height : 16px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" padding:7px 0;\n" +
|
||||
" border-bottom:1px dotted #d6e2e7;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI:last-child {\n" +
|
||||
" border-bottom:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P#first{\n" +
|
||||
" background : rgba(255,255,255,0.5);\n" +
|
||||
" padding : 20px;\n" +
|
||||
" font-size : 16px;\n" +
|
||||
" line-height : 24px;\n" +
|
||||
" margin : 0 0 20px 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#footer {\n" +
|
||||
" height:40px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background:url(images/bottombar.png) repeat-x 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" margin-top:40px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:8px 11px 0 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" float:right;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI {\n" +
|
||||
" color:white;\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:12px;\n" +
|
||||
" display:inline-block;\n" +
|
||||
" margin:0 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A {\n" +
|
||||
" color:#8dd0ff;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"");
|
||||
|
||||
define("text!build_support/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
|
|
@ -16425,50 +16449,6 @@ define("text!demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text!deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
||||
"\n" +
|
||||
"@import url(\"booya.css\") print,screen;\n" +
|
||||
"@import \"whatup.css\" screen;\n" +
|
||||
"@import \"wicked.css\";\n" +
|
||||
"\n" +
|
||||
"@namespace \"http://www.w3.org/1999/xhtml\";\n" +
|
||||
"@namespace svg \"http://www.w3.org/2000/svg\";\n" +
|
||||
"\n" +
|
||||
"li.inline #foo {\n" +
|
||||
" background: url(\"something.png\");\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px;\n" +
|
||||
" padding-right: 7px;\n" +
|
||||
" border-right: 1px dotted #066;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"li.last.first {\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px !important;\n" +
|
||||
" padding-right: 3px;\n" +
|
||||
" border-right: 0px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"@media print {\n" +
|
||||
" li.inline {\n" +
|
||||
" color: black;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"@charset \"UTF-8\"; \n" +
|
||||
"\n" +
|
||||
"@page {\n" +
|
||||
" margin: 10%;\n" +
|
||||
" counter-increment: page;\n" +
|
||||
"\n" +
|
||||
" @top-center {\n" +
|
||||
" font-family: sans-serif;\n" +
|
||||
" font-weight: bold;\n" +
|
||||
" font-size: 2em;\n" +
|
||||
" content: counter(page);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
|
||||
define("text!doc/site/iphone.css", [], "#wrapper {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
|
|
@ -16899,6 +16879,17 @@ define("text!lib/ace/css/editor.css", [], "@import url(//fonts.googleapis.com/cs
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/bar.css", [], "body * {\n" +
|
||||
" color: red !important;\n" +
|
||||
"}");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/demo.css", [], "");
|
||||
|
||||
define("text!node_modules/jsdom/node_modules/cssom/docs/foo.css", [], "@import \"bar.css\" screen;\n" +
|
||||
"body {\n" +
|
||||
" background: black !important;\n" +
|
||||
"}");
|
||||
|
||||
define("text!node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }\n" +
|
||||
"body { max-width: 60em; }\n" +
|
||||
".title { text-align: center; }\n" +
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1292,9 +1292,9 @@ __ace_shadowed__.define('ace/ace', ['require', 'exports', 'module' , 'pilot/inde
|
|||
|
||||
__ace_shadowed__.define('pilot/index', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/types/basic', 'pilot/types/command', 'pilot/types/settings', 'pilot/commands/settings', 'pilot/commands/basic', 'pilot/settings/canon', 'pilot/canon'], function(require, exports, module) {
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/fixoldbrowsers');
|
||||
require('pilot/fixoldbrowsers');
|
||||
|
||||
exports.startup = function(data, reason) {
|
||||
require('pilot/types/basic').startup(data, reason);
|
||||
require('pilot/types/command').startup(data, reason);
|
||||
require('pilot/types/settings').startup(data, reason);
|
||||
|
|
@ -3384,6 +3384,7 @@ exports.keyCodeToString = function(keyCode) {
|
|||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -3406,16 +3407,45 @@ var EventEmitter = {};
|
|||
EventEmitter._emit =
|
||||
EventEmitter._dispatchEvent = function(eventName, e) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners || !listeners.length) return;
|
||||
var listeners = this._eventRegistry[eventName] || [];
|
||||
var defaultHandler = this._defaultHandlers[eventName];
|
||||
if (!listeners.length && !defaultHandler)
|
||||
return;
|
||||
|
||||
var e = e || {};
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
}
|
||||
|
||||
if (!e.preventDefault) {
|
||||
e.preventDefault = function() {
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
}
|
||||
|
||||
for (var i=0; i<listeners.length; i++) {
|
||||
listeners[i](e);
|
||||
if (e.propagationStopped)
|
||||
break;
|
||||
}
|
||||
|
||||
if (defaultHandler && !e.defaultPrevented)
|
||||
defaultHandler(e);
|
||||
};
|
||||
|
||||
EventEmitter.setDefaultHandler = function(eventName, callback) {
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
if (this._defaultHandlers[eventName])
|
||||
throw new Error("The default handler for '" + eventName + "' is already set");
|
||||
|
||||
this._defaultHandlers[eventName] = callback;
|
||||
};
|
||||
|
||||
EventEmitter.on =
|
||||
|
|
@ -3423,12 +3453,11 @@ EventEmitter.addEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
}
|
||||
if (listeners.indexOf(callback) == -1) {
|
||||
if (!listeners)
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
|
||||
if (listeners.indexOf(callback) == -1)
|
||||
listeners.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeListener =
|
||||
|
|
@ -3436,18 +3465,17 @@ EventEmitter.removeEventListener = function(eventName, callback) {
|
|||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
if (!listeners)
|
||||
return;
|
||||
|
||||
var index = listeners.indexOf(callback);
|
||||
if (index !== -1) {
|
||||
if (index !== -1)
|
||||
listeners.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.removeAllListeners = function(eventName) {
|
||||
if (this._eventRegistry) this._eventRegistry[eventName] = [];
|
||||
}
|
||||
};
|
||||
|
||||
exports.EventEmitter = EventEmitter;
|
||||
|
||||
|
|
@ -3722,9 +3750,8 @@ exports.deferredCall = function(fcn) {
|
|||
};
|
||||
|
||||
var deferred = function(timeout) {
|
||||
if (!timer) {
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
}
|
||||
deferred.cancel();
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
return deferred;
|
||||
}
|
||||
|
||||
|
|
@ -5620,7 +5647,6 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return callback(e, hashId, keyCode);
|
||||
}
|
||||
|
||||
|
|
@ -5653,7 +5679,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
addListener(el, "keypress", function(e) {
|
||||
var keyId = e.keyIdentifier || e.keyCode;
|
||||
if (lastDown !== keyId) {
|
||||
return normalizeCommandKeys(callback, e, e.keyCode);
|
||||
return normalizeCommandKeys(callback, e, lastDown);
|
||||
} else {
|
||||
lastDown = null;
|
||||
}
|
||||
|
|
@ -5703,7 +5729,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
|
||||
|
|
@ -5712,7 +5738,7 @@ var event = require("pilot/event");
|
|||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse_handler").MouseHandler;
|
||||
var MouseHandler = require("ace/mouse/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
|
|
@ -5965,6 +5991,8 @@ var Editor =function(renderer, session) {
|
|||
lastRow = Infinity;
|
||||
this.renderer.updateLines(range.start.row, lastRow);
|
||||
|
||||
this._dispatchEvent("change", e);
|
||||
|
||||
// update cursor because tab characters can influence the cursor position
|
||||
this.renderer.updateCursor();
|
||||
};
|
||||
|
|
@ -6940,7 +6968,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var text = dom.createElement("textarea");
|
||||
if (useragent.isTouchPad)
|
||||
text.setAttribute('x-palm-disable-auto-cap',true);
|
||||
text.setAttribute("x-palm-disable-auto-cap", true);
|
||||
|
||||
text.style.left = "-10000px";
|
||||
parentNode.appendChild(text);
|
||||
|
||||
|
|
@ -6956,7 +6985,7 @@ var TextInput = function(parentNode, host) {
|
|||
try {
|
||||
text.select();
|
||||
} catch (e) {}
|
||||
};
|
||||
}
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
|
|
@ -7052,10 +7081,10 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if ("onpropertychange" in text && !("oninput" in text))
|
||||
event.addListener(text, "propertychange", onPropertyChange);
|
||||
|
|
@ -7203,23 +7232,16 @@ exports.TextInput = TextInput;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/mouse/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'ace/mouse/default_handlers', 'ace/mouse/mouse_event'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
var DefaultHandlers = require("ace/mouse/default_handlers").DefaultHandlers;
|
||||
var MouseEvent = require("ace/mouse/mouse_event").MouseEvent;
|
||||
|
||||
var MouseHandler = function(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
this.browserFocus = new BrowserFocus();
|
||||
this.defaultHandlers = new DefaultHandlers(editor);
|
||||
event.addListener(editor.container, "mousedown", function(e) {
|
||||
editor.focus();
|
||||
return event.preventDefault(e);
|
||||
|
|
@ -7230,6 +7252,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
var mouseTarget = editor.renderer.getMouseEventTarget();
|
||||
event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
|
||||
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
|
|
@ -7247,32 +7270,121 @@ var MouseHandler = function(editor) {
|
|||
return this.$scrollSpeed;
|
||||
};
|
||||
|
||||
this.$getEventPosition = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
var pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.editor.session.getLength()-1));
|
||||
return pos;
|
||||
};
|
||||
|
||||
this.$distance = function(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
};
|
||||
|
||||
this.onMouseDown = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor._dispatchEvent("mousedown", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
this.editor._dispatchEvent("mousemove", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
this.editor._dispatchEvent("dblclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
this.editor._dispatchEvent("tripleclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor._dispatchEvent("quadclick", new MouseEvent(e, this.editor));
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var mouseEvent = new MouseEvent(e, this.editor);
|
||||
mouseEvent.speed = this.$scrollSpeed * 2;
|
||||
mouseEvent.wheelX = e.wheelX;
|
||||
mouseEvent.wheelY = e.wheelY;
|
||||
|
||||
this.editor._dispatchEvent("mousewheel", mouseEvent);
|
||||
};
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/event_emitter', 'pilot/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
var STATE_SELECT = 1;
|
||||
var STATE_DRAG = 2;
|
||||
|
||||
var DRAG_TIMER = 250; // milliseconds
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
|
||||
function DefaultHandlers(editor) {
|
||||
this.editor = editor;
|
||||
this.$clickSelection = null;
|
||||
this.browserFocus = new BrowserFocus();
|
||||
|
||||
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(this));
|
||||
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(this));
|
||||
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(this));
|
||||
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(this));
|
||||
editor.setDefaultHandler("mousewheel", this.onScroll.bind(this));
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
this.onMouseDown = function(ev) {
|
||||
var inSelection = ev.inSelection();
|
||||
var pageX = ev.pageX;
|
||||
var pageY = ev.pageY;
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var self = this;
|
||||
var _self = this;
|
||||
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
var selectionEmpty = selectionRange.isEmpty();
|
||||
var inSelection = !editor.getReadOnly()
|
||||
&& !selectionEmpty
|
||||
&& selectionRange.contains(pos.row, pos.column);
|
||||
|
||||
var state = STATE_UNKNOWN;
|
||||
|
||||
// if this click caused the editor to be focused should not clear the
|
||||
|
|
@ -7281,14 +7393,14 @@ var MouseHandler = function(editor) {
|
|||
inSelection && (
|
||||
!this.browserFocus.isFocused()
|
||||
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|
||||
|| !this.editor.isFocused()
|
||||
|| !editor.isFocused()
|
||||
)
|
||||
) {
|
||||
this.editor.focus();
|
||||
editor.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var button = event.getButton(e);
|
||||
var button = ev.getButton();
|
||||
if (button !== 0) {
|
||||
if (selectionEmpty) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
|
|
@ -7298,7 +7410,8 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Select the fold as the user clicks it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
|
|
@ -7330,7 +7443,7 @@ var MouseHandler = function(editor) {
|
|||
else if (state == STATE_DRAG)
|
||||
onMouseDragSelectionEnd();
|
||||
|
||||
self.$clickSelection = null;
|
||||
_self.$clickSelection = null;
|
||||
state = STATE_UNKNOWN;
|
||||
};
|
||||
|
||||
|
|
@ -7338,7 +7451,7 @@ var MouseHandler = function(editor) {
|
|||
dom.removeCssClass(editor.container, "ace_dragging");
|
||||
editor.session.removeMarker(dragSelectionMarker);
|
||||
|
||||
if (!self.$clickSelection) {
|
||||
if (!editor.$mouseHandler.$clickSelection) {
|
||||
if (!dragCursor) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
|
|
@ -7368,16 +7481,16 @@ var MouseHandler = function(editor) {
|
|||
return;
|
||||
|
||||
if (state == STATE_UNKNOWN) {
|
||||
var distance = self.$distance(pageX, pageY, mousePageX, mousePageY);
|
||||
var distance = calcDistance(pageX, pageY, mousePageX, mousePageY);
|
||||
var time = (new Date()).getTime();
|
||||
|
||||
|
||||
if (distance > DRAG_OFFSET) {
|
||||
state = STATE_SELECT;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
onStartSelect(cursor);
|
||||
} else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
}
|
||||
else if ((time - mousedownTime) > DRAG_TIMER) {
|
||||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
|
|
@ -7395,10 +7508,11 @@ var MouseHandler = function(editor) {
|
|||
};
|
||||
|
||||
function onStartSelect(pos) {
|
||||
if (e.shiftKey)
|
||||
editor.selection.selectToPosition(pos)
|
||||
if (ev.getShiftKey()) {
|
||||
editor.selection.selectToPosition(pos);
|
||||
}
|
||||
else {
|
||||
if (!self.$clickSelection) {
|
||||
if (!_self.$clickSelection) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
|
|
@ -7407,17 +7521,20 @@ var MouseHandler = function(editor) {
|
|||
}
|
||||
|
||||
var onUpdateSelectionInterval = function() {
|
||||
var anchor;
|
||||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
var anchor = self.$clickSelection.end;
|
||||
} else {
|
||||
var anchor = self.$clickSelection.start;
|
||||
if (_self.$clickSelection) {
|
||||
if (_self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(_self.$clickSelection);
|
||||
}
|
||||
else {
|
||||
if (_self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
anchor = _self.$clickSelection.end;
|
||||
}
|
||||
else {
|
||||
anchor = _self.$clickSelection.start;
|
||||
}
|
||||
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
|
||||
editor.selection.selectToPosition(cursor);
|
||||
|
|
@ -7440,48 +7557,57 @@ var MouseHandler = function(editor) {
|
|||
event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
|
||||
var timerId = setInterval(onSelectionInterval, 20);
|
||||
|
||||
return event.preventDefault(e);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
|
||||
this.onDoubleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
var pos = this.$getEventPosition(e);
|
||||
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
editor.session.expandFold(fold);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
var pos = this.$getEventPosition(e);
|
||||
this.editor.moveCursorToPosition(pos);
|
||||
this.editor.selection.selectLine();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectLine();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseQuadClick = function(e) {
|
||||
this.editor.selectAll();
|
||||
this.$clickSelection = this.editor.getSelectionRange();
|
||||
|
||||
this.onQuadClick = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.selectAll();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
|
||||
this.onScroll = function(ev) {
|
||||
var editor = this.editor;
|
||||
|
||||
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
|
||||
if (editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed))
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
}).call(DefaultHandlers.prototype);
|
||||
|
||||
exports.DefaultHandlers = DefaultHandlers;
|
||||
|
||||
}).call(MouseHandler.prototype);
|
||||
function calcDistance(ax, ay, bx, by) {
|
||||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
}
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
|
|
@ -7587,7 +7713,139 @@ var BrowserFocus = function(win) {
|
|||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom'], function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var dom = require("pilot/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
*/
|
||||
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
||||
this.domEvent = domEvent;
|
||||
this.editor = editor;
|
||||
|
||||
this.pageX = event.getDocumentX(domEvent);
|
||||
this.pageY = event.getDocumentY(domEvent);
|
||||
|
||||
this.$pos = null;
|
||||
this.$inSelection = null;
|
||||
|
||||
this.propagationStopped = false;
|
||||
this.defaultPrevented = false;
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.stopPropagation = function() {
|
||||
event.stopPropagation(this.domEvent);
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
|
||||
this.preventDefault = function() {
|
||||
event.preventDefault(this.domEvent);
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the document position below the mouse cursor
|
||||
*
|
||||
* @return {Object} 'row' and 'column' of the document position
|
||||
*/
|
||||
this.getDocumentPosition = function() {
|
||||
if (this.$pos)
|
||||
return this.$pos;
|
||||
|
||||
var pageX = event.getDocumentX(this.domEvent);
|
||||
var pageY = event.getDocumentY(this.domEvent);
|
||||
this.$pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
this.$pos.row = Math.max(0, Math.min(this.$pos.row, this.editor.session.getLength()-1));
|
||||
return this.$pos;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the mouse cursor is inside of the text selection
|
||||
*
|
||||
* @return {Boolean} whether the mouse cursor is inside of the selection
|
||||
*/
|
||||
this.inSelection = function() {
|
||||
if (this.$inSelection !== null)
|
||||
return this.$inSelection;
|
||||
|
||||
var editor = this.editor;
|
||||
|
||||
if (editor.getReadOnly()) {
|
||||
this.$inSelection = false;
|
||||
}
|
||||
else {
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
if (selectionRange.isEmpty())
|
||||
this.$inSelection = false;
|
||||
else {
|
||||
var pos = this.getDocumentPosition();
|
||||
this.$inSelection = selectionRange.contains(pos.row, pos.column);
|
||||
}
|
||||
}
|
||||
return this.$inSelection;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the clicked mouse button
|
||||
*
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
*/
|
||||
this.getButton = function() {
|
||||
return event.getButton(this.domEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Boolean} whether the shift key was pressed when the event was emitted
|
||||
*/
|
||||
this.getShiftKey = function() {
|
||||
return this.domEvent.shiftKey;
|
||||
};
|
||||
|
||||
}).call(MouseEvent.prototype);
|
||||
|
||||
});/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
|
@ -16415,50 +16673,6 @@ __ace_shadowed__.define("text!demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
__ace_shadowed__.define("text!deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
||||
"\n" +
|
||||
"@import url(\"booya.css\") print,screen;\n" +
|
||||
"@import \"whatup.css\" screen;\n" +
|
||||
"@import \"wicked.css\";\n" +
|
||||
"\n" +
|
||||
"@namespace \"http://www.w3.org/1999/xhtml\";\n" +
|
||||
"@namespace svg \"http://www.w3.org/2000/svg\";\n" +
|
||||
"\n" +
|
||||
"li.inline #foo {\n" +
|
||||
" background: url(\"something.png\");\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px;\n" +
|
||||
" padding-right: 7px;\n" +
|
||||
" border-right: 1px dotted #066;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"li.last.first {\n" +
|
||||
" display: inline;\n" +
|
||||
" padding-left: 3px !important;\n" +
|
||||
" padding-right: 3px;\n" +
|
||||
" border-right: 0px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"@media print {\n" +
|
||||
" li.inline {\n" +
|
||||
" color: black;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"@charset \"UTF-8\"; \n" +
|
||||
"\n" +
|
||||
"@page {\n" +
|
||||
" margin: 10%;\n" +
|
||||
" counter-increment: page;\n" +
|
||||
"\n" +
|
||||
" @top-center {\n" +
|
||||
" font-family: sans-serif;\n" +
|
||||
" font-weight: bold;\n" +
|
||||
" font-size: 2em;\n" +
|
||||
" content: counter(page);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
|
||||
__ace_shadowed__.define("text!doc/site/iphone.css", [], "#wrapper {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
|
|
@ -16889,6 +17103,17 @@ __ace_shadowed__.define("text!lib/ace/css/editor.css", [], "@import url(//fonts.
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
__ace_shadowed__.define("text!node_modules/jsdom/node_modules/cssom/docs/bar.css", [], "body * {\n" +
|
||||
" color: red !important;\n" +
|
||||
"}");
|
||||
|
||||
__ace_shadowed__.define("text!node_modules/jsdom/node_modules/cssom/docs/demo.css", [], "");
|
||||
|
||||
__ace_shadowed__.define("text!node_modules/jsdom/node_modules/cssom/docs/foo.css", [], "@import \"bar.css\" screen;\n" +
|
||||
"body {\n" +
|
||||
" background: black !important;\n" +
|
||||
"}");
|
||||
|
||||
__ace_shadowed__.define("text!node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }\n" +
|
||||
"body { max-width: 60em; }\n" +
|
||||
".title { text-align: center; }\n" +
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue