package
This commit is contained in:
parent
78d2e48ab2
commit
214aa85037
7 changed files with 485 additions and 311 deletions
|
|
@ -7846,8 +7846,8 @@ function Folding() {
|
|||
this.getRowFoldEnd = function(docRow, startFoldRow) {
|
||||
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
||||
return (foldLine
|
||||
? foldLine.end.row
|
||||
: docRow)
|
||||
? foldLine.end.row
|
||||
: docRow);
|
||||
};
|
||||
|
||||
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||
|
|
@ -7865,7 +7865,7 @@ function Folding() {
|
|||
var doc = this.doc;
|
||||
var textLine = "";
|
||||
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn) {
|
||||
if (row < startRow) {
|
||||
return;
|
||||
} else if (row == startRow) {
|
||||
|
|
@ -7911,31 +7911,36 @@ function Folding() {
|
|||
this.toggleFold = function(tryToUnfold) {
|
||||
var selection = this.selection;
|
||||
var range = selection.getRange();
|
||||
var fold;
|
||||
var bracketPos;
|
||||
|
||||
if (range.isEmpty()) {
|
||||
var cursor = range.start;
|
||||
var fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
var bracketPos;
|
||||
fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
|
||||
if (fold) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
} else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
if (range.comparePoint(bracketPos) == 1) {
|
||||
range.end = bracketPos;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range.start = bracketPos;
|
||||
range.start.column++;
|
||||
range.end.column--;
|
||||
}
|
||||
} else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
if (range.comparePoint(bracketPos) == 1)
|
||||
range.end = bracketPos;
|
||||
else
|
||||
range.start = bracketPos;
|
||||
|
||||
range.start.column++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -7943,7 +7948,8 @@ function Folding() {
|
|||
if (tryToUnfold && folds.length) {
|
||||
this.expandFolds(folds);
|
||||
return;
|
||||
} else if (folds.length == 1 ) {
|
||||
}
|
||||
else if (folds.length == 1 ) {
|
||||
fold = folds[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -7951,7 +7957,7 @@ function Folding() {
|
|||
if (!fold)
|
||||
fold = this.getFoldAt(range.start.row, range.start.column);
|
||||
|
||||
if (fold && fold.range.toString() == range.toString()){
|
||||
if (fold && fold.range.toString() == range.toString()) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
}
|
||||
|
|
@ -8028,6 +8034,9 @@ function Folding() {
|
|||
|
||||
this.$foldStyle = style;
|
||||
|
||||
if (style == "manual")
|
||||
this.unfold();
|
||||
|
||||
// reset folding
|
||||
var mode = this.$foldMode;
|
||||
this.$setFolding(null);
|
||||
|
|
@ -20170,7 +20179,7 @@ exports.Split = Split;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
|
|
@ -20179,6 +20188,7 @@ var lang = require("./lib/lang");
|
|||
var useragent = require("./lib/useragent");
|
||||
var TextInput = require("./keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
||||
var FoldHandler = require("./mouse/fold_handler").FoldHandler;
|
||||
//var TouchHandler = require("./touch_handler").TouchHandler;
|
||||
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
|
|
@ -20201,6 +20211,7 @@ var Editor = function(renderer, session) {
|
|||
//this.$mouseHandler = new TouchHandler(this);
|
||||
} else {
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
new FoldHandler(this);
|
||||
}
|
||||
|
||||
this.$blockScrolling = 0;
|
||||
|
|
@ -21703,7 +21714,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
|
|
@ -21774,11 +21785,10 @@ exports.MouseHandler = MouseHandler;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/event_emitter', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
|
|
@ -21854,7 +21864,6 @@ function DefaultHandlers(editor) {
|
|||
}
|
||||
|
||||
var mousePageX = pageX, mousePageY = pageY;
|
||||
var overwrite = editor.getOverwrite();
|
||||
var mousedownTime = (new Date()).getTime();
|
||||
var dragCursor, dragRange;
|
||||
|
||||
|
|
@ -21923,7 +21932,7 @@ function DefaultHandlers(editor) {
|
|||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
dragSelectionMarker = editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.clearSelection();
|
||||
dom.addCssClass(editor.container, "ace_dragging");
|
||||
}
|
||||
|
|
@ -21993,19 +22002,9 @@ function DefaultHandlers(editor) {
|
|||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
|
|
@ -22183,10 +22182,9 @@ exports.BrowserFocus = BrowserFocus;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom'], function(require, exports, module) {
|
||||
define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
|
|
@ -22285,7 +22283,67 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
}).call(MouseEvent.prototype);
|
||||
|
||||
});
|
||||
/* ***** 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>
|
||||
* 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/fold_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||
|
||||
function FoldHandler(editor) {
|
||||
editor.on("click", function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.FoldHandler = FoldHandler;
|
||||
|
||||
});/* ***** 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
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
Ace
|
||||
version 0.2.0
|
||||
commit 3b01eb9bac02db8c171a9b2ae64b40d75de5c8e5
|
||||
commit 78d2e48ab257e3567234cb554857fafb25b7860c
|
||||
|
||||
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -2398,7 +2398,7 @@ exports.getOS = function() {
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
|
|
@ -2407,6 +2407,7 @@ var lang = require("./lib/lang");
|
|||
var useragent = require("./lib/useragent");
|
||||
var TextInput = require("./keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
||||
var FoldHandler = require("./mouse/fold_handler").FoldHandler;
|
||||
//var TouchHandler = require("./touch_handler").TouchHandler;
|
||||
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
|
|
@ -2429,6 +2430,7 @@ var Editor = function(renderer, session) {
|
|||
//this.$mouseHandler = new TouchHandler(this);
|
||||
} else {
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
new FoldHandler(this);
|
||||
}
|
||||
|
||||
this.$blockScrolling = 0;
|
||||
|
|
@ -4080,7 +4082,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
|
|
@ -4151,11 +4153,10 @@ exports.MouseHandler = MouseHandler;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/event_emitter', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
|
|
@ -4231,7 +4232,6 @@ function DefaultHandlers(editor) {
|
|||
}
|
||||
|
||||
var mousePageX = pageX, mousePageY = pageY;
|
||||
var overwrite = editor.getOverwrite();
|
||||
var mousedownTime = (new Date()).getTime();
|
||||
var dragCursor, dragRange;
|
||||
|
||||
|
|
@ -4300,7 +4300,7 @@ function DefaultHandlers(editor) {
|
|||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
dragSelectionMarker = editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.clearSelection();
|
||||
dom.addCssClass(editor.container, "ace_dragging");
|
||||
}
|
||||
|
|
@ -4370,19 +4370,9 @@ function DefaultHandlers(editor) {
|
|||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
|
|
@ -4417,6 +4407,110 @@ function calcDistance(ax, ay, bx, by) {
|
|||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
}
|
||||
|
||||
});
|
||||
/* 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>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* 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/lib/browser_focus', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
|
||||
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
|
|
@ -4560,8 +4654,6 @@ exports.EventEmitter = EventEmitter;
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -4577,112 +4669,9 @@ exports.EventEmitter = EventEmitter;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/lib/browser_focus', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
|
||||
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* 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' , 'ace/lib/event', 'ace/lib/dom'], function(require, exports, module) {
|
||||
define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
|
|
@ -4781,7 +4770,67 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
}).call(MouseEvent.prototype);
|
||||
|
||||
});
|
||||
/* ***** 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>
|
||||
* 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/fold_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||
|
||||
function FoldHandler(editor) {
|
||||
editor.on("click", function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.FoldHandler = FoldHandler;
|
||||
|
||||
});/* ***** 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
|
||||
|
|
@ -9755,8 +9804,8 @@ function Folding() {
|
|||
this.getRowFoldEnd = function(docRow, startFoldRow) {
|
||||
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
||||
return (foldLine
|
||||
? foldLine.end.row
|
||||
: docRow)
|
||||
? foldLine.end.row
|
||||
: docRow);
|
||||
};
|
||||
|
||||
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||
|
|
@ -9774,7 +9823,7 @@ function Folding() {
|
|||
var doc = this.doc;
|
||||
var textLine = "";
|
||||
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn) {
|
||||
if (row < startRow) {
|
||||
return;
|
||||
} else if (row == startRow) {
|
||||
|
|
@ -9820,31 +9869,36 @@ function Folding() {
|
|||
this.toggleFold = function(tryToUnfold) {
|
||||
var selection = this.selection;
|
||||
var range = selection.getRange();
|
||||
var fold;
|
||||
var bracketPos;
|
||||
|
||||
if (range.isEmpty()) {
|
||||
var cursor = range.start;
|
||||
var fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
var bracketPos;
|
||||
fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
|
||||
if (fold) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
} else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
if (range.comparePoint(bracketPos) == 1) {
|
||||
range.end = bracketPos;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range.start = bracketPos;
|
||||
range.start.column++;
|
||||
range.end.column--;
|
||||
}
|
||||
} else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
if (range.comparePoint(bracketPos) == 1)
|
||||
range.end = bracketPos;
|
||||
else
|
||||
range.start = bracketPos;
|
||||
|
||||
range.start.column++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -9852,7 +9906,8 @@ function Folding() {
|
|||
if (tryToUnfold && folds.length) {
|
||||
this.expandFolds(folds);
|
||||
return;
|
||||
} else if (folds.length == 1 ) {
|
||||
}
|
||||
else if (folds.length == 1 ) {
|
||||
fold = folds[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -9860,7 +9915,7 @@ function Folding() {
|
|||
if (!fold)
|
||||
fold = this.getFoldAt(range.start.row, range.start.column);
|
||||
|
||||
if (fold && fold.range.toString() == range.toString()){
|
||||
if (fold && fold.range.toString() == range.toString()) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
}
|
||||
|
|
@ -9937,6 +9992,9 @@ function Folding() {
|
|||
|
||||
this.$foldStyle = style;
|
||||
|
||||
if (style == "manual")
|
||||
this.unfold();
|
||||
|
||||
// reset folding
|
||||
var mode = this.$foldMode;
|
||||
this.$setFolding(null);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -2392,7 +2392,7 @@ exports.getOS = function() {
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
|
||||
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
|
|
@ -2401,6 +2401,7 @@ var lang = require("./lib/lang");
|
|||
var useragent = require("./lib/useragent");
|
||||
var TextInput = require("./keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
||||
var FoldHandler = require("./mouse/fold_handler").FoldHandler;
|
||||
//var TouchHandler = require("./touch_handler").TouchHandler;
|
||||
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
|
|
@ -2423,6 +2424,7 @@ var Editor = function(renderer, session) {
|
|||
//this.$mouseHandler = new TouchHandler(this);
|
||||
} else {
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
new FoldHandler(this);
|
||||
}
|
||||
|
||||
this.$blockScrolling = 0;
|
||||
|
|
@ -4074,7 +4076,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
this.onMouseMove = function(e) {
|
||||
// optimization, because mousemove doesn't have a default handler.
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry["mousemove"];
|
||||
var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
|
||||
if (!listeners || !listeners.length)
|
||||
return;
|
||||
|
||||
|
|
@ -4145,11 +4147,10 @@ exports.MouseHandler = MouseHandler;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/event_emitter', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/dom', 'ace/lib/browser_focus'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
|
||||
|
||||
var STATE_UNKNOWN = 0;
|
||||
|
|
@ -4225,7 +4226,6 @@ function DefaultHandlers(editor) {
|
|||
}
|
||||
|
||||
var mousePageX = pageX, mousePageY = pageY;
|
||||
var overwrite = editor.getOverwrite();
|
||||
var mousedownTime = (new Date()).getTime();
|
||||
var dragCursor, dragRange;
|
||||
|
||||
|
|
@ -4294,7 +4294,7 @@ function DefaultHandlers(editor) {
|
|||
state = STATE_DRAG;
|
||||
dragRange = editor.getSelectionRange();
|
||||
var style = editor.getSelectionStyle();
|
||||
dragSelectionMarker = editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.session.addMarker(dragRange, "ace_selection", style);
|
||||
editor.clearSelection();
|
||||
dom.addCssClass(editor.container, "ace_dragging");
|
||||
}
|
||||
|
|
@ -4364,19 +4364,9 @@ function DefaultHandlers(editor) {
|
|||
var pos = ev.getDocumentPosition();
|
||||
var editor = this.editor;
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
}
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
}
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.selectWord();
|
||||
this.$clickSelection = editor.getSelectionRange();
|
||||
};
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
|
|
@ -4411,6 +4401,110 @@ function calcDistance(ax, ay, bx, by) {
|
|||
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
|
||||
}
|
||||
|
||||
});
|
||||
/* 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>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* 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/lib/browser_focus', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
|
||||
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
|
|
@ -4554,8 +4648,6 @@ exports.EventEmitter = EventEmitter;
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -4571,112 +4663,9 @@ exports.EventEmitter = EventEmitter;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/lib/browser_focus', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
|
||||
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
/* 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' , 'ace/lib/event', 'ace/lib/dom'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
|
||||
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
/**
|
||||
* Custom Ace mouse event
|
||||
|
|
@ -4775,7 +4764,67 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
}).call(MouseEvent.prototype);
|
||||
|
||||
});
|
||||
/* ***** 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>
|
||||
* 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/fold_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||
|
||||
function FoldHandler(editor) {
|
||||
editor.on("click", function(ev) {
|
||||
var pos = ev.getDocumentPosition();
|
||||
|
||||
// If the user dclicked on a fold, then expand it.
|
||||
var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
|
||||
if (fold) {
|
||||
if (ev.getAccelKey())
|
||||
editor.session.removeFold(fold);
|
||||
else
|
||||
editor.session.expandFold(fold);
|
||||
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.FoldHandler = FoldHandler;
|
||||
|
||||
});/* ***** 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
|
||||
|
|
@ -9749,8 +9798,8 @@ function Folding() {
|
|||
this.getRowFoldEnd = function(docRow, startFoldRow) {
|
||||
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
||||
return (foldLine
|
||||
? foldLine.end.row
|
||||
: docRow)
|
||||
? foldLine.end.row
|
||||
: docRow);
|
||||
};
|
||||
|
||||
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||
|
|
@ -9768,7 +9817,7 @@ function Folding() {
|
|||
var doc = this.doc;
|
||||
var textLine = "";
|
||||
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn) {
|
||||
if (row < startRow) {
|
||||
return;
|
||||
} else if (row == startRow) {
|
||||
|
|
@ -9814,31 +9863,36 @@ function Folding() {
|
|||
this.toggleFold = function(tryToUnfold) {
|
||||
var selection = this.selection;
|
||||
var range = selection.getRange();
|
||||
var fold;
|
||||
var bracketPos;
|
||||
|
||||
if (range.isEmpty()) {
|
||||
var cursor = range.start;
|
||||
var fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
var bracketPos;
|
||||
fold = this.getFoldAt(cursor.row, cursor.column);
|
||||
|
||||
if (fold) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
} else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket(cursor)) {
|
||||
if (range.comparePoint(bracketPos) == 1) {
|
||||
range.end = bracketPos;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range.start = bracketPos;
|
||||
range.start.column++;
|
||||
range.end.column--;
|
||||
}
|
||||
} else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
}
|
||||
else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
|
||||
if (range.comparePoint(bracketPos) == 1)
|
||||
range.end = bracketPos;
|
||||
else
|
||||
range.start = bracketPos;
|
||||
|
||||
range.start.column++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -9846,7 +9900,8 @@ function Folding() {
|
|||
if (tryToUnfold && folds.length) {
|
||||
this.expandFolds(folds);
|
||||
return;
|
||||
} else if (folds.length == 1 ) {
|
||||
}
|
||||
else if (folds.length == 1 ) {
|
||||
fold = folds[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -9854,7 +9909,7 @@ function Folding() {
|
|||
if (!fold)
|
||||
fold = this.getFoldAt(range.start.row, range.start.column);
|
||||
|
||||
if (fold && fold.range.toString() == range.toString()){
|
||||
if (fold && fold.range.toString() == range.toString()) {
|
||||
this.expandFold(fold);
|
||||
return;
|
||||
}
|
||||
|
|
@ -9931,6 +9986,9 @@ function Folding() {
|
|||
|
||||
this.$foldStyle = style;
|
||||
|
||||
if (style == "manual")
|
||||
this.unfold();
|
||||
|
||||
// reset folding
|
||||
var mode = this.$foldMode;
|
||||
this.$setFolding(null);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue