manual merge of staging into framework
This commit is contained in:
@@ -40,7 +40,7 @@ The CSS inside of loading.js is precompiled in order to save 200ish milliseconds
|
|||||||
}
|
}
|
||||||
#cp-loading-tip {
|
#cp-loading-tip {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100000; // loading tip
|
z-index: 10000000; // loading tip
|
||||||
top: 80%;
|
top: 80%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ define([], function () {
|
|||||||
}
|
}
|
||||||
#cp-loading-tip {
|
#cp-loading-tip {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100000;
|
z-index: 10000000;
|
||||||
top: 80%;
|
top: 80%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@@ -7,41 +7,13 @@ define([], function () {
|
|||||||
return function (userObject, Cryptpad) {
|
return function (userObject, Cryptpad) {
|
||||||
var version = userObject.version || 0;
|
var version = userObject.version || 0;
|
||||||
|
|
||||||
|
// DEPRECATED
|
||||||
// Migration 1: pad attributes moved to filesData
|
// Migration 1: pad attributes moved to filesData
|
||||||
var migratePadAttributesToData = function () {
|
var migratePadAttributesToData = function () {
|
||||||
var files = userObject && userObject.drive;
|
return true;
|
||||||
if (!files) { return; }
|
|
||||||
|
|
||||||
var migratePadAttributes = function (el, id, parsed) {
|
|
||||||
// Migrate old pad attributes
|
|
||||||
['userid', 'previewMode'].forEach(function (attr) {
|
|
||||||
var key = parsed.hash + '.' + attr;
|
|
||||||
var key2 = parsed.hash.slice(0,-1) + '.' + attr;// old pads not ending with /
|
|
||||||
if (typeof(files[key]) !== "undefined" || typeof(files[key2]) !== "undefined") {
|
|
||||||
console.log("Migrating pad attribute", attr, "for pad", id);
|
|
||||||
el[attr] = files[key] || files[key2];
|
|
||||||
delete files[key];
|
|
||||||
delete files[key2];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var filesData = files.filesData;
|
|
||||||
if (!filesData) { return; }
|
|
||||||
|
|
||||||
var el, parsed;
|
|
||||||
for (var id in filesData) {
|
|
||||||
id = Number(id);
|
|
||||||
el = filesData[id];
|
|
||||||
parsed = el.href && Cryptpad.parsePadUrl(el.href);
|
|
||||||
if (!parsed) { continue; }
|
|
||||||
migratePadAttributes(el, id, parsed);
|
|
||||||
}
|
|
||||||
// Migration done
|
|
||||||
};
|
};
|
||||||
if (version < 1) {
|
if (version < 1) {
|
||||||
migratePadAttributesToData();
|
migratePadAttributesToData();
|
||||||
Cryptpad.feedback('Migrate-1', true);
|
|
||||||
userObject.version = version = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migration 2: global attributes from root to 'settings' subobjects
|
// Migration 2: global attributes from root to 'settings' subobjects
|
||||||
|
|||||||
@@ -155,7 +155,9 @@ define([], function () {
|
|||||||
// Do not remove wcObject, it allows us to use a new 'wc' without changing the handler if we
|
// Do not remove wcObject, it allows us to use a new 'wc' without changing the handler if we
|
||||||
// want to keep the same chainpad (realtime) object
|
// want to keep the same chainpad (realtime) object
|
||||||
try {
|
try {
|
||||||
|
if (window.Cryptpad_SUPPRESS_MSG) { return; }
|
||||||
wcObject.wc.bcast(message).then(function() {
|
wcObject.wc.bcast(message).then(function() {
|
||||||
|
if (window.Cryptpad_SUPPRESS_ACK) { return; }
|
||||||
cb();
|
cb();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
// The message has not been sent, display the error.
|
// The message has not been sent, display the error.
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ define([
|
|||||||
}, "DRIVE4: migration and fixFiles with a pad in trash not root");
|
}, "DRIVE4: migration and fixFiles with a pad in trash not root");
|
||||||
|
|
||||||
// Pad attributes migration
|
// Pad attributes migration
|
||||||
|
/*
|
||||||
assert(function (cb) {
|
assert(function (cb) {
|
||||||
console.log('START PAD ATTRIBUTES');
|
console.log('START PAD ATTRIBUTES');
|
||||||
var files = JSON.parse(JSON.stringify(example));
|
var files = JSON.parse(JSON.stringify(example));
|
||||||
@@ -253,6 +254,7 @@ define([
|
|||||||
return cb(files.filesData[id1].userid === 'value'
|
return cb(files.filesData[id1].userid === 'value'
|
||||||
&& files.filesData[id1].previewMode);
|
&& files.filesData[id1].previewMode);
|
||||||
}, "PAD ATTRIBUTES");
|
}, "PAD ATTRIBUTES");
|
||||||
|
*/
|
||||||
|
|
||||||
// userObject Tests
|
// userObject Tests
|
||||||
|
|
||||||
|
|||||||
@@ -365,11 +365,9 @@ define([
|
|||||||
|
|
||||||
var mediaMap = {};
|
var mediaMap = {};
|
||||||
var restoreMediaTags = function (tempDom) {
|
var restoreMediaTags = function (tempDom) {
|
||||||
var pattern = /(<media-tag contenteditable="false" data-crypto-key="([^"]*)" src="([^"]*)" tabindex="1">)<\/media-tag>/i;
|
|
||||||
var tags = tempDom.querySelectorAll('media-tag:empty');
|
var tags = tempDom.querySelectorAll('media-tag:empty');
|
||||||
Array.prototype.slice.call(tags).forEach(function (tag) {
|
Array.prototype.slice.call(tags).forEach(function (tag) {
|
||||||
if (pattern.length !== 4) { return; }
|
var src = tag.getAttribute('src');
|
||||||
var src = pattern[3];
|
|
||||||
if (mediaMap[src]) {
|
if (mediaMap[src]) {
|
||||||
mediaMap[src].forEach(function (n) {
|
mediaMap[src].forEach(function (n) {
|
||||||
tag.appendChild(n);
|
tag.appendChild(n);
|
||||||
|
|||||||
@@ -433,6 +433,7 @@ define([
|
|||||||
|
|
||||||
var userDoc = APP.realtime.getUserDoc();
|
var userDoc = APP.realtime.getUserDoc();
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
|
var newDoc = '';
|
||||||
if (userDoc === "" || userDoc === "{}") { isNew = true; }
|
if (userDoc === "" || userDoc === "{}") { isNew = true; }
|
||||||
|
|
||||||
if (userDoc !== "") {
|
if (userDoc !== "") {
|
||||||
@@ -448,15 +449,19 @@ define([
|
|||||||
Cryptpad.errorLoadingScreen(errorText);
|
Cryptpad.errorLoadingScreen(errorText);
|
||||||
throw new Error(errorText);
|
throw new Error(errorText);
|
||||||
}
|
}
|
||||||
|
newDoc = hjson.content;
|
||||||
} else {
|
} else {
|
||||||
Title.updateTitle(Cryptpad.initialName || Title.defaultTitle);
|
Title.updateTitle(Cryptpad.initialName || Title.defaultTitle);
|
||||||
}
|
}
|
||||||
|
if (newDoc) {
|
||||||
|
canvas.loadFromJSON(newDoc);
|
||||||
|
canvas.renderAll();
|
||||||
|
}
|
||||||
|
|
||||||
Cryptpad.removeLoadingScreen();
|
|
||||||
setEditable(!readOnly);
|
setEditable(!readOnly);
|
||||||
initializing = false;
|
initializing = false;
|
||||||
config.onLocal();
|
config.onLocal();
|
||||||
|
Cryptpad.removeLoadingScreen();
|
||||||
if (readOnly) { return; }
|
if (readOnly) { return; }
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
common.openTemplatePicker();
|
common.openTemplatePicker();
|
||||||
@@ -516,7 +521,7 @@ define([
|
|||||||
|
|
||||||
canvas.on('mouse:up', onLocal);
|
canvas.on('mouse:up', onLocal);
|
||||||
|
|
||||||
$('#clear').on('click', function () {
|
$('#cp-app-whiteboard-clear').on('click', function () {
|
||||||
canvas.clear();
|
canvas.clear();
|
||||||
onLocal();
|
onLocal();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user