mediawiki-extensions-CodeEd.../modules/ace/ext-statusbar.js
Derk-Jan Hartman 7254cda535 Ace: Update to 2015-01-28
Updated to
6b88b939c2

Includes fixes for drag delay (bug 60432)
and chrome useragent detection: Github issue
https://github.com/ajaxorg/ace/issues/1950

Bug: T62432
Change-Id: I5ac67a812f09ac43e73475613afc9a3f1ddc9a75
2015-01-28 11:04:27 -08:00

51 lines
1.6 KiB
JavaScript

define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
"use strict";
var dom = require("ace/lib/dom");
var lang = require("ace/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));
editor.on("changeStatus", function() {
statusUpdate.schedule(100);
});
editor.on("changeSelection", function() {
statusUpdate.schedule(100);
});
};
(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 c = editor.selection.lead;
add(c.row + ":" + c.column, " ");
if (!editor.selection.isEmpty()) {
var r = editor.getSelectionRange();
add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
}
status.pop();
this.element.textContent = status.join("");
};
}).call(StatusBar.prototype);
exports.StatusBar = StatusBar;
});
(function() {
window.require(["ace/ext/statusbar"], function() {});
})();