mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-13 13:01:27 +01:00
NEW Upgrade ace to 1.4.8 - Upgrade select2 to 4.0.13
This commit is contained in:
@@ -880,10 +880,10 @@ if (!Date.now) {
|
||||
return new Date().getTime();
|
||||
};
|
||||
}
|
||||
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
||||
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
|
||||
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
||||
"\u2029\uFEFF";
|
||||
if (!String.prototype.trim || ws.trim()) {
|
||||
if (!String.prototype.trim) {
|
||||
ws = "[" + ws + "]";
|
||||
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
||||
trimEndRegexp = new RegExp(ws + ws + "*$");
|
||||
@@ -1404,26 +1404,30 @@ var useragent = require("./useragent");
|
||||
var pressedKeys = null;
|
||||
var ts = 0;
|
||||
|
||||
var activeListenerOptions;
|
||||
function detectListenerOptionsSupport() {
|
||||
activeListenerOptions = false;
|
||||
try {
|
||||
document.createComment("").addEventListener("test", function() {}, {
|
||||
get passive() {
|
||||
activeListenerOptions = {passive: false};
|
||||
}
|
||||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function getListenerOptions() {
|
||||
if (activeListenerOptions == undefined)
|
||||
detectListenerOptionsSupport();
|
||||
return activeListenerOptions;
|
||||
}
|
||||
|
||||
exports.addListener = function(elem, type, callback) {
|
||||
if (elem.addEventListener) {
|
||||
return elem.addEventListener(type, callback, false);
|
||||
}
|
||||
if (elem.attachEvent) {
|
||||
var wrapper = function() {
|
||||
callback.call(elem, window.event);
|
||||
};
|
||||
callback._wrapper = wrapper;
|
||||
elem.attachEvent("on" + type, wrapper);
|
||||
}
|
||||
return elem.addEventListener(type, callback, getListenerOptions());
|
||||
};
|
||||
|
||||
exports.removeListener = function(elem, type, callback) {
|
||||
if (elem.removeEventListener) {
|
||||
return elem.removeEventListener(type, callback, false);
|
||||
}
|
||||
if (elem.detachEvent) {
|
||||
elem.detachEvent("on" + type, callback._wrapper || callback);
|
||||
}
|
||||
return elem.removeEventListener(type, callback, getListenerOptions());
|
||||
};
|
||||
exports.stopEvent = function(e) {
|
||||
exports.stopPropagation(e);
|
||||
@@ -1434,27 +1438,18 @@ exports.stopEvent = function(e) {
|
||||
exports.stopPropagation = function(e) {
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
else
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
|
||||
exports.preventDefault = function(e) {
|
||||
if (e.preventDefault)
|
||||
e.preventDefault();
|
||||
else
|
||||
e.returnValue = false;
|
||||
};
|
||||
exports.getButton = function(e) {
|
||||
if (e.type == "dblclick")
|
||||
return 0;
|
||||
if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
|
||||
return 2;
|
||||
if (e.preventDefault) {
|
||||
return e.button;
|
||||
}
|
||||
else {
|
||||
return {1:0, 2:2, 4:1}[e.button];
|
||||
}
|
||||
return e.button;
|
||||
};
|
||||
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
@@ -1560,30 +1555,16 @@ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, c
|
||||
else if (clicks > 1)
|
||||
return eventHandler[callbackName](eventNames[clicks], e);
|
||||
}
|
||||
function onDblclick(e) {
|
||||
clicks = 2;
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);
|
||||
eventHandler[callbackName]("mousedown", e);
|
||||
eventHandler[callbackName](eventNames[clicks], e);
|
||||
}
|
||||
if (!Array.isArray(elements))
|
||||
elements = [elements];
|
||||
elements.forEach(function(el) {
|
||||
exports.addListener(el, "mousedown", onMousedown);
|
||||
if (useragent.isOldIE)
|
||||
exports.addListener(el, "dblclick", onDblclick);
|
||||
});
|
||||
};
|
||||
|
||||
var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window)
|
||||
? function(e) {
|
||||
return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
||||
}
|
||||
: function(e) {
|
||||
return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
|
||||
};
|
||||
var getModifierHash = function(e) {
|
||||
return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
|
||||
};
|
||||
|
||||
exports.getModifierString = function(e) {
|
||||
return keys.KEY_MODS[getModifierHash(e)];
|
||||
@@ -2228,6 +2209,7 @@ var TextInput = function(parentNode, host) {
|
||||
var lastValue = "";
|
||||
var lastSelectionStart = 0;
|
||||
var lastSelectionEnd = 0;
|
||||
var lastRestoreEnd = 0;
|
||||
try { var isFocused = document.activeElement === text; } catch(e) {}
|
||||
|
||||
event.addListener(text, "blur", function(e) {
|
||||
@@ -2447,9 +2429,8 @@ var TextInput = function(parentNode, host) {
|
||||
endIndex = 0;
|
||||
}
|
||||
inserted = inserted.slice(0, endIndex);
|
||||
if (!fromInput && restoreStart == inserted.length && !extendLeft && !extendRight && !restoreEnd)
|
||||
if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)
|
||||
return "";
|
||||
|
||||
sendingText = true;
|
||||
if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) {
|
||||
host.onTextInput(inserted);
|
||||
@@ -2466,6 +2447,7 @@ var TextInput = function(parentNode, host) {
|
||||
lastValue = value;
|
||||
lastSelectionStart = selectionStart;
|
||||
lastSelectionEnd = selectionEnd;
|
||||
lastRestoreEnd = restoreEnd;
|
||||
return inserted;
|
||||
}
|
||||
};
|
||||
@@ -2628,7 +2610,7 @@ var TextInput = function(parentNode, host) {
|
||||
= inComposition.context.compositionStartOffset;
|
||||
}
|
||||
inComposition.markerRange.end.column = inComposition.markerRange.start.column
|
||||
+ lastSelectionEnd - inComposition.selectionStart;
|
||||
+ lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -3786,10 +3768,11 @@ exports.DragdropHandler = DragdropHandler;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/dom"], function(require, exports, module) {
|
||||
define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var MouseEvent = require("./mouse_event").MouseEvent;
|
||||
var event = require("../lib/event");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
exports.addTouchListeners = function(el, editor) {
|
||||
@@ -3916,12 +3899,12 @@ exports.addTouchListeners = function(el, editor) {
|
||||
}
|
||||
mode = "wait";
|
||||
}
|
||||
el.addEventListener("contextmenu", function(e) {
|
||||
event.addListener(el, "contextmenu", function(e) {
|
||||
if (!pressed) return;
|
||||
var textarea = editor.textInput.getElement();
|
||||
textarea.focus();
|
||||
});
|
||||
el.addEventListener("touchstart", function (e) {
|
||||
event.addListener(el, "touchstart", function (e) {
|
||||
var touches = e.touches;
|
||||
if (longTouchTimer || touches.length > 1) {
|
||||
clearTimeout(longTouchTimer);
|
||||
@@ -3995,7 +3978,7 @@ exports.addTouchListeners = function(el, editor) {
|
||||
touchStartT = t;
|
||||
});
|
||||
|
||||
el.addEventListener("touchend", function (e) {
|
||||
event.addListener(el, "touchend", function (e) {
|
||||
pressed = editor.$mouseHandler.isMousePressed = false;
|
||||
if (animationTimer) clearInterval(animationTimer);
|
||||
if (mode == "zoom") {
|
||||
@@ -4015,7 +3998,7 @@ exports.addTouchListeners = function(el, editor) {
|
||||
clearTimeout(longTouchTimer);
|
||||
longTouchTimer = null;
|
||||
});
|
||||
el.addEventListener("touchmove", function (e) {
|
||||
event.addListener(el, "touchmove", function (e) {
|
||||
if (longTouchTimer) {
|
||||
clearTimeout(longTouchTimer);
|
||||
longTouchTimer = null;
|
||||
@@ -4577,7 +4560,7 @@ function deHyphenate(str) {
|
||||
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
|
||||
}
|
||||
|
||||
exports.version = "1.4.6";
|
||||
exports.version = "1.4.8";
|
||||
|
||||
});
|
||||
|
||||
@@ -5677,6 +5660,8 @@ var Selection = function(session) {
|
||||
};
|
||||
|
||||
this.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {
|
||||
if (this.$silent)
|
||||
return;
|
||||
var wasEmpty = this.$isEmpty;
|
||||
var wasMultiselect = this.inMultiSelectMode;
|
||||
this.$silent = true;
|
||||
@@ -6070,14 +6055,19 @@ var Selection = function(session) {
|
||||
else
|
||||
this.$desiredColumn = screenPos.column;
|
||||
}
|
||||
|
||||
|
||||
if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {
|
||||
var widget = this.session.lineWidgets[this.lead.row];
|
||||
if (rows < 0)
|
||||
rows -= widget.rowsAbove || 0;
|
||||
else if (rows > 0)
|
||||
rows += widget.rowCount - (widget.rowsAbove || 0);
|
||||
}
|
||||
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);
|
||||
|
||||
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
|
||||
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
|
||||
if (docPos.row > 0 || rows > 0)
|
||||
docPos.row++;
|
||||
}
|
||||
|
||||
}
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
};
|
||||
@@ -9710,7 +9700,7 @@ function BracketMatch() {
|
||||
var line = this.getLine(pos.row);
|
||||
var before = true, range;
|
||||
|
||||
var chr = line.charAt(pos.column-1);
|
||||
var chr = line.charAt(pos.column - 1);
|
||||
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if (!match) {
|
||||
chr = line.charAt(pos.column);
|
||||
@@ -9745,6 +9735,29 @@ function BracketMatch() {
|
||||
|
||||
return range;
|
||||
};
|
||||
this.getMatchingBracketRanges = function(pos) {
|
||||
var line = this.getLine(pos.row);
|
||||
|
||||
var chr = line.charAt(pos.column - 1);
|
||||
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if (!match) {
|
||||
chr = line.charAt(pos.column);
|
||||
pos = {row: pos.row, column: pos.column + 1};
|
||||
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
||||
}
|
||||
|
||||
if (!match)
|
||||
return null;
|
||||
|
||||
var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column);
|
||||
var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos)
|
||||
: this.$findOpeningBracket(match[2], pos);
|
||||
if (!bracketPos)
|
||||
return [startRange];
|
||||
var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);
|
||||
|
||||
return [startRange, endRange];
|
||||
};
|
||||
|
||||
this.$brackets = {
|
||||
")": "(",
|
||||
@@ -11147,15 +11160,14 @@ EditSession.$uid = 0;
|
||||
|
||||
this.lineWidgets = null;
|
||||
this.getRowLength = function(row) {
|
||||
var h = 1;
|
||||
if (this.lineWidgets)
|
||||
var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
|
||||
else
|
||||
h = 0;
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
return 1 + h;
|
||||
} else {
|
||||
return this.$wrapData[row].length + 1 + h;
|
||||
}
|
||||
h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
|
||||
|
||||
if (!this.$useWrapMode || !this.$wrapData[row])
|
||||
return h;
|
||||
else
|
||||
return this.$wrapData[row].length + h;
|
||||
};
|
||||
this.getRowLineCount = function(row) {
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
@@ -11367,6 +11379,9 @@ EditSession.$uid = 0;
|
||||
wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)
|
||||
screenRow += this.lineWidgets[row].rowsAbove;
|
||||
|
||||
return {
|
||||
row: screenRow,
|
||||
@@ -13034,6 +13049,26 @@ exports.commands = [{
|
||||
},
|
||||
readOnly: true,
|
||||
scrollIntoView: "none"
|
||||
}, {
|
||||
name: "addLineAfter",
|
||||
exec: function(editor) {
|
||||
editor.selection.clearSelection();
|
||||
editor.navigateLineEnd();
|
||||
editor.insert("\n");
|
||||
},
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor"
|
||||
}, {
|
||||
name: "addLineBefore",
|
||||
exec: function(editor) {
|
||||
editor.selection.clearSelection();
|
||||
var cursor = editor.getCursorPosition();
|
||||
editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);
|
||||
editor.insert("\n");
|
||||
if (cursor.row === 0) editor.navigateUp();
|
||||
},
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor"
|
||||
}, {
|
||||
name: "openCommandPallete",
|
||||
description: "Open command pallete",
|
||||
@@ -13419,28 +13454,46 @@ Editor.$uid = 0;
|
||||
};
|
||||
|
||||
this.$highlightBrackets = function() {
|
||||
if (this.session.$bracketHighlight) {
|
||||
this.session.removeMarker(this.session.$bracketHighlight);
|
||||
this.session.$bracketHighlight = null;
|
||||
}
|
||||
|
||||
if (this.$highlightPending) {
|
||||
return;
|
||||
}
|
||||
var self = this;
|
||||
this.$highlightPending = true;
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
self.$highlightPending = false;
|
||||
var session = self.session;
|
||||
if (!session || !session.bgTokenizer) return;
|
||||
var pos = session.findMatchingBracket(self.getCursorPosition());
|
||||
if (pos) {
|
||||
var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
|
||||
} else if (session.$mode.getMatching) {
|
||||
var range = session.$mode.getMatching(self.session);
|
||||
if (session.$bracketHighlight) {
|
||||
session.$bracketHighlight.markerIds.forEach(function(id) {
|
||||
session.removeMarker(id);
|
||||
});
|
||||
session.$bracketHighlight = null;
|
||||
}
|
||||
if (range)
|
||||
session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
|
||||
var ranges = session.getMatchingBracketRanges(self.getCursorPosition());
|
||||
if (!ranges && session.$mode.getMatching)
|
||||
ranges = session.$mode.getMatching(self.session);
|
||||
if (!ranges)
|
||||
return;
|
||||
|
||||
var markerType = "ace_bracket";
|
||||
if (!Array.isArray(ranges)) {
|
||||
ranges = [ranges];
|
||||
} else if (ranges.length == 1) {
|
||||
markerType = "ace_error_bracket";
|
||||
}
|
||||
if (ranges.length == 2) {
|
||||
if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
|
||||
ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
|
||||
else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
|
||||
ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
|
||||
}
|
||||
|
||||
session.$bracketHighlight = {
|
||||
ranges: ranges,
|
||||
markerIds: ranges.map(function(range) {
|
||||
return session.addMarker(range, markerType, "text");
|
||||
})
|
||||
};
|
||||
}, 50);
|
||||
};
|
||||
this.$highlightTags = function() {
|
||||
@@ -14263,6 +14316,7 @@ Editor.$uid = 0;
|
||||
["up", "down"],
|
||||
["before", "after"],
|
||||
["even", "odd"],
|
||||
["in", "out"],
|
||||
["inside", "outside"],
|
||||
["next", "previous"],
|
||||
["increase", "decrease"],
|
||||
@@ -14870,9 +14924,11 @@ Editor.$uid = 0;
|
||||
this.destroy = function() {
|
||||
this.renderer.destroy();
|
||||
this._signal("destroy", this);
|
||||
if (this.session) {
|
||||
if (this.session)
|
||||
this.session.destroy();
|
||||
}
|
||||
if (this._$emitInputEvent)
|
||||
this._$emitInputEvent.cancel();
|
||||
this.session = null;
|
||||
};
|
||||
this.setAutoScrollEditorIntoView = function(enable) {
|
||||
if (!enable)
|
||||
@@ -15028,6 +15084,31 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||
relativeNumberRenderer.detach(this);
|
||||
}
|
||||
},
|
||||
placeholder: {
|
||||
set: function(message) {
|
||||
if (!this.$updatePlaceholder) {
|
||||
this.$updatePlaceholder = function() {
|
||||
var value = this.renderer.$composition || this.getValue();
|
||||
if (value && this.renderer.placeholderNode) {
|
||||
this.renderer.off("afterRender", this.$updatePlaceholder);
|
||||
dom.removeCssClass(this.container, "ace_hasPlaceholder");
|
||||
this.renderer.placeholderNode.remove();
|
||||
this.renderer.placeholderNode = null;
|
||||
} else if (!value && !this.renderer.placeholderNode) {
|
||||
this.renderer.on("afterRender", this.$updatePlaceholder);
|
||||
dom.addCssClass(this.container, "ace_hasPlaceholder");
|
||||
var el = dom.createElement("div");
|
||||
el.className = "ace_placeholder";
|
||||
el.textContent = this.$placeholder || "";
|
||||
this.renderer.placeholderNode = el;
|
||||
this.renderer.content.appendChild(this.renderer.placeholderNode);
|
||||
}
|
||||
}.bind(this);
|
||||
this.on("input", this.$updatePlaceholder);
|
||||
}
|
||||
this.$updatePlaceholder();
|
||||
}
|
||||
},
|
||||
|
||||
hScrollBarAlwaysVisible: "renderer",
|
||||
vScrollBarAlwaysVisible: "renderer",
|
||||
@@ -15118,6 +15199,7 @@ var UndoManager = function() {
|
||||
this.add = function(delta, allowMerge, session) {
|
||||
if (this.$fromUndo) return;
|
||||
if (delta == this.$lastDelta) return;
|
||||
if (!this.$keepRedoStack) this.$redoStack.length = 0;
|
||||
if (allowMerge === false || !this.lastDeltas) {
|
||||
this.lastDeltas = [];
|
||||
this.$undoStack.push(this.lastDeltas);
|
||||
@@ -15194,6 +15276,25 @@ var UndoManager = function() {
|
||||
if (to == null) to = this.$rev + 1;
|
||||
|
||||
};
|
||||
|
||||
this.validateDeltaBoundaries = function(deltaSet, docLength, invertAction) {
|
||||
if (!deltaSet) {
|
||||
return false;
|
||||
}
|
||||
return deltaSet.every(function(delta) {
|
||||
var action = delta.action;
|
||||
if (invertAction && delta.action === "insert") action = "remove";
|
||||
if (invertAction && delta.action === "remove") action = "insert";
|
||||
switch(action) {
|
||||
case "insert":
|
||||
return delta.start.row <= docLength;
|
||||
case "remove":
|
||||
return delta.start.row < docLength && delta.end.row < docLength;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
};
|
||||
this.undo = function(session, dontSelect) {
|
||||
this.lastDeltas = null;
|
||||
var stack = this.$undoStack;
|
||||
@@ -15211,7 +15312,7 @@ var UndoManager = function() {
|
||||
|
||||
var deltaSet = stack.pop();
|
||||
var undoSelectionRange = null;
|
||||
if (deltaSet && deltaSet.length) {
|
||||
if (this.validateDeltaBoundaries(deltaSet, session.getLength(), true)) {
|
||||
undoSelectionRange = session.undoChanges(deltaSet, dontSelect);
|
||||
this.$redoStack.push(deltaSet);
|
||||
this.$syncRev();
|
||||
@@ -15239,7 +15340,7 @@ var UndoManager = function() {
|
||||
var deltaSet = this.$redoStack.pop();
|
||||
var redoSelectionRange = null;
|
||||
|
||||
if (deltaSet) {
|
||||
if (this.validateDeltaBoundaries(deltaSet, session.getLength(), false)) {
|
||||
redoSelectionRange = session.redoChanges(deltaSet, dontSelect);
|
||||
this.$undoStack.push(deltaSet);
|
||||
this.$syncRev();
|
||||
@@ -15618,7 +15719,7 @@ var Lines = function(element, canvasHeight) {
|
||||
};
|
||||
|
||||
this.computeLineHeight = function(row, config, session) {
|
||||
return config.lineHeight * session.getRowLength(row);
|
||||
return config.lineHeight * session.getRowLineCount(row);
|
||||
};
|
||||
|
||||
this.getLength = function() {
|
||||
@@ -15645,10 +15746,10 @@ var Lines = function(element, canvasHeight) {
|
||||
fragment.appendChild(cell[i].element);
|
||||
}
|
||||
this.element.appendChild(fragment);
|
||||
} else {
|
||||
} else {
|
||||
this.cells.push(cell);
|
||||
this.element.appendChild(cell.element);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.unshift = function(cell) {
|
||||
@@ -15662,10 +15763,10 @@ var Lines = function(element, canvasHeight) {
|
||||
this.element.insertBefore(fragment, this.element.firstChild);
|
||||
else
|
||||
this.element.appendChild(fragment);
|
||||
} else {
|
||||
} else {
|
||||
this.cells.unshift(cell);
|
||||
this.element.insertAdjacentElement("afterbegin", cell.element);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.last = function() {
|
||||
@@ -17633,6 +17734,7 @@ position: absolute;\
|
||||
box-sizing: border-box;\
|
||||
min-width: 100%;\
|
||||
contain: style size layout;\
|
||||
font-variant-ligatures: no-common-ligatures;\
|
||||
}\
|
||||
.ace_dragging .ace_scroller:before{\
|
||||
position: absolute;\
|
||||
@@ -17764,7 +17866,6 @@ margin-top: 1px;\
|
||||
[ace_nocontext=true] {\
|
||||
transform: none!important;\
|
||||
filter: none!important;\
|
||||
perspective: none!important;\
|
||||
clip-path: none!important;\
|
||||
mask : none!important;\
|
||||
contain: none!important;\
|
||||
@@ -17843,6 +17944,9 @@ border-bottom: 1px solid;\
|
||||
.ace_hidden-cursors .ace_cursor {\
|
||||
opacity: 0.2;\
|
||||
}\
|
||||
.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\
|
||||
opacity: 0;\
|
||||
}\
|
||||
.ace_smooth-blinking .ace_cursor {\
|
||||
transition: opacity 0.18s;\
|
||||
}\
|
||||
@@ -17879,6 +17983,11 @@ z-index: 5;\
|
||||
position: absolute;\
|
||||
z-index: 6;\
|
||||
}\
|
||||
.ace_marker-layer .ace_error_bracket {\
|
||||
position: absolute;\
|
||||
border-bottom: 1px solid #DE5555;\
|
||||
border-radius: 0;\
|
||||
}\
|
||||
.ace_marker-layer .ace_active-line {\
|
||||
position: absolute;\
|
||||
z-index: 2;\
|
||||
@@ -18062,6 +18171,14 @@ opacity:1;\
|
||||
}\
|
||||
.ace_mobile-button:active {\
|
||||
background-color: #ddd;\
|
||||
}\
|
||||
.ace_placeholder {\
|
||||
font-family: arial;\
|
||||
transform: scale(0.9);\
|
||||
transform-origin: left;\
|
||||
white-space: pre;\
|
||||
opacity: 0.7;\
|
||||
margin: 0 10px;\
|
||||
}";
|
||||
|
||||
var useragent = require("./lib/useragent");
|
||||
@@ -18522,7 +18639,6 @@ var VirtualRenderer = function(container, theme) {
|
||||
if (composition.useTextareaForIME) {
|
||||
var val = this.textarea.value;
|
||||
w = this.characterWidth * (this.session.$getStringScreenWidth(val)[0]);
|
||||
h += 2;
|
||||
}
|
||||
else {
|
||||
posTop += this.lineHeight + 2;
|
||||
@@ -18649,7 +18765,7 @@ var VirtualRenderer = function(container, theme) {
|
||||
this.$textLayer.checkForSizeChanges();
|
||||
}
|
||||
|
||||
this._signal("beforeRender");
|
||||
this._signal("beforeRender", changes);
|
||||
|
||||
if (this.session && this.session.$bidiHandler)
|
||||
this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
|
||||
@@ -18697,7 +18813,7 @@ var VirtualRenderer = function(container, theme) {
|
||||
this.$markerFront.update(config);
|
||||
this.$cursorLayer.update(config);
|
||||
this.$moveTextAreaToCursor();
|
||||
this._signal("afterRender");
|
||||
this._signal("afterRender", changes);
|
||||
return;
|
||||
}
|
||||
if (changes & this.CHANGE_SCROLL) {
|
||||
@@ -18717,7 +18833,7 @@ var VirtualRenderer = function(container, theme) {
|
||||
this.$markerFront.update(config);
|
||||
this.$cursorLayer.update(config);
|
||||
this.$moveTextAreaToCursor();
|
||||
this._signal("afterRender");
|
||||
this._signal("afterRender", changes);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18753,7 +18869,7 @@ var VirtualRenderer = function(container, theme) {
|
||||
this.$markerBack.update(config);
|
||||
}
|
||||
|
||||
this._signal("afterRender");
|
||||
this._signal("afterRender", changes);
|
||||
};
|
||||
|
||||
|
||||
@@ -19185,7 +19301,7 @@ var VirtualRenderer = function(container, theme) {
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$cursorLayer.element.style.display = "none";
|
||||
}
|
||||
else {
|
||||
else {
|
||||
composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
|
||||
}
|
||||
};
|
||||
@@ -20079,10 +20195,20 @@ exports.defaultCommands = [{
|
||||
scrollIntoView: "cursor",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "splitIntoLines",
|
||||
name: "toggleSplitSelectionIntoLines",
|
||||
description: "Split into lines",
|
||||
exec: function(editor) {
|
||||
if (editor.multiSelect.rangeCount > 1)
|
||||
editor.multiSelect.joinSelections();
|
||||
else
|
||||
editor.multiSelect.splitIntoLines();
|
||||
},
|
||||
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "splitSelectionIntoLines",
|
||||
description: "Split into lines",
|
||||
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
|
||||
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "alignCursors",
|
||||
@@ -20177,7 +20303,6 @@ var EditSession = require("./edit_session").EditSession;
|
||||
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
};
|
||||
|
||||
this.toSingleRange = function(range) {
|
||||
range = range || this.ranges[0];
|
||||
var removed = this.rangeList.removeAll();
|
||||
@@ -20242,45 +20367,36 @@ var EditSession = require("./edit_session").EditSession;
|
||||
this.getAllRanges = function() {
|
||||
return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
|
||||
};
|
||||
|
||||
this.splitIntoLines = function () {
|
||||
if (this.rangeCount > 1) {
|
||||
var ranges = this.rangeList.ranges;
|
||||
var lastRange = ranges[ranges.length - 1];
|
||||
var range = Range.fromPoints(ranges[0].start, lastRange.end);
|
||||
|
||||
this.toSingleRange();
|
||||
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
|
||||
} else {
|
||||
var range = this.getRange();
|
||||
var isBackwards = this.isBackwards();
|
||||
var startRow = range.start.row;
|
||||
var ranges = this.ranges.length ? this.ranges : [this.getRange()];
|
||||
var newRanges = [];
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var range = ranges[i];
|
||||
var row = range.start.row;
|
||||
var endRow = range.end.row;
|
||||
if (startRow == endRow) {
|
||||
if (isBackwards)
|
||||
var start = range.end, end = range.start;
|
||||
else
|
||||
var start = range.start, end = range.end;
|
||||
|
||||
this.addRange(Range.fromPoints(end, end));
|
||||
this.addRange(Range.fromPoints(start, start));
|
||||
return;
|
||||
if (row === endRow) {
|
||||
newRanges.push(range.clone());
|
||||
} else {
|
||||
newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length));
|
||||
while (++row < endRow)
|
||||
newRanges.push(this.getLineRange(row, true));
|
||||
newRanges.push(new Range(endRow, 0, endRow, range.end.column));
|
||||
}
|
||||
|
||||
var rectSel = [];
|
||||
var r = this.getLineRange(startRow, true);
|
||||
r.start.column = range.start.column;
|
||||
rectSel.push(r);
|
||||
|
||||
for (var i = startRow + 1; i < endRow; i++)
|
||||
rectSel.push(this.getLineRange(i, true));
|
||||
|
||||
r = this.getLineRange(endRow, true);
|
||||
r.end.column = range.end.column;
|
||||
rectSel.push(r);
|
||||
|
||||
rectSel.forEach(this.addRange, this);
|
||||
if (i == 0 && !this.isBackwards())
|
||||
newRanges = newRanges.reverse();
|
||||
}
|
||||
this.toSingleRange();
|
||||
for (var i = newRanges.length; i--;)
|
||||
this.addRange(newRanges[i]);
|
||||
};
|
||||
|
||||
this.joinSelections = function () {
|
||||
var ranges = this.rangeList.ranges;
|
||||
var lastRange = ranges[ranges.length - 1];
|
||||
var range = Range.fromPoints(ranges[0].start, lastRange.end);
|
||||
|
||||
this.toSingleRange();
|
||||
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
|
||||
};
|
||||
this.toggleBlockSelection = function () {
|
||||
if (this.rangeCount > 1) {
|
||||
@@ -21146,13 +21262,10 @@ var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
||||
|
||||
define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"], function(require, exports, module) {
|
||||
define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("./lib/oop");
|
||||
var dom = require("./lib/dom");
|
||||
var Range = require("./range").Range;
|
||||
|
||||
|
||||
function LineWidgets(session) {
|
||||
this.session = session;
|
||||
@@ -21266,14 +21379,21 @@ function LineWidgets(session) {
|
||||
var len = delta.end.row - startRow;
|
||||
|
||||
if (len === 0) {
|
||||
} else if (delta.action == 'remove') {
|
||||
} else if (delta.action == "remove") {
|
||||
var removed = lineWidgets.splice(startRow + 1, len);
|
||||
if (!lineWidgets[startRow] && removed[removed.length - 1]) {
|
||||
lineWidgets[startRow] = removed.pop();
|
||||
}
|
||||
removed.forEach(function(w) {
|
||||
w && this.removeLineWidget(w);
|
||||
}, this);
|
||||
this.$updateRows();
|
||||
} else {
|
||||
var args = new Array(len);
|
||||
if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
|
||||
if (delta.start.column > lineWidgets[startRow].column)
|
||||
startRow++;
|
||||
}
|
||||
args.unshift(startRow, 0);
|
||||
lineWidgets.splice.apply(lineWidgets, args);
|
||||
this.$updateRows();
|
||||
@@ -21298,7 +21418,7 @@ function LineWidgets(session) {
|
||||
this.session.lineWidgets = null;
|
||||
};
|
||||
|
||||
this.addLineWidget = function(w) {
|
||||
this.$registerLineWidget = function(w) {
|
||||
if (!this.session.lineWidgets)
|
||||
this.session.lineWidgets = new Array(this.session.getLength());
|
||||
|
||||
@@ -21312,9 +21432,15 @@ function LineWidgets(session) {
|
||||
}
|
||||
|
||||
this.session.lineWidgets[w.row] = w;
|
||||
|
||||
return w;
|
||||
};
|
||||
|
||||
this.addLineWidget = function(w) {
|
||||
this.$registerLineWidget(w);
|
||||
w.session = this.session;
|
||||
|
||||
if (!this.editor) return w;
|
||||
|
||||
var renderer = this.editor.renderer;
|
||||
if (w.html && !w.el) {
|
||||
w.el = dom.createElement("div");
|
||||
@@ -21326,13 +21452,13 @@ function LineWidgets(session) {
|
||||
w.el.style.zIndex = 5;
|
||||
renderer.container.appendChild(w.el);
|
||||
w._inDocument = true;
|
||||
}
|
||||
|
||||
if (!w.coverGutter) {
|
||||
w.el.style.zIndex = 3;
|
||||
}
|
||||
if (w.pixelHeight == null) {
|
||||
w.pixelHeight = w.el.offsetHeight;
|
||||
|
||||
if (!w.coverGutter) {
|
||||
w.el.style.zIndex = 3;
|
||||
}
|
||||
if (w.pixelHeight == null) {
|
||||
w.pixelHeight = w.el.offsetHeight;
|
||||
}
|
||||
}
|
||||
if (w.rowCount == null) {
|
||||
w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
|
||||
|
||||
Reference in New Issue
Block a user