|
|
@ -61,6 +61,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var andThen = function (common) {
|
|
|
|
var andThen = function (common) {
|
|
|
|
|
|
|
|
var config = {};
|
|
|
|
/* Initialize Fabric */
|
|
|
|
/* Initialize Fabric */
|
|
|
|
var canvas = APP.canvas = new Fabric.Canvas('cp-app-whiteboard-canvas', {
|
|
|
|
var canvas = APP.canvas = new Fabric.Canvas('cp-app-whiteboard-canvas', {
|
|
|
|
containerClass: 'cp-app-whiteboard-canvas-container'
|
|
|
|
containerClass: 'cp-app-whiteboard-canvas-container'
|
|
|
@ -81,6 +82,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// Brush
|
|
|
|
// Brush
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var readOnly = false;
|
|
|
|
var brush = {
|
|
|
|
var brush = {
|
|
|
|
color: '#000000',
|
|
|
|
color: '#000000',
|
|
|
|
opacity: 1
|
|
|
|
opacity: 1
|
|
|
@ -195,7 +197,7 @@ define([
|
|
|
|
canvas.discardActiveGroup();
|
|
|
|
canvas.discardActiveGroup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
canvas.renderAll();
|
|
|
|
canvas.renderAll();
|
|
|
|
APP.onLocal();
|
|
|
|
config.onLocal();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$deleteButton.click(deleteSelection);
|
|
|
|
$deleteButton.click(deleteSelection);
|
|
|
|
$(window).on('keyup', function (e) {
|
|
|
|
$(window).on('keyup', function (e) {
|
|
|
@ -250,9 +252,8 @@ define([
|
|
|
|
var Title;
|
|
|
|
var Title;
|
|
|
|
var cpNfInner;
|
|
|
|
var cpNfInner;
|
|
|
|
var metadataMgr;
|
|
|
|
var metadataMgr;
|
|
|
|
var readOnly = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var config = {
|
|
|
|
config = {
|
|
|
|
readOnly: readOnly,
|
|
|
|
readOnly: readOnly,
|
|
|
|
transformFunction: JsonOT.validate,
|
|
|
|
transformFunction: JsonOT.validate,
|
|
|
|
// cryptpad debug logging (default is 1)
|
|
|
|
// cryptpad debug logging (default is 1)
|
|
|
@ -287,7 +288,7 @@ define([
|
|
|
|
'background-color': c,
|
|
|
|
'background-color': c,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
palette.splice(i, 1, c);
|
|
|
|
palette.splice(i, 1, c);
|
|
|
|
config.onLocal();
|
|
|
|
APP.updateLocalPalette(palette);
|
|
|
|
setColor(c);
|
|
|
|
setColor(c);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -304,14 +305,13 @@ define([
|
|
|
|
first = false;
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var updateLocalPalette = function (newPalette) {
|
|
|
|
var updateLocalPalette = APP.updateLocalPalette = function (newPalette) {
|
|
|
|
updatePalette(newPalette);
|
|
|
|
updatePalette(newPalette);
|
|
|
|
var metadata = JSON.parse(JSON.stringify(metadataMgr.getMetadata()));
|
|
|
|
var metadata = JSON.parse(JSON.stringify(metadataMgr.getMetadata()));
|
|
|
|
metadata.palette = newPalette;
|
|
|
|
metadata.palette = newPalette;
|
|
|
|
metadataMgr.updateMetadata(metadata);
|
|
|
|
metadataMgr.updateMetadata(metadata);
|
|
|
|
onLocal();
|
|
|
|
config.onLocal();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
updatePalette(palette);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var makeColorButton = function ($container) {
|
|
|
|
var makeColorButton = function ($container) {
|
|
|
|
var $testColor = $('<input>', { type: 'color', value: '!' });
|
|
|
|
var $testColor = $('<input>', { type: 'color', value: '!' });
|
|
|
@ -360,6 +360,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
config.onInit = function (info) {
|
|
|
|
config.onInit = function (info) {
|
|
|
|
|
|
|
|
updateLocalPalette(palette);
|
|
|
|
readOnly = metadataMgr.getPrivateData().readOnly;
|
|
|
|
readOnly = metadataMgr.getPrivateData().readOnly;
|
|
|
|
|
|
|
|
|
|
|
|
Title = common.createTitle({}, config.onLocal);
|
|
|
|
Title = common.createTitle({}, config.onLocal);
|
|
|
@ -379,7 +380,6 @@ define([
|
|
|
|
Title.setToolbar(toolbar);
|
|
|
|
Title.setToolbar(toolbar);
|
|
|
|
|
|
|
|
|
|
|
|
var $rightside = toolbar.$rightside;
|
|
|
|
var $rightside = toolbar.$rightside;
|
|
|
|
var $drawer = toolbar.$drawer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* save as template */
|
|
|
|
/* save as template */
|
|
|
|
if (!metadataMgr.getPrivateData().isTemplate) {
|
|
|
|
if (!metadataMgr.getPrivateData().isTemplate) {
|
|
|
@ -417,7 +417,7 @@ define([
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
if (md.palette) {
|
|
|
|
if (md.palette) {
|
|
|
|
updatePalette(md.palette);
|
|
|
|
updateLocalPalette(md.palette);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -435,7 +435,6 @@ define([
|
|
|
|
var isNew = false;
|
|
|
|
var isNew = false;
|
|
|
|
if (userDoc === "" || userDoc === "{}") { isNew = true; }
|
|
|
|
if (userDoc === "" || userDoc === "{}") { isNew = true; }
|
|
|
|
|
|
|
|
|
|
|
|
var newDoc = "";
|
|
|
|
|
|
|
|
if (userDoc !== "") {
|
|
|
|
if (userDoc !== "") {
|
|
|
|
var hjson = JSON.parse(userDoc);
|
|
|
|
var hjson = JSON.parse(userDoc);
|
|
|
|
|
|
|
|
|
|
|
|