solid-ui 2.4.27 → 2.4.28-11faa597
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/670.solid-ui.min.js +1 -0
- package/dist/805.solid-ui.min.js +3 -0
- package/dist/805.solid-ui.min.js.LICENSE.txt +58 -0
- package/dist/805.solid-ui.min.js.map +1 -0
- package/dist/_2b19.solid-ui.js +14 -0
- package/dist/_2b19.solid-ui.js.map +1 -0
- package/dist/index.html +1 -9
- package/dist/{main.js → solid-ui.js} +9676 -21517
- package/dist/solid-ui.js.map +1 -0
- package/dist/solid-ui.min.js +3 -0
- package/dist/solid-ui.min.js.LICENSE.txt +54 -0
- package/dist/solid-ui.min.js.map +1 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +12134 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -0
- package/lib/acl/access-controller.d.ts +2 -3
- package/lib/acl/access-controller.d.ts.map +1 -1
- package/lib/acl/access-controller.js +17 -15
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.d.ts.map +1 -1
- package/lib/acl/access-groups.js +78 -8
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.d.ts.map +1 -1
- package/lib/acl/acl-control.js +10 -11
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -1
- package/lib/acl/acl.js +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.d.ts.map +1 -1
- package/lib/acl/add-agent-buttons.js +4 -3
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +288 -67
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +129 -126
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +637 -423
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/keys.d.ts +13 -0
- package/lib/chat/keys.d.ts.map +1 -0
- package/lib/chat/keys.js +233 -0
- package/lib/chat/keys.js.map +1 -0
- package/lib/chat/message.js +361 -163
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +463 -277
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/signature.d.ts +24 -0
- package/lib/chat/signature.d.ts.map +1 -0
- package/lib/chat/signature.js +112 -0
- package/lib/chat/signature.js.map +1 -0
- package/lib/chat/thread.js +299 -209
- package/lib/chat/thread.js.map +1 -1
- package/lib/footer/index.d.ts.map +1 -1
- package/lib/footer/index.js +5 -1
- package/lib/footer/index.js.map +1 -1
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +46 -20
- package/lib/header/index.js.map +1 -1
- package/lib/log.js +5 -5
- package/lib/log.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +63 -38
- package/lib/login/login.js.map +1 -1
- package/lib/pad.js +4 -1
- package/lib/pad.js.map +1 -1
- package/lib/participation.js +2 -1
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/style.js +60 -2
- package/lib/style.js.map +1 -1
- package/lib/utils/headerFooterHelpers.d.ts +0 -4
- package/lib/utils/headerFooterHelpers.d.ts.map +1 -1
- package/lib/utils/headerFooterHelpers.js +1 -26
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/keyHelpers/accessData.d.ts +9 -0
- package/lib/utils/keyHelpers/accessData.d.ts.map +1 -0
- package/lib/utils/keyHelpers/accessData.js +134 -0
- package/lib/utils/keyHelpers/accessData.js.map +1 -0
- package/lib/utils/keyHelpers/acl.d.ts +20 -0
- package/lib/utils/keyHelpers/acl.d.ts.map +1 -0
- package/lib/utils/keyHelpers/acl.js +93 -0
- package/lib/utils/keyHelpers/acl.js.map +1 -0
- package/lib/utils/keyHelpers/otherHelpers.d.ts +3 -0
- package/lib/utils/keyHelpers/otherHelpers.d.ts.map +1 -0
- package/lib/utils/keyHelpers/otherHelpers.js +23 -0
- package/lib/utils/keyHelpers/otherHelpers.js.map +1 -0
- package/lib/versionInfo.js +6 -6
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +43 -51
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +8 -3
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +5 -0
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms.js +12 -5
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/peoplePicker.js +11 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/package.json +15 -11
- package/dist/main.js.map +0 -1
- package/lib/acl/styles.d.ts +0 -90
- package/lib/acl/styles.d.ts.map +0 -1
- package/lib/acl/styles.js +0 -98
- package/lib/acl/styles.js.map +0 -1
- package/lib/footer/styleMap.d.ts +0 -8
- package/lib/footer/styleMap.d.ts.map +0 -1
- package/lib/footer/styleMap.js +0 -15
- package/lib/footer/styleMap.js.map +0 -1
- package/lib/header/styleMap.d.ts +0 -117
- package/lib/header/styleMap.d.ts.map +0 -1
- package/lib/header/styleMap.js +0 -139
- package/lib/header/styleMap.js.map +0 -1
- package/lib/jss/index.d.ts +0 -20
- package/lib/jss/index.d.ts.map +0 -1
- package/lib/jss/index.js +0 -47
- package/lib/jss/index.js.map +0 -1
package/lib/chat/message.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
12
12
|
exports.renderMessageRow = renderMessageRow;
|
|
13
13
|
exports.switchToEditor = switchToEditor;
|
|
14
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
17
|
var _infinite = require("./infinite");
|
|
17
18
|
var _messageTools = require("./messageTools");
|
|
@@ -27,17 +28,28 @@ var pad = _interopRequireWildcard(require("../pad"));
|
|
|
27
28
|
var style = _interopRequireWildcard(require("../style"));
|
|
28
29
|
var utils = _interopRequireWildcard(require("../utils"));
|
|
29
30
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
31
|
+
var _signature = require("./signature");
|
|
32
|
+
var _keys = require("./keys");
|
|
30
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
-
function
|
|
35
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
33
38
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
34
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
39
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /** UI code for individual messages: display them, edit them
|
|
40
|
+
*
|
|
41
|
+
* @packageDocumentation
|
|
42
|
+
*/ /* global $rdf */
|
|
35
43
|
var dom = window.document;
|
|
36
44
|
var messageBodyStyle = style.messageBodyStyle;
|
|
37
45
|
var label = utils.label;
|
|
38
46
|
|
|
39
47
|
/**
|
|
48
|
+
* elementForImageURI
|
|
40
49
|
* HTML component for an image
|
|
50
|
+
* @param imageUri
|
|
51
|
+
* @param options { inlineImageHeightEms }
|
|
52
|
+
* @returns HTMLAnchorElement For Image
|
|
41
53
|
*/
|
|
42
54
|
function elementForImageURI(imageUri, options) {
|
|
43
55
|
var img = dom.createElement('img');
|
|
@@ -67,21 +79,27 @@ var anchor = function anchor(text, term) {
|
|
|
67
79
|
a.textContent = text;
|
|
68
80
|
return a;
|
|
69
81
|
};
|
|
70
|
-
function
|
|
82
|
+
function nickname(person) {
|
|
71
83
|
var s = _solidLogic.store.any(person, ns.foaf('nick'));
|
|
72
84
|
if (s) return '' + s.value;
|
|
73
85
|
return '' + label(person);
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
/**
|
|
89
|
+
* creatorAndDate
|
|
77
90
|
* Displays creator and date for a chat message
|
|
78
91
|
* inside the `td1` element
|
|
92
|
+
* @param td1
|
|
93
|
+
* @param creator
|
|
94
|
+
* @param date
|
|
95
|
+
* @param message
|
|
96
|
+
* @returns HTMLAnchorElement For Image
|
|
79
97
|
*/
|
|
80
98
|
function creatorAndDate(td1, creator, date, message) {
|
|
81
|
-
var nickAnchor = td1.appendChild(anchor(
|
|
99
|
+
var nickAnchor = td1.appendChild(anchor(nickname(creator), creator));
|
|
82
100
|
if (creator.uri) {
|
|
83
101
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
84
|
-
nickAnchor.textContent =
|
|
102
|
+
nickAnchor.textContent = nickname(creator);
|
|
85
103
|
});
|
|
86
104
|
}
|
|
87
105
|
td1.appendChild(dom.createElement('br'));
|
|
@@ -89,14 +107,20 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
89
107
|
}
|
|
90
108
|
|
|
91
109
|
/**
|
|
110
|
+
* creatorAndDateHorizontal
|
|
92
111
|
* Horizontally displays creator and date for a chat message
|
|
93
112
|
* inside the `td1` element
|
|
113
|
+
* @param td1
|
|
114
|
+
* @param creator
|
|
115
|
+
* @param date
|
|
116
|
+
* @param message
|
|
117
|
+
* @returns HTMLAnchorElement For Image
|
|
94
118
|
*/
|
|
95
119
|
function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
96
120
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
97
121
|
if (creator.uri) {
|
|
98
122
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
99
|
-
nickAnchor.textContent =
|
|
123
|
+
nickAnchor.textContent = nickname(creator);
|
|
100
124
|
});
|
|
101
125
|
}
|
|
102
126
|
var dateBit = td1.appendChild(anchor(date, message));
|
|
@@ -106,124 +130,284 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
106
130
|
}
|
|
107
131
|
|
|
108
132
|
/**
|
|
133
|
+
* renderMessageRow
|
|
109
134
|
* Renders a chat message, read-only mode
|
|
135
|
+
* @param channelObject
|
|
136
|
+
* @param message
|
|
137
|
+
* @param fresh
|
|
138
|
+
* @param options
|
|
139
|
+
* @param userContext
|
|
140
|
+
* @returns Message Row HTML Table Element
|
|
110
141
|
*/
|
|
111
|
-
function renderMessageRow(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
143
|
+
return _renderMessageRow.apply(this, arguments);
|
|
144
|
+
} // END OF RENDERMESSAGE
|
|
145
|
+
function _renderMessageRow() {
|
|
146
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
147
|
+
var unsignedMessage, colorizeByAuthor, creator, date, latestVersion, latestVersionCreator, msgId, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, signature, msg, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
|
|
148
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
149
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
getBgColor = function _getBgColor(fresh) {
|
|
152
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
153
|
+
};
|
|
154
|
+
unsignedMessage = false;
|
|
155
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true; // const id = store.any(latestVersion, ns.sioc('id'))
|
|
156
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
157
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
158
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
159
|
+
_context10.next = 7;
|
|
160
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
161
|
+
case 7:
|
|
162
|
+
latestVersion = _context10.sent;
|
|
163
|
+
debug.log('@@@@ alain mostRecentVersion');
|
|
164
|
+
debug.log(message);
|
|
165
|
+
debug.log(latestVersion);
|
|
166
|
+
latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker')); // use latest content if same owner, else use original
|
|
167
|
+
// this is may be too strict. Should we find latest valid version if any ?
|
|
168
|
+
debug.log('@@@@ alain creator');
|
|
169
|
+
debug.log(creator);
|
|
170
|
+
debug.log(latestVersionCreator);
|
|
171
|
+
msgId = creator.uri === (latestVersionCreator === null || latestVersionCreator === void 0 ? void 0 : latestVersionCreator.uri) ? latestVersion : message;
|
|
172
|
+
content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
173
|
+
_context10.next = 19;
|
|
174
|
+
return (0, _chatLogic.allVersions)(msgId);
|
|
175
|
+
case 19:
|
|
176
|
+
versions = _context10.sent;
|
|
177
|
+
if (versions.length > 1) {
|
|
178
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
179
|
+
}
|
|
180
|
+
// be tolerant in accepting replies on any version of a message
|
|
181
|
+
replies = versions.map(function (version) {
|
|
182
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
183
|
+
}).flat();
|
|
184
|
+
thread = null;
|
|
185
|
+
straightReplies = [];
|
|
186
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
187
|
+
try {
|
|
188
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
189
|
+
reply = _step2.value;
|
|
190
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
191
|
+
thread = reply;
|
|
192
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
193
|
+
} else {
|
|
194
|
+
straightReplies.push(reply);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch (err) {
|
|
198
|
+
_iterator2.e(err);
|
|
199
|
+
} finally {
|
|
200
|
+
_iterator2.f();
|
|
201
|
+
}
|
|
202
|
+
if (straightReplies.length > 1) {
|
|
203
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
204
|
+
}
|
|
205
|
+
debug.log('@@@@ is thread');
|
|
206
|
+
if (!thread) {
|
|
207
|
+
// thread = store.any(message, ns.sioc('has_reply'))
|
|
208
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message);
|
|
209
|
+
}
|
|
210
|
+
// get signature
|
|
211
|
+
signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue"))); // set proof message object
|
|
212
|
+
msg = (0, _signature.getBlankMsg)();
|
|
213
|
+
msg.id = msgId.uri;
|
|
214
|
+
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
215
|
+
msg.content = content.value;
|
|
216
|
+
msg.maker = creator.uri;
|
|
138
217
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
218
|
+
// verify signature
|
|
219
|
+
if (!(signature !== null && signature !== void 0 && signature.value)) {
|
|
220
|
+
// unsigned message
|
|
221
|
+
unsignedMessage = true;
|
|
222
|
+
debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
223
|
+
} else {
|
|
224
|
+
// signed message, get public key and check signature
|
|
225
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
226
|
+
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
227
|
+
if (!publicKey) {
|
|
228
|
+
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
229
|
+
}
|
|
230
|
+
// check that publicKey is a valid hex string
|
|
231
|
+
var regex = /[0-9A-Fa-f]{6}/g;
|
|
232
|
+
if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
|
|
233
|
+
// verify signature
|
|
234
|
+
else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
_context10.next = 38;
|
|
238
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
239
|
+
case 38:
|
|
240
|
+
originalMessage = _context10.sent;
|
|
241
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
242
|
+
// @@@ kludge!
|
|
243
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
244
|
+
messageRow = dom.createElement('tr');
|
|
245
|
+
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
246
|
+
messageRow.AJAR_date = sortDate.value;
|
|
247
|
+
messageRow.AJAR_subject = message;
|
|
248
|
+
td1 = dom.createElement('td');
|
|
249
|
+
messageRow.appendChild(td1);
|
|
250
|
+
if (!options.authorDateOnLeft) {
|
|
251
|
+
img = dom.createElement('img');
|
|
252
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
253
|
+
widgets.setImage(img, creator);
|
|
254
|
+
td1.appendChild(img);
|
|
255
|
+
} else {
|
|
256
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
257
|
+
}
|
|
258
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
259
|
+
if (edited) {
|
|
260
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
261
|
+
}
|
|
175
262
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
263
|
+
// Render the content ot the message itself
|
|
264
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
265
|
+
if (!options.authorDateOnLeft) {
|
|
266
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
267
|
+
// widgets.shortDate(dateString)
|
|
268
|
+
message);
|
|
269
|
+
}
|
|
270
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
271
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
272
|
+
para = null;
|
|
273
|
+
if (isURI) {
|
|
274
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
275
|
+
if (isImage && options.expandImagesInline) {
|
|
276
|
+
_img = elementForImageURI(text, options);
|
|
277
|
+
td2.appendChild(_img);
|
|
278
|
+
} else {
|
|
279
|
+
// Link but not Image
|
|
280
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
281
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
282
|
+
anc.href = text;
|
|
283
|
+
para.textContent = text;
|
|
284
|
+
td2.appendChild(anc);
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
287
|
+
// text
|
|
288
|
+
para = dom.createElement('p');
|
|
289
|
+
td2.appendChild(para);
|
|
290
|
+
para.textContent = text;
|
|
291
|
+
}
|
|
292
|
+
if (para) {
|
|
293
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
294
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
295
|
+
}
|
|
296
|
+
_context10.next = 59;
|
|
297
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
298
|
+
case 59:
|
|
299
|
+
strip = _context10.sent;
|
|
300
|
+
if (strip.children.length) {
|
|
301
|
+
td2.appendChild(dom.createElement('br'));
|
|
302
|
+
td2.appendChild(strip);
|
|
303
|
+
}
|
|
182
304
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
305
|
+
// Message tool bar button
|
|
306
|
+
td3 = dom.createElement('td');
|
|
307
|
+
messageRow.appendChild(td3);
|
|
308
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
309
|
+
td3.appendChild(toolsButton);
|
|
310
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
311
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
312
|
+
var toolsTR, tools, toolsTD;
|
|
313
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
314
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
315
|
+
case 0:
|
|
316
|
+
if (!messageRow.toolTR) {
|
|
317
|
+
_context9.next = 4;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
// already got a toolbar? Toogle
|
|
321
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
322
|
+
delete messageRow.toolTR;
|
|
323
|
+
return _context9.abrupt("return");
|
|
324
|
+
case 4:
|
|
325
|
+
toolsTR = dom.createElement('tr');
|
|
326
|
+
_context9.next = 7;
|
|
327
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
328
|
+
chatOptions: options
|
|
329
|
+
}), channelObject);
|
|
330
|
+
case 7:
|
|
331
|
+
tools = _context9.sent;
|
|
332
|
+
tools.style = 'border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;'; // @@ fix
|
|
333
|
+
if (messageRow.nextSibling) {
|
|
334
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
335
|
+
} else {
|
|
336
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
337
|
+
}
|
|
338
|
+
messageRow.toolTR = toolsTR;
|
|
339
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
340
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
341
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
342
|
+
toolsTD.appendChild(tools);
|
|
343
|
+
case 15:
|
|
344
|
+
case "end":
|
|
345
|
+
return _context9.stop();
|
|
346
|
+
}
|
|
347
|
+
}, _callee8);
|
|
348
|
+
}));
|
|
349
|
+
return function (_x20) {
|
|
350
|
+
return _ref4.apply(this, arguments);
|
|
351
|
+
};
|
|
352
|
+
}());
|
|
353
|
+
if (thread && options.showThread) {
|
|
354
|
+
debug.log(' message has thread ' + thread);
|
|
355
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
356
|
+
// right arrow .. @@ think of stg better
|
|
357
|
+
'see thread', function (_e) {
|
|
358
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
359
|
+
options.showThread(thread, options);
|
|
360
|
+
}));
|
|
361
|
+
}
|
|
362
|
+
return _context10.abrupt("return", messageRow);
|
|
363
|
+
case 68:
|
|
364
|
+
case "end":
|
|
365
|
+
return _context10.stop();
|
|
366
|
+
}
|
|
367
|
+
}, _callee9);
|
|
368
|
+
}));
|
|
369
|
+
return _renderMessageRow.apply(this, arguments);
|
|
210
370
|
}
|
|
211
|
-
function switchToEditor(
|
|
212
|
-
|
|
213
|
-
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
214
|
-
messageTable.insertBefore(editRow, messageRow);
|
|
215
|
-
editRow.originalRow = messageRow;
|
|
216
|
-
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
371
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
372
|
+
return _switchToEditor.apply(this, arguments);
|
|
217
373
|
}
|
|
218
374
|
/* Control for a new message -- or editing an old message ***************
|
|
219
375
|
*
|
|
220
376
|
*/
|
|
377
|
+
function _switchToEditor() {
|
|
378
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
379
|
+
var messageTable, editRow;
|
|
380
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
381
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
382
|
+
case 0:
|
|
383
|
+
messageTable = messageRow.parentNode;
|
|
384
|
+
_context11.t0 = renderMessageEditor;
|
|
385
|
+
_context11.t1 = channelObject;
|
|
386
|
+
_context11.t2 = messageTable;
|
|
387
|
+
_context11.t3 = userContext;
|
|
388
|
+
_context11.t4 = channelObject.options;
|
|
389
|
+
_context11.next = 8;
|
|
390
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
391
|
+
case 8:
|
|
392
|
+
_context11.t5 = _context11.sent;
|
|
393
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
394
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
395
|
+
editRow.originalRow = messageRow;
|
|
396
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
397
|
+
case 13:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context11.stop();
|
|
400
|
+
}
|
|
401
|
+
}, _callee10);
|
|
402
|
+
}));
|
|
403
|
+
return _switchToEditor.apply(this, arguments);
|
|
404
|
+
}
|
|
221
405
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
222
406
|
function revertEditing(messageEditor) {
|
|
223
407
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
224
408
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
225
409
|
}
|
|
226
|
-
function handleFieldInput(
|
|
410
|
+
function handleFieldInput(_x10) {
|
|
227
411
|
return _handleFieldInput.apply(this, arguments);
|
|
228
412
|
}
|
|
229
413
|
function _handleFieldInput() {
|
|
@@ -241,72 +425,86 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
241
425
|
}));
|
|
242
426
|
return _handleFieldInput.apply(this, arguments);
|
|
243
427
|
}
|
|
244
|
-
function sendMessage(
|
|
428
|
+
function sendMessage(_x11, _x12) {
|
|
245
429
|
return _sendMessage.apply(this, arguments);
|
|
246
430
|
} // sendMessage
|
|
247
431
|
// DRAG AND DROP
|
|
248
432
|
function _sendMessage() {
|
|
249
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
250
|
-
var sendComplete, message, statusArea;
|
|
251
|
-
return _regenerator["default"].wrap(function
|
|
252
|
-
while (1) switch (
|
|
433
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
434
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
435
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
436
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
253
437
|
case 0:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
438
|
+
_sendComplete = function _sendComplete3() {
|
|
439
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
440
|
+
var oldRow;
|
|
441
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
442
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
443
|
+
case 0:
|
|
444
|
+
_context7.next = 2;
|
|
445
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
446
|
+
case 2:
|
|
447
|
+
// not green
|
|
258
448
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
449
|
+
if (originalMessage) {
|
|
450
|
+
// editing another message
|
|
451
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
452
|
+
if (oldRow.parentNode) {
|
|
453
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
454
|
+
} else {
|
|
455
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
456
|
+
oldRow.style.backgroundColor = '#fee';
|
|
457
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
458
|
+
}
|
|
270
459
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
460
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
461
|
+
} else {
|
|
462
|
+
if (fromMainField) {
|
|
463
|
+
field.value = ''; // clear from out for reuse
|
|
464
|
+
field.setAttribute('style', messageBodyStyle);
|
|
465
|
+
field.disabled = false;
|
|
466
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
467
|
+
field.focus(); // Start typing next line immediately
|
|
468
|
+
field.select();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
472
|
+
case 3:
|
|
473
|
+
case "end":
|
|
474
|
+
return _context7.stop();
|
|
475
|
+
}
|
|
476
|
+
}, _callee6);
|
|
477
|
+
}));
|
|
478
|
+
return _sendComplete.apply(this, arguments);
|
|
283
479
|
};
|
|
284
|
-
|
|
285
|
-
|
|
480
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
481
|
+
return _sendComplete.apply(this, arguments);
|
|
482
|
+
}; // const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
286
483
|
if (fromMainField) {
|
|
287
484
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
288
485
|
field.disabled = true;
|
|
289
486
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
293
|
-
case
|
|
294
|
-
message =
|
|
295
|
-
|
|
487
|
+
_context8.prev = 3;
|
|
488
|
+
_context8.next = 6;
|
|
489
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
490
|
+
case 6:
|
|
491
|
+
message = _context8.sent;
|
|
492
|
+
_context8.next = 14;
|
|
296
493
|
break;
|
|
297
|
-
case
|
|
298
|
-
|
|
299
|
-
|
|
494
|
+
case 9:
|
|
495
|
+
_context8.prev = 9;
|
|
496
|
+
_context8.t0 = _context8["catch"](3);
|
|
300
497
|
statusArea = userContext.statusArea || messageEditor;
|
|
301
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
302
|
-
return
|
|
303
|
-
case 13:
|
|
304
|
-
sendComplete(message, text);
|
|
498
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
499
|
+
return _context8.abrupt("return");
|
|
305
500
|
case 14:
|
|
501
|
+
_context8.next = 16;
|
|
502
|
+
return sendComplete(message, text);
|
|
503
|
+
case 16:
|
|
306
504
|
case "end":
|
|
307
|
-
return
|
|
505
|
+
return _context8.stop();
|
|
308
506
|
}
|
|
309
|
-
},
|
|
507
|
+
}, _callee7, null, [[3, 9]]);
|
|
310
508
|
}));
|
|
311
509
|
return _sendMessage.apply(this, arguments);
|
|
312
510
|
}
|
|
@@ -325,7 +523,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
325
523
|
}
|
|
326
524
|
}, _callee);
|
|
327
525
|
}));
|
|
328
|
-
return function (
|
|
526
|
+
return function (_x13, _x14) {
|
|
329
527
|
return _ref.apply(this, arguments);
|
|
330
528
|
};
|
|
331
529
|
}());
|
|
@@ -369,7 +567,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
369
567
|
}
|
|
370
568
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
371
569
|
}));
|
|
372
|
-
return function droppedURIHandler(
|
|
570
|
+
return function droppedURIHandler(_x15) {
|
|
373
571
|
return _ref2.apply(this, arguments);
|
|
374
572
|
};
|
|
375
573
|
}();
|
|
@@ -380,7 +578,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
380
578
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
381
579
|
return imageDoc;
|
|
382
580
|
}
|
|
383
|
-
function tookPicture(
|
|
581
|
+
function tookPicture(_x16) {
|
|
384
582
|
return _tookPicture.apply(this, arguments);
|
|
385
583
|
} // Body of turnOnInput
|
|
386
584
|
function _tookPicture() {
|
|
@@ -457,7 +655,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
457
655
|
}
|
|
458
656
|
}, _callee3);
|
|
459
657
|
}));
|
|
460
|
-
return function (
|
|
658
|
+
return function (_x17) {
|
|
461
659
|
return _ref3.apply(this, arguments);
|
|
462
660
|
};
|
|
463
661
|
}(), false);
|
|
@@ -519,7 +717,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
519
717
|
turnOnInput();
|
|
520
718
|
Object.assign(context, userContext);
|
|
521
719
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
522
|
-
//
|
|
720
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
523
721
|
});
|
|
524
722
|
});
|
|
525
723
|
return messageEditor;
|