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,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) {