use constants exported from toolbar for selections
make things a little less brittle address linter warnings
This commit is contained in:
@@ -19,7 +19,9 @@ define([
|
|||||||
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Modes, Themes, Visible, Notify) {
|
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Modes, Themes, Visible, Notify) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
var saveAs = window.saveAs;
|
var saveAs = window.saveAs;
|
||||||
var module = window.APP = {};
|
var module = window.APP = {
|
||||||
|
Cryptpad: Cryptpad,
|
||||||
|
};
|
||||||
var ifrw = module.ifrw = $('#pad-iframe')[0].contentWindow;
|
var ifrw = module.ifrw = $('#pad-iframe')[0].contentWindow;
|
||||||
var stringify = function (obj) {
|
var stringify = function (obj) {
|
||||||
return JSONSortify(obj);
|
return JSONSortify(obj);
|
||||||
@@ -184,16 +186,17 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var onInit = config.onInit = function (info) {
|
var onInit = config.onInit = function (info) {
|
||||||
|
//Cryptpad.warn("Initializing realtime session...");
|
||||||
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
|
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
|
||||||
toolbarList = info.userList;
|
toolbarList = info.userList;
|
||||||
var config = {
|
var config = {
|
||||||
userData: userList,
|
userData: userList,
|
||||||
changeNameID: 'cryptpad-changeName',
|
changeNameID: Toolbar.constants.changeName,
|
||||||
};
|
};
|
||||||
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
toolbar = module.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
||||||
createChangeName('cryptpad-changeName', $bar);
|
createChangeName(Toolbar.constants.changeName, $bar);
|
||||||
|
|
||||||
var $rightside = $bar.find('.rtwysiwyg-toolbar-rightside');
|
var $rightside = $bar.find('.' + Toolbar.constants.rightside);
|
||||||
|
|
||||||
/* add an export button */
|
/* add an export button */
|
||||||
var $export = $('<button>')
|
var $export = $('<button>')
|
||||||
@@ -307,7 +310,6 @@ define([
|
|||||||
var title = document.title = Cryptpad.getPadTitle();
|
var title = document.title = Cryptpad.getPadTitle();
|
||||||
Cryptpad.rememberPad(title);
|
Cryptpad.rememberPad(title);
|
||||||
|
|
||||||
Cryptpad.styleAlerts();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateUserList = function(shjson) {
|
var updateUserList = function(shjson) {
|
||||||
@@ -320,6 +322,20 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var unnotify = module.unnotify = function () {
|
||||||
|
if (module.tabNotification &&
|
||||||
|
typeof(module.tabNotification.cancel) === 'function') {
|
||||||
|
module.tabNotification.cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var notify = module.notify = function () {
|
||||||
|
if (Visible.isSupported() && !Visible.currently()) {
|
||||||
|
unnotify();
|
||||||
|
module.tabNotification = Notify.tab(document.title, 1000, 10);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var onReady = config.onReady = function (info) {
|
var onReady = config.onReady = function (info) {
|
||||||
var realtime = module.realtime = info.realtime;
|
var realtime = module.realtime = info.realtime;
|
||||||
module.patchText = TextPatcher.create({
|
module.patchText = TextPatcher.create({
|
||||||
@@ -348,6 +364,7 @@ define([
|
|||||||
|
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
initializing = false;
|
initializing = false;
|
||||||
|
//Cryptpad.log("Your document is ready");
|
||||||
};
|
};
|
||||||
|
|
||||||
var cursorToPos = function(cursor, oldText) {
|
var cursorToPos = function(cursor, oldText) {
|
||||||
@@ -377,20 +394,6 @@ define([
|
|||||||
return cursor;
|
return cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
var unnotify = function () {
|
|
||||||
if (module.tabNotification &&
|
|
||||||
typeof(module.tabNotification.cancel) === 'function') {
|
|
||||||
module.tabNotification.cancel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var notify = function () {
|
|
||||||
if (Visible.isSupported() && !Visible.currently()) {
|
|
||||||
unnotify();
|
|
||||||
module.tabNotification = Notify.tab(document.title, 1000, 10);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var onRemote = config.onRemote = function (info) {
|
var onRemote = config.onRemote = function (info) {
|
||||||
if (initializing) { return; }
|
if (initializing) { return; }
|
||||||
|
|
||||||
@@ -439,9 +442,10 @@ define([
|
|||||||
var onAbort = config.onAbort = function (info) {
|
var onAbort = config.onAbort = function (info) {
|
||||||
// inform of network disconnect
|
// inform of network disconnect
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
window.alert("Network Connection Lost!");
|
Cryptpad.alert("Network Connection Lost!");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cryptpad.styleAlerts();
|
||||||
var realtime = module.realtime = Realtime.start(config);
|
var realtime = module.realtime = Realtime.start(config);
|
||||||
|
|
||||||
editor.on('change', onLocal);
|
editor.on('change', onLocal);
|
||||||
|
|||||||
Reference in New Issue
Block a user