Merge branch 'staging' into code2
This commit is contained in:
@@ -73,7 +73,7 @@ define([
|
||||
|
||||
var proxy = Cryptpad.getProxy();
|
||||
|
||||
var updateIndentSettings = function () {
|
||||
var updateIndentSettings = APP.updateIndentSettings = function () {
|
||||
var indentUnit = proxy[indentKey];
|
||||
var useTabs = proxy[useTabsKey];
|
||||
setIndentation(
|
||||
@@ -208,6 +208,9 @@ define([
|
||||
$previewContainer.hide();
|
||||
APP.$previewButton.removeClass('active');
|
||||
$codeMirror.addClass('fullPage');
|
||||
if (typeof(APP.updateIndentSettings) === 'function') {
|
||||
APP.updateIndentSettings();
|
||||
}
|
||||
};
|
||||
|
||||
config.onInit = function (info) {
|
||||
|
||||
@@ -10,7 +10,13 @@ define([
|
||||
|
||||
var module = { exports: {} };
|
||||
var key = Config.requireConf.urlArgs;
|
||||
var localStorage = window.localStorage || {};
|
||||
var localStorage;
|
||||
try {
|
||||
localStorage = window.localStorage || {};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
localStorage = {};
|
||||
}
|
||||
|
||||
var fixURL = function (url) {
|
||||
var mark = (url.indexOf('?') !== -1) ? '&' : '?';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(function () {
|
||||
define(['json.sortify'], function (Sortify) {
|
||||
var module = {};
|
||||
|
||||
module.create = function (info, onLocal, Cryptget, Cryptpad) {
|
||||
@@ -15,6 +15,7 @@ define(function () {
|
||||
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
||||
var appType = parsed ? parsed.type : undefined;
|
||||
|
||||
var oldUserData = {};
|
||||
var addToUserData = exp.addToUserData = function(data) {
|
||||
var users = userList.users;
|
||||
for (var attrname in data) { userData[attrname] = data[attrname]; }
|
||||
@@ -28,6 +29,10 @@ define(function () {
|
||||
}
|
||||
|
||||
if(userList && typeof userList.onChange === "function") {
|
||||
// Make sure we don't update the userlist everytime someone makes a change to the pad
|
||||
if (Sortify(oldUserData) === Sortify(userData)) { return; }
|
||||
oldUserData = JSON.parse(JSON.stringify(userData));
|
||||
|
||||
userList.onChange(userData);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1794,12 +1794,15 @@ define([
|
||||
};
|
||||
var $userAdmin = createDropdown(dropdownConfigUser);
|
||||
|
||||
var oldUrl;
|
||||
if (account && !config.static && store) {
|
||||
var $avatar = $userAdmin.find('.buttonTitle');
|
||||
var updateButton = function (newName) {
|
||||
var profile = store.getProfile();
|
||||
var url = profile && profile.avatar;
|
||||
|
||||
if (oldUrl === url) { return; }
|
||||
oldUrl = url;
|
||||
$avatar.html('');
|
||||
common.displayAvatar($avatar, url, newName, function ($img) {
|
||||
if ($img) {
|
||||
|
||||
@@ -18,14 +18,7 @@ define([
|
||||
if (!document.body) { return; }
|
||||
clearInterval(intr);
|
||||
document.body.appendChild(elem);
|
||||
require([
|
||||
'/customize/messages.js',
|
||||
|
||||
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||
], function (Messages) {
|
||||
document.getElementById('cp-loading-message').innerText = Messages.loading;
|
||||
});
|
||||
};
|
||||
intr = setInterval(append, 100);
|
||||
append();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([], function () {
|
||||
define(['json.sortify'], function (Sortify) {
|
||||
var UNINIT = 'uninitialized';
|
||||
var create = function (sframeChan) {
|
||||
var meta = UNINIT;
|
||||
@@ -102,7 +102,9 @@ define([], function () {
|
||||
|
||||
return Object.freeze({
|
||||
updateMetadata: function (m) {
|
||||
if (JSON.stringify(metadataObj) === JSON.stringify(m)) { return; }
|
||||
// JSON.parse(JSON.stringify()) reorders the json, so we have to use sortify even
|
||||
// if it's on our own computer
|
||||
if (Sortify(metadataLazyObj) === Sortify(m)) { return; }
|
||||
metadataObj = JSON.parse(JSON.stringify(m));
|
||||
metadataLazyObj = JSON.parse(JSON.stringify(m));
|
||||
change(false);
|
||||
|
||||
@@ -1,30 +1,40 @@
|
||||
// Stage 0, this gets cached which means we can't change it. boot2-sframe.js is changable.
|
||||
// Note that this file is meant to be executed only inside of a sandbox iframe.
|
||||
;(function () {
|
||||
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
|
||||
req.cfg = req.cfg || {};
|
||||
if (req.pfx) {
|
||||
req.cfg.onNodeCreated = function (node /*, config, module, path*/) {
|
||||
node.setAttribute('src', req.pfx + node.getAttribute('src'));
|
||||
var afterLoaded = function (req) {
|
||||
req.cfg = req.cfg || {};
|
||||
if (req.pfx) {
|
||||
req.cfg.onNodeCreated = function (node /*, config, module, path*/) {
|
||||
node.setAttribute('src', req.pfx + node.getAttribute('src'));
|
||||
};
|
||||
}
|
||||
require.config(req.cfg);
|
||||
var txid = Math.random().toString(16).replace('0.', '');
|
||||
var intr;
|
||||
var ready = function () {
|
||||
intr = setInterval(function () {
|
||||
if (typeof(txid) !== 'string') { return; }
|
||||
window.parent.postMessage(JSON.stringify({ q: 'READY', txid: txid }), '*');
|
||||
}, 1);
|
||||
};
|
||||
}
|
||||
require.config(req.cfg);
|
||||
var txid = Math.random().toString(16).replace('0.', '');
|
||||
var intr;
|
||||
var ready = function () {
|
||||
intr = setInterval(function () {
|
||||
if (typeof(txid) !== 'string') { return; }
|
||||
window.parent.postMessage(JSON.stringify({ q: 'READY', txid: txid }), '*');
|
||||
}, 1);
|
||||
if (req.req) { require(req.req, ready); } else { ready(); }
|
||||
var onReply = function (msg) {
|
||||
var data = JSON.parse(msg.data);
|
||||
if (data.txid !== txid) { return; }
|
||||
clearInterval(intr);
|
||||
txid = {};
|
||||
window.removeEventListener('message', onReply);
|
||||
require(['/common/sframe-boot2.js'], function () { });
|
||||
};
|
||||
window.addEventListener('message', onReply);
|
||||
};
|
||||
if (req.req) { require(req.req, ready); } else { ready(); }
|
||||
var onReply = function (msg) {
|
||||
var data = JSON.parse(msg.data);
|
||||
if (data.txid !== txid) { return; }
|
||||
clearInterval(intr);
|
||||
txid = {};
|
||||
window.removeEventListener('message', onReply);
|
||||
require(['/common/sframe-boot2.js'], function () { });
|
||||
};
|
||||
window.addEventListener('message', onReply);
|
||||
|
||||
var intr = setInterval(function () {
|
||||
try {
|
||||
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
|
||||
clearInterval(intr);
|
||||
afterLoaded(req);
|
||||
} catch (e) { console.error(e); }
|
||||
}, 100);
|
||||
|
||||
}());
|
||||
|
||||
@@ -208,15 +208,17 @@ define([
|
||||
var $displayName = $userAdmin.find('.'+displayNameCls);
|
||||
|
||||
var $avatar = $userAdmin.find('.buttonTitle');
|
||||
var oldUrl;
|
||||
var updateButton = function () {
|
||||
var myData = metadataMgr.getUserData();
|
||||
if (!myData) { return; }
|
||||
var newName = myData.name;
|
||||
var url = myData.avatar;
|
||||
$displayName.text(newName || Messages.anonymous);
|
||||
if (accountName) {
|
||||
if (accountName && oldUrl !== url) {
|
||||
$avatar.html('');
|
||||
UI.displayAvatar(Common, $avatar, url, newName, function ($img) {
|
||||
oldUrl = url;
|
||||
if ($img) {
|
||||
$userAdmin.find('button').addClass('avatar');
|
||||
}
|
||||
|
||||
@@ -188,7 +188,6 @@ define([
|
||||
var $editUsersList = $('<div>', {'class': 'userlist-others'});
|
||||
|
||||
// Editors
|
||||
// TODO iframe enable friends
|
||||
var pendingFriends = Common.getPendingFriends();
|
||||
editUsersNames.forEach(function (data) {
|
||||
var name = data.name || Messages.anonymous;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html class="cp pad">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<script async data-bootload="/pad/inner.js" data-main="/common/sframe-boot.js?ver=1.1" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<script async data-bootload="/pad/inner.js" data-main="/common/sframe-boot.js?ver=1.2" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0px;
|
||||
|
||||
@@ -773,11 +773,18 @@ define([
|
||||
}
|
||||
// Used in ckeditor-config.js
|
||||
Ckeditor.CRYPTPAD_URLARGS = ApiConfig.requireConf.urlArgs;
|
||||
editor = Ckeditor.replace('editor1', {
|
||||
module.ckeditor = editor = Ckeditor.replace('editor1', {
|
||||
customConfig: '/customize/ckeditor-config.js',
|
||||
});
|
||||
editor.on('instanceReady', waitFor());
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
/*if (Ckeditor.env.safari) {
|
||||
var fixIframe = function () {
|
||||
$('iframe.cke_wysiwyg_frame').height($('#cke_1_contents').height());
|
||||
};
|
||||
$(window).resize(fixIframe);
|
||||
fixIframe();
|
||||
}*/
|
||||
Links.addSupportForOpeningLinksInNewTab(Ckeditor)({editor: editor});
|
||||
Cryptpad.onError(function (info) {
|
||||
if (info && info.type === "store") {
|
||||
|
||||
@@ -176,7 +176,8 @@ define([
|
||||
|
||||
var $inputBlock = $('<div>', {
|
||||
'class': 'inputBlock',
|
||||
}).appendTo($div);
|
||||
}).css('flex-flow', 'column')
|
||||
.appendTo($div);
|
||||
|
||||
var $input = $('<input>', {
|
||||
type: 'checkbox',
|
||||
@@ -186,16 +187,9 @@ define([
|
||||
proxy[key] = val;
|
||||
}).appendTo($inputBlock);
|
||||
|
||||
proxy.on('change', [key], function (o, n) { $input.val(n); });
|
||||
$input[0].checked = !!proxy[key];
|
||||
proxy.on('change', [key], function (o, n) { $input[0].checked = !!n; });
|
||||
|
||||
Cryptpad.getAttribute('indentUnit', function (e, val) {
|
||||
if (e) { return void console.error(e); }
|
||||
if (typeof(val) !== 'number') {
|
||||
$input.val(2);
|
||||
} else {
|
||||
$input.val(val);
|
||||
}
|
||||
});
|
||||
return $div;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user