resolve merge conflicts

This commit is contained in:
ansuz
2017-11-23 16:56:49 +01:00
88 changed files with 2238 additions and 8645 deletions

View File

@@ -1,7 +1,6 @@
define([
'jquery',
'/common/toolbar3.js',
'/common/cryptpad-common.js',
'/common/common-util.js',
'/common/cryptget.js',
'/bower_components/nthen/index.js',
@@ -13,9 +12,10 @@ define([
'/poll/render.js',
'/common/diffMarked.js',
'/common/sframe-common-codemirror.js',
'/common/sframe-common-interface.js',
'/common/common-thumbnail.js',
'/bower_components/chainpad/chainpad.dist.js',
'/common/common-interface.js',
'/customize/messages.js',
'cm/lib/codemirror',
'cm/addon/display/placeholder',
@@ -30,7 +30,6 @@ define([
], function (
$,
Toolbar,
Cryptpad,
Util,
Cryptget,
nThen,
@@ -42,12 +41,12 @@ define([
Renderer,
DiffMd,
SframeCM,
SFUI,
Thumb,
ChainPad,
UI,
Messages,
CMeditor)
{
var Messages = Cryptpad.Messages;
var saveAs = window.saveAs;
var APP = window.APP = {
@@ -56,10 +55,9 @@ define([
col: []
},
readOnly: false,
Cryptpad: Cryptpad,
mobile: function () { return $('body').width() <= 600; } // Menu and content area are not inline-block anymore for mobiles
};
var Render = Renderer(Cryptpad, APP);
var Render = Renderer(APP);
var debug = $.noop; //console.log;
@@ -117,8 +115,8 @@ define([
var exportFile = function () {
var csv = getCSV();
var suggestion = Title.suggestTitle(Title.defaultTitle);
Cryptpad.prompt(Messages.exportPrompt,
Cryptpad.fixFileName(suggestion) + '.csv', function (filename) {
UI.prompt(Messages.exportPrompt,
Util.fixFileName(suggestion) + '.csv', function (filename) {
if (!(typeof(filename) === 'string' && filename)) { return; }
var blob = new Blob([csv], {type: "application/csv;charset=utf-8"});
saveAs(blob, filename);
@@ -331,7 +329,7 @@ define([
/* Any time the realtime object changes, call this function */
var change = function (o, n, path, throttle, cb) {
if (path && !Cryptpad.isArray(path)) {
if (path && !Array.isArray(path)) {
return;
}
if (path && path.join) {
@@ -494,7 +492,7 @@ define([
var isLocked = span.className && span.className.split(' ').indexOf('fa-lock') !== -1;
if (type === 'row') {
if (isRemove) {
Cryptpad.confirm(Messages.poll_removeOption, function (res) {
UI.confirm(Messages.poll_removeOption, function (res) {
if (!res) { return; }
Render.removeRow(APP.proxy, id, function () {
change();
@@ -507,7 +505,7 @@ define([
}
} else if (type === 'col') {
if (isRemove) {
Cryptpad.confirm(Messages.poll_removeUser, function (res) {
UI.confirm(Messages.poll_removeUser, function (res) {
if (!res) { return; }
Render.removeColumn(APP.proxy, id, function () {
change();
@@ -883,7 +881,7 @@ define([
(proxy.metadata && typeof(proxy.metadata.type) !== 'undefined' &&
proxy.metadata.type !== 'poll')) {
var errorText = Messages.typeError;
Cryptpad.errorLoadingScreen(errorText);
UI.errorLoadingScreen(errorText);
throw new Error(errorText);
}
} else {
@@ -1042,7 +1040,7 @@ define([
publish(true);
}
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
if (isNew) {
common.openTemplatePicker();
}
@@ -1050,12 +1048,12 @@ define([
var onDisconnect = function () {
setEditable(false);
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
UI.alert(Messages.common_connectionLost, undefined, true);
};
var onReconnect = function () {
setEditable(true);
Cryptpad.findOKButton().click();
UI.findOKButton().click();
};
var getHeadingText = function () {
@@ -1081,7 +1079,6 @@ define([
metadataMgr: metadataMgr,
readOnly: APP.readOnly,
realtime: info.realtime,
common: Cryptpad,
sfCommon: common,
$container: APP.$bar,
$contentContainer: APP.$content
@@ -1162,7 +1159,7 @@ define([
nThen(function (waitFor) {
$(waitFor(function () {
Cryptpad.addLoadingScreen();
UI.addLoadingScreen();
var $div = $('<div>').append(Pages['/poll/']());
$('body').append($div.html());
}));

View File

@@ -1,12 +1,13 @@
define([
//'/common/cryptpad-common.js',
'jquery',
'/bower_components/hyperjson/hyperjson.js',
'/common/text-cursor.js',
'/bower_components/chainpad/chainpad.dist.js',
'/common/common-util.js',
'/customize/messages.js',
'/bower_components/diff-dom/diffDOM.js'
], function ($, Hyperjson, TextCursor, ChainPad) {
], function ($, Hyperjson, TextCursor, ChainPad, Util, Messages) {
var DiffDOM = window.diffDOM;
var Example = {
@@ -33,7 +34,7 @@ by maintaining indexes in rowsOrder and colsOrder
}
};
var Renderer = function (Cryptpad, APP) {
var Renderer = function (APP) {
var Render = {
Example: Example
@@ -66,15 +67,15 @@ var Renderer = function (Cryptpad, APP) {
};
var getColumnValue = Render.getColumnValue = function (obj, colId) {
return Cryptpad.find(obj, ['content', 'cols'].concat([colId]));
return Util.find(obj, ['content', 'cols'].concat([colId]));
};
var getRowValue = Render.getRowValue = function (obj, rowId) {
return Cryptpad.find(obj, ['content', 'rows'].concat([rowId]));
return Util.find(obj, ['content', 'rows'].concat([rowId]));
};
var getCellValue = Render.getCellValue = function (obj, cellId) {
var value = Cryptpad.find(obj, ['content', 'cells'].concat([cellId]));
var value = Util.find(obj, ['content', 'cells'].concat([cellId]));
if (typeof value === 'boolean') {
return (value === true ? 1 : 0);
} else {
@@ -83,25 +84,25 @@ var Renderer = function (Cryptpad, APP) {
};
var setRowValue = Render.setRowValue = function (obj, rowId, value) {
var parent = Cryptpad.find(obj, ['content', 'rows']);
var parent = Util.find(obj, ['content', 'rows']);
if (typeof(parent) === 'object') { return (parent[rowId] = value); }
return null;
};
var setColumnValue = Render.setColumnValue = function (obj, colId, value) {
var parent = Cryptpad.find(obj, ['content', 'cols']);
var parent = Util.find(obj, ['content', 'cols']);
if (typeof(parent) === 'object') { return (parent[colId] = value); }
return null;
};
var setCellValue = Render.setCellValue = function (obj, cellId, value) {
var parent = Cryptpad.find(obj, ['content', 'cells']);
var parent = Util.find(obj, ['content', 'cells']);
if (typeof(parent) === 'object') { return (parent[cellId] = value); }
return null;
};
Render.createColumn = function (obj, cb, id, value) {
var order = Cryptpad.find(obj, ['content', 'colsOrder']);
var order = Util.find(obj, ['content', 'colsOrder']);
if (!order) { throw new Error("Uninitialized realtime object!"); }
id = id || coluid();
value = value || "";
@@ -111,8 +112,8 @@ var Renderer = function (Cryptpad, APP) {
};
Render.removeColumn = function (obj, id, cb) {
var order = Cryptpad.find(obj, ['content', 'colsOrder']);
var parent = Cryptpad.find(obj, ['content', 'cols']);
var order = Util.find(obj, ['content', 'colsOrder']);
var parent = Util.find(obj, ['content', 'cols']);
if (!(order && parent)) { throw new Error("Uninitialized realtime object!"); }
@@ -136,7 +137,7 @@ var Renderer = function (Cryptpad, APP) {
};
Render.createRow = function (obj, cb, id, value) {
var order = Cryptpad.find(obj, ['content', 'rowsOrder']);
var order = Util.find(obj, ['content', 'rowsOrder']);
if (!order) { throw new Error("Uninitialized realtime object!"); }
id = id || rowuid();
value = value || "";
@@ -146,8 +147,8 @@ var Renderer = function (Cryptpad, APP) {
};
Render.removeRow = function (obj, id, cb) {
var order = Cryptpad.find(obj, ['content', 'rowsOrder']);
var parent = Cryptpad.find(obj, ['content', 'rows']);
var order = Util.find(obj, ['content', 'rowsOrder']);
var parent = Util.find(obj, ['content', 'rows']);
if (!(order && parent)) { throw new Error("Uninitialized realtime object!"); }
@@ -187,15 +188,15 @@ var Renderer = function (Cryptpad, APP) {
};
var getRowIds = Render.getRowIds = function (obj) {
return Cryptpad.find(obj, ['content', 'rowsOrder']);
return Util.find(obj, ['content', 'rowsOrder']);
};
var getColIds = Render.getColIds = function (obj) {
return Cryptpad.find(obj, ['content', 'colsOrder']);
return Util.find(obj, ['content', 'colsOrder']);
};
var getCells = Render.getCells = function (obj) {
return Cryptpad.find(obj, ['content', 'cells']);
return Util.find(obj, ['content', 'cells']);
};
/* cellMatrix takes a proxy object, and optionally an alternate ordering
@@ -221,13 +222,13 @@ var Renderer = function (Cryptpad, APP) {
'data-rt-id': col,
type: 'text',
value: getColumnValue(obj, col) || "",
title: getColumnValue(obj, col) || Cryptpad.Messages.anonymous,
placeholder: Cryptpad.Messages.anonymous,
title: getColumnValue(obj, col) || Messages.anonymous,
placeholder: Messages.anonymous,
disabled: 'disabled'
};
return result;
})).concat([{
content: Cryptpad.Messages.poll_total
content: Messages.poll_total
}]);
}
if (i === rows.length) {
@@ -241,9 +242,9 @@ var Renderer = function (Cryptpad, APP) {
return [{
'data-rt-id': row,
value: getRowValue(obj, row) || '',
title: getRowValue(obj, row) || Cryptpad.Messages.poll_optionPlaceholder,
title: getRowValue(obj, row) || Messages.poll_optionPlaceholder,
type: 'text',
placeholder: Cryptpad.Messages.poll_optionPlaceholder,
placeholder: Messages.poll_optionPlaceholder,
disabled: 'disabled',
}].concat(cols.map(function (col) {
var id = [col, rows[i-1]].join('_');
@@ -271,7 +272,7 @@ var Renderer = function (Cryptpad, APP) {
var makeRemoveElement = Render.makeRemoveElement = function (id) {
return ['SPAN', {
'data-rt-id': id,
'title': Cryptpad.Messages.poll_remove,
'title': Messages.poll_remove,
class: 'cp-app-poll-table-remove',
}, ['✖']];
};
@@ -279,7 +280,7 @@ var Renderer = function (Cryptpad, APP) {
var makeEditElement = Render.makeEditElement = function (id) {
return ['SPAN', {
'data-rt-id': id,
'title': Cryptpad.Messages.poll_edit,
'title': Messages.poll_edit,
class: 'cp-app-poll-table-edit',
}, ['✐']];
};
@@ -287,7 +288,7 @@ var Renderer = function (Cryptpad, APP) {
var makeLockElement = Render.makeLockElement = function (id) {
return ['SPAN', {
'data-rt-id': id,
'title': Cryptpad.Messages.poll_locked,
'title': Messages.poll_locked,
class: 'cp-app-poll-table-lock fa fa-lock',
}, []];
};
@@ -295,7 +296,7 @@ var Renderer = function (Cryptpad, APP) {
var makeBookmarkElement = Render.makeBookmarkElement = function (id) {
return ['SPAN', {
'data-rt-id': id,
'title': Cryptpad.Messages.poll_bookmark_col,
'title': Messages.poll_bookmark_col,
'style': 'visibility: hidden;',
class: 'cp-app-poll-table-bookmark fa fa-thumb-tack',
}, []];
@@ -385,13 +386,13 @@ var Renderer = function (Cryptpad, APP) {
};
var diffIsInput = Render.diffIsInput = function (info) {
var nodeName = Cryptpad.find(info, ['node', 'nodeName']);
var nodeName = Util.find(info, ['node', 'nodeName']);
if (nodeName !== 'INPUT') { return; }
return true;
};
var getInputType = Render.getInputType = function (info) {
return Cryptpad.find(info, ['node', 'type']);
return Util.find(info, ['node', 'type']);
};
var preserveCursor = Render.preserveCursor = function (info) {
@@ -426,6 +427,10 @@ var Renderer = function (Cryptpad, APP) {
var diffOptions = {
preDiffApply: function (info) {
if (!diffIsInput(info)) { return; }
if (info.diff.action === "removeAttribute" &&
(info.diff.name === "aria-describedby" || info.diff.name === "data-original-title")) {
return;
}
switch (getInputType(info)) {
case 'number':
//console.log('checkbox');
@@ -459,14 +464,14 @@ var Renderer = function (Cryptpad, APP) {
// Enable input for the userid column
APP.enableColumn(userid, table);
$(table).find('input[disabled="disabled"][data-rt-id^="' + userid + '"]')
.attr('placeholder', Cryptpad.Messages.poll_userPlaceholder);
.attr('placeholder', Messages.poll_userPlaceholder);
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + userid + '"]').remove();
$(table).find('[data-rt-id^="' + userid + '"]').closest('td')
.addClass("cp-app-poll-table-own");
$(table).find('.cp-app-poll-table-bookmark[data-rt-id="' + userid + '"]')
.css('visibility', '')
.addClass('cp-app-poll-table-bookmark-full')
.attr('title', Cryptpad.Messages.poll_bookmarked_col);
.attr('title', Messages.poll_bookmarked_col);
};
var styleUncommittedColumn = function (table) {
APP.uncommitted.content.colsOrder.forEach(function(id) {