solid-ui 2.4.27-efb14913 → 2.4.27-f3d1fd8f
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/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/solid-ui.js +8019 -16518
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.LICENSE.txt +4 -59
- package/dist/solid-ui.min.js.map +1 -1
- 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/chat/bookmarks.js +7 -6
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +103 -248
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +124 -128
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +426 -605
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/keys.d.ts +5 -0
- package/lib/chat/keys.d.ts.map +1 -0
- package/lib/chat/keys.js +183 -0
- package/lib/chat/keys.js.map +1 -0
- package/lib/chat/message.js +199 -286
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +276 -464
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/signature.d.ts +27 -0
- package/lib/chat/signature.d.ts.map +1 -0
- package/lib/chat/signature.js +110 -0
- package/lib/chat/signature.js.map +1 -0
- package/lib/chat/thread.js +144 -166
- package/lib/chat/thread.js.map +1 -1
- package/lib/preferences.js +0 -4
- package/lib/preferences.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +10 -7
package/lib/chat/message.js
CHANGED
|
@@ -12,7 +12,6 @@ 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"));
|
|
16
15
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
16
|
var _infinite = require("./infinite");
|
|
18
17
|
var _messageTools = require("./messageTools");
|
|
@@ -28,11 +27,11 @@ var pad = _interopRequireWildcard(require("../pad"));
|
|
|
28
27
|
var style = _interopRequireWildcard(require("../style"));
|
|
29
28
|
var utils = _interopRequireWildcard(require("../utils"));
|
|
30
29
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
30
|
+
var _signature = require("./signature");
|
|
31
|
+
var _keys = require("./keys");
|
|
31
32
|
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); }
|
|
32
33
|
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; }
|
|
33
|
-
function
|
|
34
|
-
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; }
|
|
35
|
-
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; } } }; }
|
|
34
|
+
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
36
35
|
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); }
|
|
37
36
|
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; }
|
|
38
37
|
var dom = window.document;
|
|
@@ -111,232 +110,161 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
111
110
|
/**
|
|
112
111
|
* Renders a chat message, read-only mode
|
|
113
112
|
*/
|
|
114
|
-
function renderMessageRow(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
127
|
-
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
128
|
-
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
129
|
-
_context10.next = 6;
|
|
130
|
-
return (0, _chatLogic.mostRecentVersion)(message);
|
|
131
|
-
case 6:
|
|
132
|
-
latestVersion = _context10.sent;
|
|
133
|
-
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
134
|
-
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
135
|
-
_context10.next = 10;
|
|
136
|
-
return (0, _chatLogic.allVersions)(message);
|
|
137
|
-
case 10:
|
|
138
|
-
versions = _context10.sent;
|
|
139
|
-
if (versions.length > 1) {
|
|
140
|
-
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
141
|
-
}
|
|
142
|
-
// be tolerant in accepting replies on any version of a message
|
|
143
|
-
replies = versions.map(function (version) {
|
|
144
|
-
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
145
|
-
}).flat();
|
|
146
|
-
thread = null;
|
|
147
|
-
straightReplies = [];
|
|
148
|
-
_iterator2 = _createForOfIteratorHelper(replies);
|
|
149
|
-
try {
|
|
150
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
151
|
-
reply = _step2.value;
|
|
152
|
-
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
153
|
-
thread = reply;
|
|
154
|
-
debug.log('renderMessageRow: found thread: ' + thread);
|
|
155
|
-
} else {
|
|
156
|
-
straightReplies.push(reply);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
} catch (err) {
|
|
160
|
-
_iterator2.e(err);
|
|
161
|
-
} finally {
|
|
162
|
-
_iterator2.f();
|
|
163
|
-
}
|
|
164
|
-
if (straightReplies.length > 1) {
|
|
165
|
-
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
166
|
-
}
|
|
167
|
-
_context10.next = 20;
|
|
168
|
-
return (0, _chatLogic.originalVersion)(message);
|
|
169
|
-
case 20:
|
|
170
|
-
originalMessage = _context10.sent;
|
|
171
|
-
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
172
|
-
// @@@ kludge!
|
|
173
|
-
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
174
|
-
messageRow = dom.createElement('tr');
|
|
175
|
-
messageRow.AJAR_date = sortDate.value;
|
|
176
|
-
messageRow.AJAR_subject = message;
|
|
177
|
-
td1 = dom.createElement('td');
|
|
178
|
-
messageRow.appendChild(td1);
|
|
179
|
-
if (!options.authorDateOnLeft) {
|
|
180
|
-
img = dom.createElement('img');
|
|
181
|
-
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
182
|
-
widgets.setImage(img, creator);
|
|
183
|
-
td1.appendChild(img);
|
|
184
|
-
} else {
|
|
185
|
-
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
186
|
-
}
|
|
187
|
-
bothDates = widgets.shortDate(sortDate.value);
|
|
188
|
-
if (edited) {
|
|
189
|
-
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
190
|
-
}
|
|
113
|
+
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
114
|
+
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
115
|
+
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
116
|
+
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
117
|
+
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
118
|
+
var latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker'));
|
|
119
|
+
// use latest content if same owner, else use original
|
|
120
|
+
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
121
|
+
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
122
|
+
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "Proof")));
|
|
123
|
+
debug.log('alain ' + (signature === null || signature === void 0 ? void 0 : signature.value));
|
|
191
124
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
strip = _context10.sent;
|
|
229
|
-
if (strip.children.length) {
|
|
230
|
-
td2.appendChild(dom.createElement('br'));
|
|
231
|
-
td2.appendChild(strip);
|
|
232
|
-
}
|
|
125
|
+
// verify signature
|
|
126
|
+
var msg = (0, _signature.getBlankMsg)();
|
|
127
|
+
msg.id = msgId.uri;
|
|
128
|
+
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
129
|
+
msg.content = content.value;
|
|
130
|
+
msg.maker = creator.uri;
|
|
131
|
+
try {
|
|
132
|
+
var publicKey = function publicKey(webId) {
|
|
133
|
+
var pubKey;
|
|
134
|
+
(0, _keys.getPublicKey)(webId).then(function (publicKey) {
|
|
135
|
+
debug.log('alain publicKey ' + publicKey);
|
|
136
|
+
pubKey = publicKey;
|
|
137
|
+
});
|
|
138
|
+
return pubKey;
|
|
139
|
+
};
|
|
140
|
+
var pubKey = publicKey(creator.uri); // await getPublicKey(creator.uri)
|
|
141
|
+
debug.log('alain pubKey ' + pubKey);
|
|
142
|
+
debug.log(creator.uri);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
debug.warn(err);
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
// pubKey could be store in a cache for all makers
|
|
148
|
+
/* const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
|
|
149
|
+
debug.warn('publicKeys\n' + pubKey0 + '\n' + pubKey)
|
|
150
|
+
const privKey0 = getPrivateKey(creator.uri) // alain to remove
|
|
151
|
+
// unsigned messages should be signaled as unsecured
|
|
152
|
+
debug.warn(msg)
|
|
153
|
+
debug.warn(signature?.value) */
|
|
154
|
+
if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature.value, msg, pubKey)) throw new Error('invalid signature');
|
|
155
|
+
} catch (err) {
|
|
156
|
+
debug.log(err);
|
|
157
|
+
}
|
|
158
|
+
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
159
|
+
var edited = !message.sameTerm(originalMessage);
|
|
160
|
+
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
233
161
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
162
|
+
var messageRow = dom.createElement('tr');
|
|
163
|
+
messageRow.AJAR_date = sortDate.value;
|
|
164
|
+
messageRow.AJAR_subject = message;
|
|
165
|
+
var td1 = dom.createElement('td');
|
|
166
|
+
messageRow.appendChild(td1);
|
|
167
|
+
if (!options.authorDateOnLeft) {
|
|
168
|
+
var img = dom.createElement('img');
|
|
169
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
170
|
+
widgets.setImage(img, creator);
|
|
171
|
+
td1.appendChild(img);
|
|
172
|
+
} else {
|
|
173
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
174
|
+
}
|
|
175
|
+
var bothDates = widgets.shortDate(sortDate.value);
|
|
176
|
+
if (edited) {
|
|
177
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Render the content ot the message itself
|
|
181
|
+
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
182
|
+
if (!options.authorDateOnLeft) {
|
|
183
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
184
|
+
// widgets.shortDate(dateString)
|
|
185
|
+
message);
|
|
186
|
+
}
|
|
187
|
+
var text = content.value.trim();
|
|
188
|
+
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
189
|
+
var para = null;
|
|
190
|
+
if (isURI) {
|
|
191
|
+
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
192
|
+
if (isImage && options.expandImagesInline) {
|
|
193
|
+
var _img = elementForImageURI(text, options);
|
|
194
|
+
td2.appendChild(_img);
|
|
195
|
+
} else {
|
|
196
|
+
// Link but not Image
|
|
197
|
+
var anc = td2.appendChild(dom.createElement('a'));
|
|
198
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
199
|
+
anc.href = text;
|
|
200
|
+
para.textContent = text;
|
|
201
|
+
td2.appendChild(anc);
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
// text
|
|
205
|
+
para = dom.createElement('p');
|
|
206
|
+
td2.appendChild(para);
|
|
207
|
+
para.textContent = text;
|
|
208
|
+
}
|
|
209
|
+
if (para) {
|
|
210
|
+
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
211
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
212
|
+
}
|
|
213
|
+
function getBgColor(fresh) {
|
|
214
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Sentiment strip
|
|
218
|
+
var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
219
|
+
if (strip.children.length) {
|
|
220
|
+
td2.appendChild(dom.createElement('br'));
|
|
221
|
+
td2.appendChild(strip);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Message tool bar button
|
|
225
|
+
var td3 = dom.createElement('td');
|
|
226
|
+
messageRow.appendChild(td3);
|
|
227
|
+
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
228
|
+
td3.appendChild(toolsButton);
|
|
229
|
+
toolsButton.addEventListener('click', function (_event) {
|
|
230
|
+
if (messageRow.toolTR) {
|
|
231
|
+
// already got a toolbar? Toogle
|
|
232
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
233
|
+
delete messageRow.toolTR;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
var toolsTR = dom.createElement('tr');
|
|
237
|
+
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
238
|
+
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
|
|
239
|
+
if (messageRow.nextSibling) {
|
|
240
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
241
|
+
} else {
|
|
242
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
243
|
+
}
|
|
244
|
+
messageRow.toolTR = toolsTR;
|
|
245
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
246
|
+
var toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
247
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
248
|
+
toolsTD.appendChild(tools);
|
|
249
|
+
});
|
|
250
|
+
return messageRow;
|
|
299
251
|
}
|
|
300
|
-
function switchToEditor(
|
|
301
|
-
|
|
252
|
+
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
253
|
+
var messageTable = messageRow.parentNode;
|
|
254
|
+
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
255
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
256
|
+
editRow.originalRow = messageRow;
|
|
257
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
302
258
|
}
|
|
303
259
|
/* Control for a new message -- or editing an old message ***************
|
|
304
260
|
*
|
|
305
261
|
*/
|
|
306
|
-
function _switchToEditor() {
|
|
307
|
-
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
308
|
-
var messageTable, editRow;
|
|
309
|
-
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
310
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
311
|
-
case 0:
|
|
312
|
-
messageTable = messageRow.parentNode;
|
|
313
|
-
_context11.t0 = renderMessageEditor;
|
|
314
|
-
_context11.t1 = channelObject;
|
|
315
|
-
_context11.t2 = messageTable;
|
|
316
|
-
_context11.t3 = userContext;
|
|
317
|
-
_context11.t4 = channelObject.options;
|
|
318
|
-
_context11.next = 8;
|
|
319
|
-
return (0, _chatLogic.mostRecentVersion)(message);
|
|
320
|
-
case 8:
|
|
321
|
-
_context11.t5 = _context11.sent;
|
|
322
|
-
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
323
|
-
messageTable.insertBefore(editRow, messageRow);
|
|
324
|
-
editRow.originalRow = messageRow;
|
|
325
|
-
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
326
|
-
case 13:
|
|
327
|
-
case "end":
|
|
328
|
-
return _context11.stop();
|
|
329
|
-
}
|
|
330
|
-
}, _callee10);
|
|
331
|
-
}));
|
|
332
|
-
return _switchToEditor.apply(this, arguments);
|
|
333
|
-
}
|
|
334
262
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
335
263
|
function revertEditing(messageEditor) {
|
|
336
264
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
337
265
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
338
266
|
}
|
|
339
|
-
function handleFieldInput(
|
|
267
|
+
function handleFieldInput(_x) {
|
|
340
268
|
return _handleFieldInput.apply(this, arguments);
|
|
341
269
|
}
|
|
342
270
|
function _handleFieldInput() {
|
|
@@ -354,87 +282,72 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
354
282
|
}));
|
|
355
283
|
return _handleFieldInput.apply(this, arguments);
|
|
356
284
|
}
|
|
357
|
-
function sendMessage(
|
|
285
|
+
function sendMessage(_x2, _x3) {
|
|
358
286
|
return _sendMessage.apply(this, arguments);
|
|
359
287
|
} // sendMessage
|
|
360
288
|
// DRAG AND DROP
|
|
361
289
|
function _sendMessage() {
|
|
362
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
363
|
-
var sendComplete,
|
|
364
|
-
return _regenerator["default"].wrap(function
|
|
365
|
-
while (1) switch (
|
|
290
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text, fromMainField) {
|
|
291
|
+
var sendComplete, message, statusArea;
|
|
292
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
293
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
366
294
|
case 0:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
372
|
-
case 0:
|
|
373
|
-
_context7.next = 2;
|
|
374
|
-
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
375
|
-
case 2:
|
|
376
|
-
// not green
|
|
295
|
+
sendComplete = function _sendComplete(message, _text2) {
|
|
296
|
+
// const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
|
|
297
|
+
// const content = $rdf.literal(text2)
|
|
298
|
+
(0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
|
|
377
299
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
300
|
+
if (originalMessage) {
|
|
301
|
+
// editing another message
|
|
302
|
+
var oldRow = messageEditor.originalRow;
|
|
303
|
+
// oldRow.style.display = '' // restore read-only version, re-attack
|
|
304
|
+
if (oldRow.parentNode) {
|
|
305
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
306
|
+
} else {
|
|
307
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
308
|
+
oldRow.style.backgroundColor = '#fee';
|
|
309
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
310
|
+
}
|
|
388
311
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
case 3:
|
|
402
|
-
case "end":
|
|
403
|
-
return _context7.stop();
|
|
404
|
-
}
|
|
405
|
-
}, _callee6);
|
|
406
|
-
}));
|
|
407
|
-
return _sendComplete.apply(this, arguments);
|
|
408
|
-
};
|
|
409
|
-
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
410
|
-
return _sendComplete.apply(this, arguments);
|
|
312
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
313
|
+
} else {
|
|
314
|
+
if (fromMainField) {
|
|
315
|
+
field.value = ''; // clear from out for reuse
|
|
316
|
+
field.setAttribute('style', messageBodyStyle);
|
|
317
|
+
field.disabled = false;
|
|
318
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
319
|
+
field.focus(); // Start typing next line immediately
|
|
320
|
+
field.select();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
411
324
|
};
|
|
325
|
+
|
|
412
326
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
413
327
|
if (fromMainField) {
|
|
414
328
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
415
329
|
field.disabled = true;
|
|
416
330
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return channelObject.updateMessage(text, originalMessage
|
|
420
|
-
case
|
|
421
|
-
message =
|
|
422
|
-
|
|
331
|
+
_context7.prev = 2;
|
|
332
|
+
_context7.next = 5;
|
|
333
|
+
return channelObject.updateMessage(text, originalMessage);
|
|
334
|
+
case 5:
|
|
335
|
+
message = _context7.sent;
|
|
336
|
+
_context7.next = 13;
|
|
423
337
|
break;
|
|
424
|
-
case
|
|
425
|
-
|
|
426
|
-
|
|
338
|
+
case 8:
|
|
339
|
+
_context7.prev = 8;
|
|
340
|
+
_context7.t0 = _context7["catch"](2);
|
|
427
341
|
statusArea = userContext.statusArea || messageEditor;
|
|
428
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
429
|
-
return
|
|
342
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context7.t0));
|
|
343
|
+
return _context7.abrupt("return");
|
|
344
|
+
case 13:
|
|
345
|
+
sendComplete(message, text);
|
|
430
346
|
case 14:
|
|
431
|
-
_context8.next = 16;
|
|
432
|
-
return sendComplete(message, text);
|
|
433
|
-
case 16:
|
|
434
347
|
case "end":
|
|
435
|
-
return
|
|
348
|
+
return _context7.stop();
|
|
436
349
|
}
|
|
437
|
-
},
|
|
350
|
+
}, _callee6, null, [[2, 8]]);
|
|
438
351
|
}));
|
|
439
352
|
return _sendMessage.apply(this, arguments);
|
|
440
353
|
}
|
|
@@ -453,7 +366,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
453
366
|
}
|
|
454
367
|
}, _callee);
|
|
455
368
|
}));
|
|
456
|
-
return function (
|
|
369
|
+
return function (_x4, _x5) {
|
|
457
370
|
return _ref.apply(this, arguments);
|
|
458
371
|
};
|
|
459
372
|
}());
|
|
@@ -497,7 +410,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
497
410
|
}
|
|
498
411
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
499
412
|
}));
|
|
500
|
-
return function droppedURIHandler(
|
|
413
|
+
return function droppedURIHandler(_x6) {
|
|
501
414
|
return _ref2.apply(this, arguments);
|
|
502
415
|
};
|
|
503
416
|
}();
|
|
@@ -508,7 +421,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
508
421
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
509
422
|
return imageDoc;
|
|
510
423
|
}
|
|
511
|
-
function tookPicture(
|
|
424
|
+
function tookPicture(_x7) {
|
|
512
425
|
return _tookPicture.apply(this, arguments);
|
|
513
426
|
} // Body of turnOnInput
|
|
514
427
|
function _tookPicture() {
|
|
@@ -585,7 +498,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
585
498
|
}
|
|
586
499
|
}, _callee3);
|
|
587
500
|
}));
|
|
588
|
-
return function (
|
|
501
|
+
return function (_x8) {
|
|
589
502
|
return _ref3.apply(this, arguments);
|
|
590
503
|
};
|
|
591
504
|
}(), false);
|
|
@@ -647,7 +560,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
647
560
|
turnOnInput();
|
|
648
561
|
Object.assign(context, userContext);
|
|
649
562
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
650
|
-
//
|
|
563
|
+
// console.log('Bookmark file: ' + context.bookmarkDocument)
|
|
651
564
|
});
|
|
652
565
|
});
|
|
653
566
|
return messageEditor;
|