mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
350e2ac38f
Upgrade to Ace v1.4.5 GitOrigin-RevId: 7ab7ba24c0bfc927567fbd4196e05a1c3f26d283
57 lines
No EOL
1.8 KiB
JavaScript
57 lines
No EOL
1.8 KiB
JavaScript
ace.define("ace/ext/statusbar",[], function(require, exports, module) {
|
|
"use strict";
|
|
var dom = require("../lib/dom");
|
|
var lang = require("../lib/lang");
|
|
|
|
var StatusBar = function(editor, parentNode) {
|
|
this.element = dom.createElement("div");
|
|
this.element.className = "ace_status-indicator";
|
|
this.element.style.cssText = "display: inline-block;";
|
|
parentNode.appendChild(this.element);
|
|
|
|
var statusUpdate = lang.delayedCall(function(){
|
|
this.updateStatus(editor);
|
|
}.bind(this)).schedule.bind(null, 100);
|
|
|
|
editor.on("changeStatus", statusUpdate);
|
|
editor.on("changeSelection", statusUpdate);
|
|
editor.on("keyboardActivity", statusUpdate);
|
|
};
|
|
|
|
(function(){
|
|
this.updateStatus = function(editor) {
|
|
var status = [];
|
|
function add(str, separator) {
|
|
str && status.push(str, separator || "|");
|
|
}
|
|
|
|
add(editor.keyBinding.getStatusText(editor));
|
|
if (editor.commands.recording)
|
|
add("REC");
|
|
|
|
var sel = editor.selection;
|
|
var c = sel.lead;
|
|
|
|
if (!sel.isEmpty()) {
|
|
var r = editor.getSelectionRange();
|
|
add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " ");
|
|
}
|
|
add(c.row + ":" + c.column, " ");
|
|
if (sel.rangeCount)
|
|
add("[" + sel.rangeCount + "]", " ");
|
|
status.pop();
|
|
this.element.textContent = status.join("");
|
|
};
|
|
}).call(StatusBar.prototype);
|
|
|
|
exports.StatusBar = StatusBar;
|
|
|
|
});
|
|
(function() {
|
|
ace.require(["ace/ext/statusbar"], function(m) {
|
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
module.exports = m;
|
|
}
|
|
});
|
|
})();
|
|
|