solid-ui 2.4.27-1ef91399 → 2.4.27-2ebac088
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/solid-ui.js +1616 -936
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +250 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/infinite.js +604 -426
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +286 -158
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +464 -276
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +166 -144
- package/lib/chat/thread.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +2 -1
package/dist/solid-ui.js
CHANGED
|
@@ -2249,8 +2249,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2249
2249
|
* @packageDocumentation
|
|
2250
2250
|
*/
|
|
2251
2251
|
|
|
2252
|
-
/* global alert confirm */
|
|
2253
|
-
|
|
2254
2252
|
// pull in first avoid cross-refs
|
|
2255
2253
|
|
|
2256
2254
|
var UI = {
|
|
@@ -2343,7 +2341,8 @@ function _findBookmarkDocument() {
|
|
|
2343
2341
|
}
|
|
2344
2342
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2345
2343
|
if (userContext.instances.length > 1) {
|
|
2346
|
-
|
|
2344
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2345
|
+
// Note: should pick up community bookmarks as well
|
|
2347
2346
|
}
|
|
2348
2347
|
_context.next = 28;
|
|
2349
2348
|
break;
|
|
@@ -2364,7 +2363,7 @@ function _findBookmarkDocument() {
|
|
|
2364
2363
|
case 18:
|
|
2365
2364
|
_context.prev = 18;
|
|
2366
2365
|
_context.t0 = _context["catch"](12);
|
|
2367
|
-
|
|
2366
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2368
2367
|
return _context.abrupt("return", userContext);
|
|
2369
2368
|
case 22:
|
|
2370
2369
|
_context.next = 24;
|
|
@@ -2374,7 +2373,7 @@ function _findBookmarkDocument() {
|
|
|
2374
2373
|
_context.next = 28;
|
|
2375
2374
|
break;
|
|
2376
2375
|
case 27:
|
|
2377
|
-
|
|
2376
|
+
debug.warn('You seem to have no bookmark file, nor even a profile file!');
|
|
2378
2377
|
case 28:
|
|
2379
2378
|
return _context.abrupt("return", userContext);
|
|
2380
2379
|
case 29:
|
|
@@ -2429,7 +2428,7 @@ function _addBookmark() {
|
|
|
2429
2428
|
_context2.prev = 14;
|
|
2430
2429
|
_context2.t0 = _context2["catch"](9);
|
|
2431
2430
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2432
|
-
|
|
2431
|
+
debug.warn(msg);
|
|
2433
2432
|
return _context2.abrupt("return", null);
|
|
2434
2433
|
case 19:
|
|
2435
2434
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2482,7 +2481,7 @@ function _toggleBookmark() {
|
|
|
2482
2481
|
_context3.prev = 15;
|
|
2483
2482
|
_context3.t0 = _context3["catch"](8);
|
|
2484
2483
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2485
|
-
|
|
2484
|
+
debug.warn('Cannot delete bookmark:' + _context3.t0);
|
|
2486
2485
|
case 19:
|
|
2487
2486
|
i++;
|
|
2488
2487
|
_context3.next = 7;
|
|
@@ -2577,6 +2576,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2577
2576
|
}));
|
|
2578
2577
|
exports.ChatChannel = void 0;
|
|
2579
2578
|
exports._createIfNotExists = _createIfNotExists;
|
|
2579
|
+
exports.allVersions = allVersions;
|
|
2580
2580
|
exports.isDeleted = isDeleted;
|
|
2581
2581
|
exports.isHidden = isHidden;
|
|
2582
2582
|
exports.isReplaced = isReplaced;
|
|
@@ -2652,6 +2652,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2652
2652
|
var _this = this;
|
|
2653
2653
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2654
2654
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2655
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2655
2656
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2656
2657
|
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
|
|
2657
2658
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
@@ -2664,41 +2665,61 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2664
2665
|
chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
|
|
2665
2666
|
message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
2666
2667
|
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
2667
|
-
if (oldMsg) {
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
if (deleteIt) {
|
|
2671
|
-
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2672
|
-
}
|
|
2673
|
-
} else {
|
|
2674
|
-
// link new message to channel
|
|
2675
|
-
sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
|
|
2668
|
+
if (!oldMsg) {
|
|
2669
|
+
_context2.next = 21;
|
|
2670
|
+
break;
|
|
2676
2671
|
}
|
|
2672
|
+
_context2.t0 = sts;
|
|
2673
|
+
_context2.t1 = $rdf;
|
|
2674
|
+
_context2.next = 12;
|
|
2675
|
+
return mostRecentVersion(oldMsg);
|
|
2676
|
+
case 12:
|
|
2677
|
+
_context2.t2 = _context2.sent;
|
|
2678
|
+
_context2.t3 = ns.dct('isReplacedBy');
|
|
2679
|
+
_context2.t4 = message;
|
|
2680
|
+
_context2.t5 = chatDocument;
|
|
2681
|
+
_context2.t6 = _context2.t1.st.call(_context2.t1, _context2.t2, _context2.t3, _context2.t4, _context2.t5);
|
|
2682
|
+
_context2.t0.push.call(_context2.t0, _context2.t6);
|
|
2683
|
+
if (deleteIt) {
|
|
2684
|
+
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2685
|
+
}
|
|
2686
|
+
_context2.next = 22;
|
|
2687
|
+
break;
|
|
2688
|
+
case 21:
|
|
2689
|
+
// link new message to channel
|
|
2690
|
+
sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
|
|
2691
|
+
case 22:
|
|
2677
2692
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2678
2693
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2679
2694
|
if (me) {
|
|
2680
2695
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2681
2696
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2697
|
+
if (thread) {
|
|
2698
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, chatDocument));
|
|
2699
|
+
if (!thread.doc().sameTerm(message.doc())) {
|
|
2700
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, thread.doc()));
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
_context2.prev = 26;
|
|
2704
|
+
_context2.next = 29;
|
|
2705
|
+
return _solidLogic.store.updater.updateMany([], sts);
|
|
2706
|
+
case 29:
|
|
2707
|
+
_context2.next = 37;
|
|
2687
2708
|
break;
|
|
2688
|
-
case
|
|
2689
|
-
_context2.prev =
|
|
2690
|
-
_context2.
|
|
2691
|
-
msg = 'Error saving chat message: ' + _context2.
|
|
2709
|
+
case 31:
|
|
2710
|
+
_context2.prev = 31;
|
|
2711
|
+
_context2.t7 = _context2["catch"](26);
|
|
2712
|
+
msg = 'Error saving chat message: ' + _context2.t7;
|
|
2692
2713
|
debug.warn(msg);
|
|
2693
2714
|
alert(msg);
|
|
2694
2715
|
throw new Error(msg);
|
|
2695
|
-
case
|
|
2716
|
+
case 37:
|
|
2696
2717
|
return _context2.abrupt("return", message);
|
|
2697
|
-
case
|
|
2718
|
+
case 38:
|
|
2698
2719
|
case "end":
|
|
2699
2720
|
return _context2.stop();
|
|
2700
2721
|
}
|
|
2701
|
-
}, _callee2, null, [[
|
|
2722
|
+
}, _callee2, null, [[26, 31]]);
|
|
2702
2723
|
})();
|
|
2703
2724
|
});
|
|
2704
2725
|
function updateMessage(_x2) {
|
|
@@ -2728,26 +2749,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2728
2749
|
return _deleteMessage.apply(this, arguments);
|
|
2729
2750
|
}
|
|
2730
2751
|
return deleteMessage;
|
|
2752
|
+
}() // Create a new thread of replies to the thread root message
|
|
2753
|
+
// or return one which already exists
|
|
2754
|
+
}, {
|
|
2755
|
+
key: "createThread",
|
|
2756
|
+
value: function () {
|
|
2757
|
+
var _createThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(threadRoot) {
|
|
2758
|
+
var already, thread, insert;
|
|
2759
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
2760
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2761
|
+
case 0:
|
|
2762
|
+
already = _solidLogic.store.each(threadRoot, ns.sioc('has_reply'), null, threadRoot.doc()).filter(function (thread) {
|
|
2763
|
+
return _solidLogic.store.holds(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc());
|
|
2764
|
+
});
|
|
2765
|
+
if (!(already.length > 0)) {
|
|
2766
|
+
_context4.next = 3;
|
|
2767
|
+
break;
|
|
2768
|
+
}
|
|
2769
|
+
return _context4.abrupt("return", already[0]);
|
|
2770
|
+
case 3:
|
|
2771
|
+
thread = $rdf.sym(threadRoot.uri + '-thread');
|
|
2772
|
+
insert = [$rdf.st(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc()), $rdf.st(threadRoot, ns.sioc('has_reply'), thread, thread.doc())];
|
|
2773
|
+
_context4.next = 7;
|
|
2774
|
+
return _solidLogic.store.updater.update([], insert);
|
|
2775
|
+
case 7:
|
|
2776
|
+
return _context4.abrupt("return", thread);
|
|
2777
|
+
case 8:
|
|
2778
|
+
case "end":
|
|
2779
|
+
return _context4.stop();
|
|
2780
|
+
}
|
|
2781
|
+
}, _callee4);
|
|
2782
|
+
}));
|
|
2783
|
+
function createThread(_x4) {
|
|
2784
|
+
return _createThread.apply(this, arguments);
|
|
2785
|
+
}
|
|
2786
|
+
return createThread;
|
|
2731
2787
|
}()
|
|
2732
2788
|
}]);
|
|
2733
2789
|
return ChatChannel;
|
|
2734
2790
|
}(); // class ChatChannel
|
|
2791
|
+
// ////////// Utility functions
|
|
2792
|
+
// Have to not loop forever if fed loops
|
|
2735
2793
|
exports.ChatChannel = ChatChannel;
|
|
2736
|
-
function
|
|
2737
|
-
|
|
2738
|
-
while (msg) {
|
|
2739
|
-
message = msg;
|
|
2740
|
-
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2741
|
-
}
|
|
2742
|
-
return message;
|
|
2794
|
+
function allVersions(_x5) {
|
|
2795
|
+
return _allVersions.apply(this, arguments);
|
|
2743
2796
|
}
|
|
2744
|
-
function
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2797
|
+
function _allVersions() {
|
|
2798
|
+
_allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
|
|
2799
|
+
var versions, done, m, prev, next;
|
|
2800
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
2801
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2802
|
+
case 0:
|
|
2803
|
+
versions = [message];
|
|
2804
|
+
done = {};
|
|
2805
|
+
done[message.ur] = true;
|
|
2806
|
+
m = message;
|
|
2807
|
+
case 4:
|
|
2808
|
+
if (false) {}
|
|
2809
|
+
// earlier?
|
|
2810
|
+
prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
|
|
2811
|
+
if (!(!prev || done[prev.uri])) {
|
|
2812
|
+
_context5.next = 8;
|
|
2813
|
+
break;
|
|
2814
|
+
}
|
|
2815
|
+
return _context5.abrupt("break", 15);
|
|
2816
|
+
case 8:
|
|
2817
|
+
_context5.next = 10;
|
|
2818
|
+
return _solidLogic.store.fetcher.load(prev);
|
|
2819
|
+
case 10:
|
|
2820
|
+
versions.unshift(prev);
|
|
2821
|
+
done[prev.uri] = true;
|
|
2822
|
+
m = prev;
|
|
2823
|
+
_context5.next = 4;
|
|
2824
|
+
break;
|
|
2825
|
+
case 15:
|
|
2826
|
+
m = message;
|
|
2827
|
+
case 16:
|
|
2828
|
+
if (false) {}
|
|
2829
|
+
// later?
|
|
2830
|
+
next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
|
|
2831
|
+
if (!(!next || done[next.uri])) {
|
|
2832
|
+
_context5.next = 20;
|
|
2833
|
+
break;
|
|
2834
|
+
}
|
|
2835
|
+
return _context5.abrupt("break", 25);
|
|
2836
|
+
case 20:
|
|
2837
|
+
versions.push(next);
|
|
2838
|
+
done[next.uri] = true;
|
|
2839
|
+
m = next;
|
|
2840
|
+
_context5.next = 16;
|
|
2841
|
+
break;
|
|
2842
|
+
case 25:
|
|
2843
|
+
return _context5.abrupt("return", versions);
|
|
2844
|
+
case 26:
|
|
2845
|
+
case "end":
|
|
2846
|
+
return _context5.stop();
|
|
2847
|
+
}
|
|
2848
|
+
}, _callee5);
|
|
2849
|
+
}));
|
|
2850
|
+
return _allVersions.apply(this, arguments);
|
|
2851
|
+
}
|
|
2852
|
+
function originalVersion(_x6) {
|
|
2853
|
+
return _originalVersion.apply(this, arguments);
|
|
2854
|
+
}
|
|
2855
|
+
function _originalVersion() {
|
|
2856
|
+
_originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
|
|
2857
|
+
var msg, done;
|
|
2858
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
2859
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2860
|
+
case 0:
|
|
2861
|
+
msg = message;
|
|
2862
|
+
done = {}; // done[message.ur] = true
|
|
2863
|
+
case 2:
|
|
2864
|
+
if (!msg) {
|
|
2865
|
+
_context6.next = 13;
|
|
2866
|
+
break;
|
|
2867
|
+
}
|
|
2868
|
+
if (!done[msg.uri]) {
|
|
2869
|
+
_context6.next = 6;
|
|
2870
|
+
break;
|
|
2871
|
+
}
|
|
2872
|
+
debug.error('originalVersion: verion loop' + message);
|
|
2873
|
+
return _context6.abrupt("return", message);
|
|
2874
|
+
case 6:
|
|
2875
|
+
done[msg.uri] = true;
|
|
2876
|
+
message = msg;
|
|
2877
|
+
_context6.next = 10;
|
|
2878
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2879
|
+
case 10:
|
|
2880
|
+
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2881
|
+
_context6.next = 2;
|
|
2882
|
+
break;
|
|
2883
|
+
case 13:
|
|
2884
|
+
return _context6.abrupt("return", message);
|
|
2885
|
+
case 14:
|
|
2886
|
+
case "end":
|
|
2887
|
+
return _context6.stop();
|
|
2888
|
+
}
|
|
2889
|
+
}, _callee6);
|
|
2890
|
+
}));
|
|
2891
|
+
return _originalVersion.apply(this, arguments);
|
|
2892
|
+
}
|
|
2893
|
+
function mostRecentVersion(_x7) {
|
|
2894
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2895
|
+
}
|
|
2896
|
+
function _mostRecentVersion() {
|
|
2897
|
+
_mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
|
|
2898
|
+
var msg, done;
|
|
2899
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
2900
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2901
|
+
case 0:
|
|
2902
|
+
msg = message;
|
|
2903
|
+
done = {};
|
|
2904
|
+
case 2:
|
|
2905
|
+
if (!msg) {
|
|
2906
|
+
_context7.next = 13;
|
|
2907
|
+
break;
|
|
2908
|
+
}
|
|
2909
|
+
if (!done[msg.uri]) {
|
|
2910
|
+
_context7.next = 6;
|
|
2911
|
+
break;
|
|
2912
|
+
}
|
|
2913
|
+
debug.error('mostRecentVersion: verion loop' + message);
|
|
2914
|
+
return _context7.abrupt("return", message);
|
|
2915
|
+
case 6:
|
|
2916
|
+
done[msg.uri] = true;
|
|
2917
|
+
message = msg;
|
|
2918
|
+
_context7.next = 10;
|
|
2919
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2920
|
+
case 10:
|
|
2921
|
+
msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
2922
|
+
_context7.next = 2;
|
|
2923
|
+
break;
|
|
2924
|
+
case 13:
|
|
2925
|
+
return _context7.abrupt("return", message);
|
|
2926
|
+
case 14:
|
|
2927
|
+
case "end":
|
|
2928
|
+
return _context7.stop();
|
|
2929
|
+
}
|
|
2930
|
+
}, _callee7);
|
|
2931
|
+
}));
|
|
2932
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2751
2933
|
}
|
|
2752
2934
|
function isDeleted(message) {
|
|
2753
2935
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2766,62 +2948,62 @@ function nick(person) {
|
|
|
2766
2948
|
if (s) return '' + s.value;
|
|
2767
2949
|
return '' + utils.label(person);
|
|
2768
2950
|
}
|
|
2769
|
-
function _createIfNotExists(
|
|
2951
|
+
function _createIfNotExists(_x8) {
|
|
2770
2952
|
return _createIfNotExists2.apply(this, arguments);
|
|
2771
2953
|
} // ends
|
|
2772
2954
|
function _createIfNotExists2() {
|
|
2773
2955
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2774
2956
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2775
2957
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2776
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2958
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2777
2959
|
var response;
|
|
2778
|
-
return _regenerator["default"].wrap(function
|
|
2779
|
-
while (1) switch (
|
|
2960
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2961
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2780
2962
|
case 0:
|
|
2781
|
-
|
|
2782
|
-
|
|
2963
|
+
_context8.prev = 0;
|
|
2964
|
+
_context8.next = 3;
|
|
2783
2965
|
return _solidLogic.store.fetcher.load(doc);
|
|
2784
2966
|
case 3:
|
|
2785
|
-
response =
|
|
2786
|
-
|
|
2967
|
+
response = _context8.sent;
|
|
2968
|
+
_context8.next = 26;
|
|
2787
2969
|
break;
|
|
2788
2970
|
case 6:
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
if (!(
|
|
2792
|
-
|
|
2971
|
+
_context8.prev = 6;
|
|
2972
|
+
_context8.t0 = _context8["catch"](0);
|
|
2973
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
2974
|
+
_context8.next = 24;
|
|
2793
2975
|
break;
|
|
2794
2976
|
}
|
|
2795
2977
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2796
|
-
|
|
2797
|
-
|
|
2978
|
+
_context8.prev = 10;
|
|
2979
|
+
_context8.next = 13;
|
|
2798
2980
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2799
2981
|
data: data,
|
|
2800
2982
|
contentType: contentType
|
|
2801
2983
|
});
|
|
2802
2984
|
case 13:
|
|
2803
|
-
response =
|
|
2804
|
-
|
|
2985
|
+
response = _context8.sent;
|
|
2986
|
+
_context8.next = 20;
|
|
2805
2987
|
break;
|
|
2806
2988
|
case 16:
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2810
|
-
throw
|
|
2989
|
+
_context8.prev = 16;
|
|
2990
|
+
_context8.t1 = _context8["catch"](10);
|
|
2991
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
2992
|
+
throw _context8.t1;
|
|
2811
2993
|
case 20:
|
|
2812
2994
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2813
2995
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2814
|
-
return
|
|
2996
|
+
return _context8.abrupt("return", response);
|
|
2815
2997
|
case 24:
|
|
2816
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2817
|
-
throw
|
|
2998
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
2999
|
+
throw _context8.t0;
|
|
2818
3000
|
case 26:
|
|
2819
|
-
return
|
|
3001
|
+
return _context8.abrupt("return", response);
|
|
2820
3002
|
case 27:
|
|
2821
3003
|
case "end":
|
|
2822
|
-
return
|
|
3004
|
+
return _context8.stop();
|
|
2823
3005
|
}
|
|
2824
|
-
},
|
|
3006
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2825
3007
|
})();
|
|
2826
3008
|
});
|
|
2827
3009
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3199,19 +3381,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3199
3381
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3200
3382
|
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); }
|
|
3201
3383
|
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; }
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
*/
|
|
3206
|
-
// import { findBookmarkDocument } from './bookmarks'
|
|
3207
|
-
// pull in first avoid cross-refs
|
|
3208
|
-
|
|
3209
|
-
// import * as style from '../style'
|
|
3210
|
-
// import * as utils from '../utils'
|
|
3211
|
-
|
|
3212
|
-
// import * as pad from '../pad'
|
|
3213
|
-
// import { DateFolder } from './dateFolder'
|
|
3214
|
-
|
|
3384
|
+
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; } } }; }
|
|
3385
|
+
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); }
|
|
3386
|
+
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; }
|
|
3215
3387
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3216
3388
|
|
|
3217
3389
|
function desktopNotification(str) {
|
|
@@ -3239,34 +3411,9 @@ function desktopNotification(str) {
|
|
|
3239
3411
|
/**
|
|
3240
3412
|
* Renders a chat message inside a `messageTable`
|
|
3241
3413
|
*/
|
|
3242
|
-
function insertMessageIntoTable(
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
// const message = messageRow.AJAR_subject
|
|
3246
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3247
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
3248
|
-
options.selectedElement = messageRow;
|
|
3249
|
-
messageTable.selectedElement = messageRow;
|
|
3250
|
-
}
|
|
3251
|
-
var done = false;
|
|
3252
|
-
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
3253
|
-
if (!ele) {
|
|
3254
|
-
// empty
|
|
3255
|
-
break;
|
|
3256
|
-
}
|
|
3257
|
-
var newestFirst = options.newestfirst === true;
|
|
3258
|
-
var dateString = messageRow.AJAR_date;
|
|
3259
|
-
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
3260
|
-
messageTable.insertBefore(messageRow, ele);
|
|
3261
|
-
done = true;
|
|
3262
|
-
break;
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
if (!done) {
|
|
3266
|
-
messageTable.appendChild(messageRow);
|
|
3267
|
-
}
|
|
3414
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3415
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3268
3416
|
}
|
|
3269
|
-
|
|
3270
3417
|
/**
|
|
3271
3418
|
* Common code for a chat (discussion area of messages about something)
|
|
3272
3419
|
* This version runs over a series of files for different time periods
|
|
@@ -3289,20 +3436,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3289
3436
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3290
3437
|
|
|
3291
3438
|
*/
|
|
3292
|
-
function
|
|
3439
|
+
function _insertMessageIntoTable() {
|
|
3440
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3441
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3442
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3443
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3444
|
+
case 0:
|
|
3445
|
+
_context.next = 2;
|
|
3446
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3447
|
+
case 2:
|
|
3448
|
+
messageRow = _context.sent;
|
|
3449
|
+
// const message = messageRow.AJAR_subject
|
|
3450
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3451
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3452
|
+
options.selectedElement = messageRow;
|
|
3453
|
+
messageTable.selectedElement = messageRow;
|
|
3454
|
+
}
|
|
3455
|
+
done = false;
|
|
3456
|
+
ele = messageTable.firstChild;
|
|
3457
|
+
case 6:
|
|
3458
|
+
if (ele) {
|
|
3459
|
+
_context.next = 8;
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
return _context.abrupt("break", 17);
|
|
3463
|
+
case 8:
|
|
3464
|
+
newestFirst = options.newestfirst === true;
|
|
3465
|
+
dateString = messageRow.AJAR_date;
|
|
3466
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3467
|
+
_context.next = 14;
|
|
3468
|
+
break;
|
|
3469
|
+
}
|
|
3470
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3471
|
+
done = true;
|
|
3472
|
+
return _context.abrupt("break", 17);
|
|
3473
|
+
case 14:
|
|
3474
|
+
ele = ele.nextSibling;
|
|
3475
|
+
_context.next = 6;
|
|
3476
|
+
break;
|
|
3477
|
+
case 17:
|
|
3478
|
+
if (!done) {
|
|
3479
|
+
messageTable.appendChild(messageRow);
|
|
3480
|
+
}
|
|
3481
|
+
case 18:
|
|
3482
|
+
case "end":
|
|
3483
|
+
return _context.stop();
|
|
3484
|
+
}
|
|
3485
|
+
}, _callee);
|
|
3486
|
+
}));
|
|
3487
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3488
|
+
}
|
|
3489
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3293
3490
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3294
3491
|
}
|
|
3295
3492
|
function _infiniteMessageArea() {
|
|
3296
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3297
|
-
var syncMessages, addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, earliest, latest, lock;
|
|
3298
|
-
return _regenerator["default"].wrap(function
|
|
3299
|
-
while (1) switch (
|
|
3493
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
|
|
3494
|
+
var syncMessages, _syncMessages, addMessage, _addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, _renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, threadRootMessage, earliest, latest, thread, threadTime, lock;
|
|
3495
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3496
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3300
3497
|
case 0:
|
|
3301
3498
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3302
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3303
|
-
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3304
|
-
return _regenerator["default"].wrap(function
|
|
3305
|
-
while (1) switch (
|
|
3499
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
3500
|
+
var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3501
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3502
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3306
3503
|
case 0:
|
|
3307
3504
|
fixScroll = function _fixScroll() {
|
|
3308
3505
|
if (options.selectedElement) {
|
|
@@ -3316,51 +3513,59 @@ function _infiniteMessageArea() {
|
|
|
3316
3513
|
}
|
|
3317
3514
|
};
|
|
3318
3515
|
yank = function _yank() {
|
|
3319
|
-
selectedMessageTable.selectedElement
|
|
3320
|
-
|
|
3321
|
-
|
|
3516
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3517
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3518
|
+
block: 'center'
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3322
3521
|
};
|
|
3323
3522
|
if (options.selectedMessage) {
|
|
3324
3523
|
selectedDocument = options.selectedMessage.doc();
|
|
3524
|
+
}
|
|
3525
|
+
if (threadRootMessage) {
|
|
3526
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3527
|
+
}
|
|
3528
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3529
|
+
if (initialDocment) {
|
|
3325
3530
|
now = new Date();
|
|
3326
3531
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3327
|
-
live = todayDocument.sameTerm(
|
|
3532
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3328
3533
|
}
|
|
3329
|
-
if (!(
|
|
3330
|
-
|
|
3534
|
+
if (!(initialDocment && !live)) {
|
|
3535
|
+
_context14.next = 18;
|
|
3331
3536
|
break;
|
|
3332
3537
|
}
|
|
3333
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3334
|
-
|
|
3538
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3539
|
+
_context14.next = 10;
|
|
3335
3540
|
return createMessageTable(selectedDate, live);
|
|
3336
|
-
case
|
|
3337
|
-
selectedMessageTable =
|
|
3541
|
+
case 10:
|
|
3542
|
+
selectedMessageTable = _context14.sent;
|
|
3338
3543
|
div.appendChild(selectedMessageTable);
|
|
3339
3544
|
earliest.messageTable = selectedMessageTable;
|
|
3340
3545
|
latest.messageTable = selectedMessageTable;
|
|
3341
3546
|
yank();
|
|
3342
3547
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3343
|
-
|
|
3548
|
+
_context14.next = 22;
|
|
3344
3549
|
break;
|
|
3345
|
-
case
|
|
3346
|
-
|
|
3550
|
+
case 18:
|
|
3551
|
+
_context14.next = 20;
|
|
3347
3552
|
return appendCurrentMessages();
|
|
3348
|
-
case
|
|
3553
|
+
case 20:
|
|
3349
3554
|
earliest.messageTable = liveMessageTable;
|
|
3350
3555
|
latest.messageTable = liveMessageTable;
|
|
3351
|
-
case
|
|
3352
|
-
|
|
3556
|
+
case 22:
|
|
3557
|
+
_context14.next = 24;
|
|
3353
3558
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3354
|
-
case
|
|
3559
|
+
case 24:
|
|
3355
3560
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3356
3561
|
if (options.solo) {
|
|
3357
3562
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3358
3563
|
}
|
|
3359
|
-
case
|
|
3564
|
+
case 26:
|
|
3360
3565
|
case "end":
|
|
3361
|
-
return
|
|
3566
|
+
return _context14.stop();
|
|
3362
3567
|
}
|
|
3363
|
-
},
|
|
3568
|
+
}, _callee14);
|
|
3364
3569
|
}));
|
|
3365
3570
|
return _loadInitialContent.apply(this, arguments);
|
|
3366
3571
|
};
|
|
@@ -3368,16 +3573,16 @@ function _infiniteMessageArea() {
|
|
|
3368
3573
|
return _loadInitialContent.apply(this, arguments);
|
|
3369
3574
|
};
|
|
3370
3575
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3371
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3576
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3372
3577
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3373
|
-
return _regenerator["default"].wrap(function
|
|
3374
|
-
while (1) switch (
|
|
3578
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3579
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3375
3580
|
case 0:
|
|
3376
3581
|
if (!lock) {
|
|
3377
|
-
|
|
3582
|
+
_context13.next = 2;
|
|
3378
3583
|
break;
|
|
3379
3584
|
}
|
|
3380
|
-
return
|
|
3585
|
+
return _context13.abrupt("return");
|
|
3381
3586
|
case 2:
|
|
3382
3587
|
lock = true;
|
|
3383
3588
|
freeze = !fixScroll;
|
|
@@ -3385,36 +3590,36 @@ function _infiniteMessageArea() {
|
|
|
3385
3590
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3386
3591
|
case 5:
|
|
3387
3592
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3388
|
-
|
|
3593
|
+
_context13.next = 21;
|
|
3389
3594
|
break;
|
|
3390
3595
|
}
|
|
3391
3596
|
if (!(div.scrollHeight === 0)) {
|
|
3392
|
-
|
|
3597
|
+
_context13.next = 10;
|
|
3393
3598
|
break;
|
|
3394
3599
|
}
|
|
3395
|
-
//
|
|
3600
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3396
3601
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3397
3602
|
lock = false;
|
|
3398
|
-
return
|
|
3603
|
+
return _context13.abrupt("return");
|
|
3399
3604
|
case 10:
|
|
3400
|
-
//
|
|
3605
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3401
3606
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3402
3607
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3403
|
-
|
|
3608
|
+
_context13.next = 14;
|
|
3404
3609
|
return earliest.messageTable.extendBackwards();
|
|
3405
3610
|
case 14:
|
|
3406
|
-
done =
|
|
3611
|
+
done = _context13.sent;
|
|
3407
3612
|
if (freeze) {
|
|
3408
3613
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3409
3614
|
}
|
|
3410
3615
|
if (fixScroll) fixScroll();
|
|
3411
3616
|
if (!done) {
|
|
3412
|
-
|
|
3617
|
+
_context13.next = 19;
|
|
3413
3618
|
break;
|
|
3414
3619
|
}
|
|
3415
|
-
return
|
|
3620
|
+
return _context13.abrupt("break", 21);
|
|
3416
3621
|
case 19:
|
|
3417
|
-
|
|
3622
|
+
_context13.next = 5;
|
|
3418
3623
|
break;
|
|
3419
3624
|
case 21:
|
|
3420
3625
|
if (!(options.selectedMessage &&
|
|
@@ -3424,15 +3629,15 @@ function _infiniteMessageArea() {
|
|
|
3424
3629
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3425
3630
|
// there is more data to come
|
|
3426
3631
|
latest.messageTable.extendForwards)) {
|
|
3427
|
-
|
|
3632
|
+
_context13.next = 33;
|
|
3428
3633
|
break;
|
|
3429
3634
|
}
|
|
3430
3635
|
scrollTop = div.scrollTop;
|
|
3431
3636
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3432
|
-
|
|
3637
|
+
_context13.next = 26;
|
|
3433
3638
|
return latest.messageTable.extendForwards();
|
|
3434
3639
|
case 26:
|
|
3435
|
-
done =
|
|
3640
|
+
done = _context13.sent;
|
|
3436
3641
|
// then add more data on the bottom
|
|
3437
3642
|
if (freeze) {
|
|
3438
3643
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3440,63 +3645,66 @@ function _infiniteMessageArea() {
|
|
|
3440
3645
|
|
|
3441
3646
|
if (fixScroll) fixScroll();
|
|
3442
3647
|
if (!done) {
|
|
3443
|
-
|
|
3648
|
+
_context13.next = 31;
|
|
3444
3649
|
break;
|
|
3445
3650
|
}
|
|
3446
|
-
return
|
|
3651
|
+
return _context13.abrupt("break", 33);
|
|
3447
3652
|
case 31:
|
|
3448
|
-
|
|
3653
|
+
_context13.next = 21;
|
|
3449
3654
|
break;
|
|
3450
3655
|
case 33:
|
|
3451
3656
|
lock = false;
|
|
3452
3657
|
case 34:
|
|
3453
3658
|
case "end":
|
|
3454
|
-
return
|
|
3659
|
+
return _context13.stop();
|
|
3455
3660
|
}
|
|
3456
|
-
},
|
|
3661
|
+
}, _callee13);
|
|
3457
3662
|
}));
|
|
3458
3663
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3459
3664
|
};
|
|
3460
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3665
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3461
3666
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3462
3667
|
};
|
|
3463
3668
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3464
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3669
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3465
3670
|
var now, chatDocument, messageTable;
|
|
3466
|
-
return _regenerator["default"].wrap(function
|
|
3467
|
-
while (1) switch (
|
|
3671
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3672
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3468
3673
|
case 0:
|
|
3469
3674
|
now = new Date();
|
|
3470
3675
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3471
|
-
|
|
3676
|
+
_context12.next = 4;
|
|
3472
3677
|
return createMessageTable(now, true);
|
|
3473
3678
|
case 4:
|
|
3474
|
-
messageTable =
|
|
3679
|
+
messageTable = _context12.sent;
|
|
3475
3680
|
div.appendChild(messageTable);
|
|
3476
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3477
|
-
return _regenerator["default"].wrap(function
|
|
3478
|
-
while (1) switch (
|
|
3681
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3682
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3683
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3479
3684
|
case 0:
|
|
3480
|
-
|
|
3685
|
+
_context11.next = 2;
|
|
3481
3686
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3482
3687
|
case 2:
|
|
3483
|
-
|
|
3484
|
-
|
|
3688
|
+
_context11.next = 4;
|
|
3689
|
+
return syncMessages(chatChannel, messageTable);
|
|
3485
3690
|
case 4:
|
|
3691
|
+
// @@ livemessagetable??
|
|
3692
|
+
desktopNotification(chatChannel);
|
|
3693
|
+
case 5:
|
|
3486
3694
|
case "end":
|
|
3487
|
-
return
|
|
3695
|
+
return _context11.stop();
|
|
3488
3696
|
}
|
|
3489
|
-
},
|
|
3697
|
+
}, _callee11);
|
|
3490
3698
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3491
3699
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3492
3700
|
liveMessageTable = messageTable;
|
|
3493
3701
|
latest.messageTable = liveMessageTable;
|
|
3494
|
-
return
|
|
3702
|
+
return _context12.abrupt("return", messageTable);
|
|
3495
3703
|
case 11:
|
|
3496
3704
|
case "end":
|
|
3497
|
-
return
|
|
3705
|
+
return _context12.stop();
|
|
3498
3706
|
}
|
|
3499
|
-
},
|
|
3707
|
+
}, _callee12);
|
|
3500
3708
|
}));
|
|
3501
3709
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3502
3710
|
};
|
|
@@ -3504,15 +3712,15 @@ function _infiniteMessageArea() {
|
|
|
3504
3712
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3505
3713
|
};
|
|
3506
3714
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3507
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3715
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3508
3716
|
var newChatDocument, oldChatDocument, sts;
|
|
3509
|
-
return _regenerator["default"].wrap(function
|
|
3510
|
-
while (1) switch (
|
|
3717
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3718
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3511
3719
|
case 0:
|
|
3512
3720
|
// @@ Remove listener from previous table as it is now static
|
|
3513
3721
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3514
3722
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3515
|
-
|
|
3723
|
+
_context10.next = 7;
|
|
3516
3724
|
break;
|
|
3517
3725
|
}
|
|
3518
3726
|
// It is a new day
|
|
@@ -3521,7 +3729,7 @@ function _infiniteMessageArea() {
|
|
|
3521
3729
|
delete liveMessageTable.inputRow;
|
|
3522
3730
|
}
|
|
3523
3731
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3524
|
-
|
|
3732
|
+
_context10.next = 6;
|
|
3525
3733
|
return appendCurrentMessages();
|
|
3526
3734
|
case 6:
|
|
3527
3735
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3535,286 +3743,322 @@ function _infiniteMessageArea() {
|
|
|
3535
3743
|
}
|
|
3536
3744
|
case 7:
|
|
3537
3745
|
case "end":
|
|
3538
|
-
return
|
|
3746
|
+
return _context10.stop();
|
|
3539
3747
|
}
|
|
3540
|
-
},
|
|
3748
|
+
}, _callee10);
|
|
3541
3749
|
}));
|
|
3542
3750
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3543
3751
|
};
|
|
3544
3752
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3545
3753
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3546
3754
|
};
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3755
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3756
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
|
|
3757
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3758
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3759
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3762
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
3763
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3764
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3765
|
+
case 0:
|
|
3766
|
+
if (!messageTable.extendedForwards) {
|
|
3767
|
+
_context8.next = 6;
|
|
3768
|
+
break;
|
|
3769
|
+
}
|
|
3770
|
+
removePreviousMessages(false, messageTable);
|
|
3771
|
+
messageTable.extendedForwards = false;
|
|
3772
|
+
setScrollForwardButtonIcon();
|
|
3773
|
+
_context8.next = 9;
|
|
3774
|
+
break;
|
|
3775
|
+
case 6:
|
|
3776
|
+
_context8.next = 8;
|
|
3777
|
+
return extendForwards();
|
|
3778
|
+
case 8:
|
|
3779
|
+
// async
|
|
3780
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3781
|
+
case 9:
|
|
3782
|
+
case "end":
|
|
3783
|
+
return _context8.stop();
|
|
3784
|
+
}
|
|
3785
|
+
}, _callee8);
|
|
3786
|
+
}));
|
|
3787
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3788
|
+
};
|
|
3789
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
|
|
3790
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3791
|
+
};
|
|
3792
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3793
|
+
if (!scrollForwardButton) return;
|
|
3794
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3795
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3796
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3797
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3798
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3799
|
+
}
|
|
3800
|
+
};
|
|
3801
|
+
_extendForwards = function _extendForwards3() {
|
|
3802
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
3803
|
+
var done;
|
|
3804
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3805
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3806
|
+
case 0:
|
|
3807
|
+
_context7.next = 2;
|
|
3808
|
+
return insertPreviousMessages(false);
|
|
3809
|
+
case 2:
|
|
3810
|
+
done = _context7.sent;
|
|
3811
|
+
return _context7.abrupt("return", done);
|
|
3812
|
+
case 4:
|
|
3813
|
+
case "end":
|
|
3814
|
+
return _context7.stop();
|
|
3815
|
+
}
|
|
3816
|
+
}, _callee7);
|
|
3817
|
+
}));
|
|
3818
|
+
return _extendForwards.apply(this, arguments);
|
|
3819
|
+
};
|
|
3820
|
+
extendForwards = function _extendForwards2() {
|
|
3821
|
+
return _extendForwards.apply(this, arguments);
|
|
3822
|
+
};
|
|
3823
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3824
|
+
if (!scrollBackbutton) {
|
|
3825
|
+
return;
|
|
3826
|
+
}
|
|
3827
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3828
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3829
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3830
|
+
function getScrollbackIcon(sense) {
|
|
3831
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3832
|
+
}
|
|
3833
|
+
};
|
|
3834
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3835
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3836
|
+
var done;
|
|
3837
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3838
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3839
|
+
case 0:
|
|
3840
|
+
_context6.next = 2;
|
|
3841
|
+
return insertPreviousMessages(true);
|
|
3842
|
+
case 2:
|
|
3843
|
+
done = _context6.sent;
|
|
3844
|
+
if (done) {
|
|
3845
|
+
if (scrollBackbutton) {
|
|
3846
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3847
|
+
scrollBackbutton.disabled = true;
|
|
3848
|
+
}
|
|
3849
|
+
messageTable.initial = true;
|
|
3850
|
+
} else {
|
|
3851
|
+
messageTable.extendedBack = true;
|
|
3852
|
+
}
|
|
3853
|
+
setScrollBackbuttonIcon();
|
|
3854
|
+
return _context6.abrupt("return", done);
|
|
3855
|
+
case 6:
|
|
3856
|
+
case "end":
|
|
3857
|
+
return _context6.stop();
|
|
3858
|
+
}
|
|
3859
|
+
}, _callee6);
|
|
3860
|
+
}));
|
|
3861
|
+
return _extendBackwards.apply(this, arguments);
|
|
3862
|
+
};
|
|
3863
|
+
extendBackwards = function _extendBackwards2() {
|
|
3864
|
+
return _extendBackwards.apply(this, arguments);
|
|
3865
|
+
};
|
|
3866
|
+
scrollBackbutton = null; // was let
|
|
3867
|
+
scrollForwardButton = null; // was let
|
|
3868
|
+
/// ///////////////// Scroll down adding more above
|
|
3869
|
+
/// ///////////////////////
|
|
3870
|
+
/*
|
|
3871
|
+
options = options || {}
|
|
3872
|
+
options.authorDateOnLeft = true
|
|
3873
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3874
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3875
|
+
const dateFolder = channelObject.dateFolder
|
|
3876
|
+
const div = dom.createElement('div')
|
|
3877
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3878
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3879
|
+
*/
|
|
3880
|
+
debug.log('Options for called message Area', options);
|
|
3881
|
+
messageTable = dom.createElement('table');
|
|
3882
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3883
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3884
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3550
3885
|
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
case 2:
|
|
3564
|
-
done = _context.sent;
|
|
3565
|
-
if (done) {
|
|
3566
|
-
if (scrollBackbutton) {
|
|
3567
|
-
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3568
|
-
scrollBackbutton.disabled = true;
|
|
3569
|
-
}
|
|
3570
|
-
messageTable.initial = true;
|
|
3886
|
+
messageTable.date = date;
|
|
3887
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3888
|
+
messageTable.chatDocument = chatDocument;
|
|
3889
|
+
messageTable.fresh = false;
|
|
3890
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3891
|
+
if (live) {
|
|
3892
|
+
messageTable["final"] = true;
|
|
3893
|
+
liveMessageTable = messageTable;
|
|
3894
|
+
latest.messageTable = messageTable;
|
|
3895
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3896
|
+
if (newestFirst) {
|
|
3897
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3571
3898
|
} else {
|
|
3572
|
-
messageTable.
|
|
3899
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3573
3900
|
}
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3901
|
+
|
|
3902
|
+
messageTable.inputRow = tr;
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/// ///// Infinite scroll
|
|
3906
|
+
//
|
|
3907
|
+
// @@ listen for swipe past end event not just button
|
|
3908
|
+
test = true;
|
|
3909
|
+
if (test) {
|
|
3910
|
+
// ws options.infinite but need for non-infinite
|
|
3911
|
+
titleTR = dom.createElement('tr');
|
|
3912
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3913
|
+
// down triangles: noun_1369241.svg
|
|
3914
|
+
/*
|
|
3915
|
+
const scrollBackIcon = newestFirst
|
|
3916
|
+
? 'noun_1369241.svg'
|
|
3917
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3918
|
+
scrollBackbutton = widgets.button(
|
|
3919
|
+
dom,
|
|
3920
|
+
icons.iconBase + scrollBackIcon,
|
|
3921
|
+
'Previous messages ...'
|
|
3922
|
+
)
|
|
3923
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3924
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3925
|
+
messageTable.extendedBack = false
|
|
3926
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3927
|
+
setScrollBackbuttonIcon()
|
|
3928
|
+
*/
|
|
3929
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3930
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3931
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3932
|
+
|
|
3933
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3934
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3935
|
+
if (options.includeRemoveButton) {
|
|
3936
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3937
|
+
div.parentNode.removeChild(div);
|
|
3938
|
+
}));
|
|
3939
|
+
}
|
|
3940
|
+
/*
|
|
3941
|
+
const scrollForwardIcon = newestFirst
|
|
3942
|
+
? 'noun_1369241.svg'
|
|
3943
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3944
|
+
scrollForwardButton = widgets.button(
|
|
3945
|
+
dom,
|
|
3946
|
+
icons.iconBase + scrollForwardIcon,
|
|
3947
|
+
'Later messages ...'
|
|
3948
|
+
)
|
|
3949
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3950
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3951
|
+
scrollForwardButton.addEventListener(
|
|
3952
|
+
'click',
|
|
3953
|
+
scrollForwardButtonHandler,
|
|
3954
|
+
false
|
|
3955
|
+
)
|
|
3956
|
+
messageTable.extendedForward = false
|
|
3957
|
+
setScrollForwardButtonIcon()
|
|
3958
|
+
*/
|
|
3959
|
+
messageTable.extendedForwards = false;
|
|
3960
|
+
if (!newestFirst) {
|
|
3961
|
+
// opposite end from the entry field
|
|
3962
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
3963
|
+
} else {
|
|
3964
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
3606
3965
|
}
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3966
|
+
}
|
|
3967
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3968
|
+
if (!live && sts.length === 0) {
|
|
3969
|
+
// not todays
|
|
3970
|
+
// no need buttomns at the moment
|
|
3971
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3972
|
+
}
|
|
3973
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
3974
|
+
_context9.prev = 26;
|
|
3975
|
+
_iterator2.s();
|
|
3976
|
+
case 28:
|
|
3977
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
3978
|
+
_context9.next = 34;
|
|
3611
3979
|
break;
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
case "end":
|
|
3647
|
-
return _context3.stop();
|
|
3648
|
-
}
|
|
3649
|
-
}, _callee3);
|
|
3650
|
-
}));
|
|
3651
|
-
return _extendForwards.apply(this, arguments);
|
|
3652
|
-
}
|
|
3653
|
-
function setScrollForwardButtonIcon() {
|
|
3654
|
-
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3655
|
-
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3656
|
-
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3657
|
-
function getScrollForwardButtonIcon(sense) {
|
|
3658
|
-
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3659
|
-
}
|
|
3660
|
-
}
|
|
3661
|
-
function scrollForwardButtonHandler(_x9) {
|
|
3662
|
-
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3663
|
-
} /// ///////////////////////
|
|
3664
|
-
/*
|
|
3665
|
-
options = options || {}
|
|
3666
|
-
options.authorDateOnLeft = true
|
|
3667
|
-
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3668
|
-
const channelObject = new ChatChannel(chatChannel, options)
|
|
3669
|
-
const dateFolder = channelObject.dateFolder
|
|
3670
|
-
const div = dom.createElement('div')
|
|
3671
|
-
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3672
|
-
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3673
|
-
*/
|
|
3674
|
-
function _scrollForwardButtonHandler() {
|
|
3675
|
-
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
3676
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
3677
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
3678
|
-
case 0:
|
|
3679
|
-
if (!messageTable.extendedForwards) {
|
|
3680
|
-
_context4.next = 6;
|
|
3681
|
-
break;
|
|
3682
|
-
}
|
|
3683
|
-
removePreviousMessages(false, messageTable);
|
|
3684
|
-
messageTable.extendedForwards = false;
|
|
3685
|
-
setScrollForwardButtonIcon();
|
|
3686
|
-
_context4.next = 9;
|
|
3687
|
-
break;
|
|
3688
|
-
case 6:
|
|
3689
|
-
_context4.next = 8;
|
|
3690
|
-
return extendForwards();
|
|
3691
|
-
case 8:
|
|
3692
|
-
// async
|
|
3693
|
-
latest.messageTable.scrollIntoView(newestFirst);
|
|
3694
|
-
case 9:
|
|
3695
|
-
case "end":
|
|
3696
|
-
return _context4.stop();
|
|
3697
|
-
}
|
|
3698
|
-
}, _callee4);
|
|
3699
|
-
}));
|
|
3700
|
-
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3701
|
-
}
|
|
3702
|
-
var messageTable = dom.createElement('table');
|
|
3703
|
-
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3704
|
-
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3705
|
-
|
|
3706
|
-
messageTable.date = date;
|
|
3707
|
-
var chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3708
|
-
messageTable.chatDocument = chatDocument;
|
|
3709
|
-
messageTable.fresh = false;
|
|
3710
|
-
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3711
|
-
if (live) {
|
|
3712
|
-
messageTable["final"] = true;
|
|
3713
|
-
liveMessageTable = messageTable;
|
|
3714
|
-
latest.messageTable = messageTable;
|
|
3715
|
-
var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3716
|
-
if (newestFirst) {
|
|
3717
|
-
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3718
|
-
} else {
|
|
3719
|
-
messageTable.appendChild(tr); // not newestFirst
|
|
3720
|
-
}
|
|
3721
|
-
|
|
3722
|
-
messageTable.inputRow = tr;
|
|
3723
|
-
}
|
|
3724
|
-
|
|
3725
|
-
/// ///// Infinite scroll
|
|
3726
|
-
//
|
|
3727
|
-
// @@ listen for swipe past end event not just button
|
|
3728
|
-
if (options.infinite) {
|
|
3729
|
-
var scrollBackbuttonTR = dom.createElement('tr');
|
|
3730
|
-
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3731
|
-
// up traingles: noun_1369237.svg
|
|
3732
|
-
// down triangles: noun_1369241.svg
|
|
3733
|
-
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3734
|
-
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
3735
|
-
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
3736
|
-
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
3737
|
-
messageTable.extendedBack = false;
|
|
3738
|
-
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
3739
|
-
setScrollBackbuttonIcon();
|
|
3740
|
-
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3741
|
-
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3742
|
-
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3743
|
-
|
|
3744
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3745
|
-
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3746
|
-
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3747
|
-
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
3748
|
-
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
3749
|
-
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
3750
|
-
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
3751
|
-
messageTable.extendedForward = false;
|
|
3752
|
-
setScrollForwardButtonIcon();
|
|
3753
|
-
messageTable.extendedForwards = false;
|
|
3754
|
-
if (!newestFirst) {
|
|
3755
|
-
// opposite end from the entry field
|
|
3756
|
-
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
3757
|
-
} else {
|
|
3758
|
-
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
3759
|
-
}
|
|
3760
|
-
}
|
|
3761
|
-
|
|
3762
|
-
var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3763
|
-
if (!live && sts.length === 0) {
|
|
3764
|
-
// not todays
|
|
3765
|
-
// no need buttomns at the moment
|
|
3766
|
-
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3767
|
-
}
|
|
3768
|
-
sts.forEach(function (st) {
|
|
3769
|
-
addMessage(st.object, messageTable);
|
|
3770
|
-
});
|
|
3771
|
-
messageTable.fresh = true;
|
|
3772
|
-
|
|
3773
|
-
// loadMessageTable(messageTable, chatDocument)
|
|
3774
|
-
messageTable.fresh = false;
|
|
3775
|
-
return messageTable;
|
|
3980
|
+
}
|
|
3981
|
+
st = _step2.value;
|
|
3982
|
+
_context9.next = 32;
|
|
3983
|
+
return addMessage(st.object, messageTable);
|
|
3984
|
+
case 32:
|
|
3985
|
+
_context9.next = 28;
|
|
3986
|
+
break;
|
|
3987
|
+
case 34:
|
|
3988
|
+
_context9.next = 39;
|
|
3989
|
+
break;
|
|
3990
|
+
case 36:
|
|
3991
|
+
_context9.prev = 36;
|
|
3992
|
+
_context9.t0 = _context9["catch"](26);
|
|
3993
|
+
_iterator2.e(_context9.t0);
|
|
3994
|
+
case 39:
|
|
3995
|
+
_context9.prev = 39;
|
|
3996
|
+
_iterator2.f();
|
|
3997
|
+
return _context9.finish(39);
|
|
3998
|
+
case 42:
|
|
3999
|
+
messageTable.fresh = true;
|
|
4000
|
+
|
|
4001
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4002
|
+
messageTable.fresh = false;
|
|
4003
|
+
return _context9.abrupt("return", messageTable);
|
|
4004
|
+
case 45:
|
|
4005
|
+
case "end":
|
|
4006
|
+
return _context9.stop();
|
|
4007
|
+
}
|
|
4008
|
+
}, _callee9, null, [[26, 36, 39, 42]]);
|
|
4009
|
+
}));
|
|
4010
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4011
|
+
};
|
|
4012
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4013
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3776
4014
|
};
|
|
3777
4015
|
_createMessageTable = function _createMessageTable3() {
|
|
3778
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4016
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3779
4017
|
var chatDocument, messageTable, statusTR;
|
|
3780
|
-
return _regenerator["default"].wrap(function
|
|
3781
|
-
while (1) switch (
|
|
4018
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4019
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3782
4020
|
case 0:
|
|
3783
4021
|
debug.log(' createMessageTable for ' + date);
|
|
3784
4022
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3785
|
-
|
|
3786
|
-
|
|
4023
|
+
_context5.prev = 2;
|
|
4024
|
+
_context5.next = 5;
|
|
3787
4025
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3788
4026
|
case 5:
|
|
3789
|
-
|
|
4027
|
+
_context5.next = 21;
|
|
3790
4028
|
break;
|
|
3791
4029
|
case 7:
|
|
3792
|
-
|
|
3793
|
-
|
|
4030
|
+
_context5.prev = 7;
|
|
4031
|
+
_context5.t0 = _context5["catch"](2);
|
|
3794
4032
|
messageTable = dom.createElement('table');
|
|
3795
4033
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3796
|
-
if (!(
|
|
3797
|
-
|
|
4034
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4035
|
+
_context5.next = 18;
|
|
3798
4036
|
break;
|
|
3799
4037
|
}
|
|
3800
4038
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
4039
|
+
_context5.next = 15;
|
|
4040
|
+
return renderMessageTable(date, live);
|
|
4041
|
+
case 15:
|
|
4042
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3805
4043
|
case 18:
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4044
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4045
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3809
4046
|
case 20:
|
|
4047
|
+
return _context5.abrupt("return", statusTR);
|
|
4048
|
+
case 21:
|
|
4049
|
+
_context5.next = 23;
|
|
4050
|
+
return renderMessageTable(date, live);
|
|
4051
|
+
case 23:
|
|
4052
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4053
|
+
case 24:
|
|
3810
4054
|
case "end":
|
|
3811
|
-
return
|
|
4055
|
+
return _context5.stop();
|
|
3812
4056
|
}
|
|
3813
|
-
},
|
|
4057
|
+
}, _callee5, null, [[2, 7]]);
|
|
3814
4058
|
}));
|
|
3815
4059
|
return _createMessageTable.apply(this, arguments);
|
|
3816
4060
|
};
|
|
3817
|
-
createMessageTable = function _createMessageTable2(
|
|
4061
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3818
4062
|
return _createMessageTable.apply(this, arguments);
|
|
3819
4063
|
};
|
|
3820
4064
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3833,32 +4077,40 @@ function _infiniteMessageArea() {
|
|
|
3833
4077
|
extr.messageTable = messageTable;
|
|
3834
4078
|
};
|
|
3835
4079
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3836
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4080
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3837
4081
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3838
|
-
return _regenerator["default"].wrap(function
|
|
3839
|
-
while (1) switch (
|
|
4082
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4083
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3840
4084
|
case 0:
|
|
3841
4085
|
extremity = backwards ? earliest : latest;
|
|
3842
4086
|
date = extremity.messageTable.date; // day in mssecs
|
|
3843
|
-
|
|
3844
|
-
|
|
4087
|
+
// Are we at the top of a thread?
|
|
4088
|
+
if (!(backwards && earliest.limit && date <= earliest.limit)) {
|
|
4089
|
+
_context4.next = 4;
|
|
4090
|
+
break;
|
|
4091
|
+
}
|
|
4092
|
+
return _context4.abrupt("return", true);
|
|
3845
4093
|
case 4:
|
|
3846
|
-
|
|
4094
|
+
_context4.next = 6;
|
|
4095
|
+
return dateFolder.loadPrevious(date, backwards);
|
|
4096
|
+
case 6:
|
|
4097
|
+
date = _context4.sent;
|
|
3847
4098
|
// backwards
|
|
4099
|
+
|
|
3848
4100
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3849
4101
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3850
|
-
|
|
4102
|
+
_context4.next = 11;
|
|
3851
4103
|
break;
|
|
3852
4104
|
}
|
|
3853
|
-
|
|
4105
|
+
_context4.next = 11;
|
|
3854
4106
|
return appendCurrentMessages();
|
|
3855
|
-
case
|
|
4107
|
+
case 11:
|
|
3856
4108
|
if (date) {
|
|
3857
|
-
|
|
4109
|
+
_context4.next = 13;
|
|
3858
4110
|
break;
|
|
3859
4111
|
}
|
|
3860
|
-
return
|
|
3861
|
-
case
|
|
4112
|
+
return _context4.abrupt("return", true);
|
|
4113
|
+
case 13:
|
|
3862
4114
|
// done
|
|
3863
4115
|
live = false;
|
|
3864
4116
|
if (!backwards) {
|
|
@@ -3866,10 +4118,10 @@ function _infiniteMessageArea() {
|
|
|
3866
4118
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3867
4119
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3868
4120
|
}
|
|
3869
|
-
|
|
4121
|
+
_context4.next = 17;
|
|
3870
4122
|
return createMessageTable(date, live);
|
|
3871
|
-
case
|
|
3872
|
-
newMessageTable =
|
|
4123
|
+
case 17:
|
|
4124
|
+
newMessageTable = _context4.sent;
|
|
3873
4125
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3874
4126
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3875
4127
|
// put on bottom or top
|
|
@@ -3878,62 +4130,160 @@ function _infiniteMessageArea() {
|
|
|
3878
4130
|
// put on top as we scroll back
|
|
3879
4131
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3880
4132
|
}
|
|
3881
|
-
return
|
|
3882
|
-
case
|
|
4133
|
+
return _context4.abrupt("return", live);
|
|
4134
|
+
case 21:
|
|
3883
4135
|
case "end":
|
|
3884
|
-
return
|
|
4136
|
+
return _context4.stop();
|
|
3885
4137
|
}
|
|
3886
|
-
},
|
|
4138
|
+
}, _callee4);
|
|
3887
4139
|
}));
|
|
3888
4140
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3889
4141
|
};
|
|
3890
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4142
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3891
4143
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3892
4144
|
};
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
4145
|
+
_addMessage = function _addMessage3() {
|
|
4146
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4147
|
+
var thread, id;
|
|
4148
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4149
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4150
|
+
case 0:
|
|
4151
|
+
if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
|
|
4152
|
+
_context3.next = 2;
|
|
4153
|
+
break;
|
|
4154
|
+
}
|
|
4155
|
+
return _context3.abrupt("return");
|
|
4156
|
+
case 2:
|
|
4157
|
+
if (!(0, _chatLogic.isReplaced)(message)) {
|
|
4158
|
+
_context3.next = 4;
|
|
4159
|
+
break;
|
|
4160
|
+
}
|
|
4161
|
+
return _context3.abrupt("return");
|
|
4162
|
+
case 4:
|
|
4163
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4164
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4165
|
+
if (id && !thread) {
|
|
4166
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4167
|
+
}
|
|
4168
|
+
if (!options.thread) {
|
|
4169
|
+
_context3.next = 20;
|
|
4170
|
+
break;
|
|
4171
|
+
}
|
|
4172
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4173
|
+
_context3.next = 12;
|
|
4174
|
+
break;
|
|
4175
|
+
}
|
|
4176
|
+
// root of thread
|
|
4177
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4178
|
+
_context3.next = 18;
|
|
4179
|
+
break;
|
|
4180
|
+
case 12:
|
|
4181
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4182
|
+
_context3.next = 16;
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4186
|
+
_context3.next = 18;
|
|
4187
|
+
break;
|
|
4188
|
+
case 16:
|
|
4189
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4190
|
+
return _context3.abrupt("return");
|
|
4191
|
+
case 18:
|
|
4192
|
+
_context3.next = 26;
|
|
4193
|
+
break;
|
|
4194
|
+
case 20:
|
|
4195
|
+
if (!thread) {
|
|
4196
|
+
_context3.next = 25;
|
|
4197
|
+
break;
|
|
4198
|
+
}
|
|
4199
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4200
|
+
return _context3.abrupt("return");
|
|
4201
|
+
case 25:
|
|
4202
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4203
|
+
case 26:
|
|
4204
|
+
_context3.next = 28;
|
|
4205
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4206
|
+
case 28:
|
|
4207
|
+
case "end":
|
|
4208
|
+
return _context3.stop();
|
|
4209
|
+
}
|
|
4210
|
+
}, _callee3);
|
|
4211
|
+
}));
|
|
4212
|
+
return _addMessage.apply(this, arguments);
|
|
3901
4213
|
};
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
4214
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4215
|
+
return _addMessage.apply(this, arguments);
|
|
4216
|
+
};
|
|
4217
|
+
_syncMessages = function _syncMessages3() {
|
|
4218
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4219
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4220
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4221
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4222
|
+
case 0:
|
|
4223
|
+
displayed = {};
|
|
4224
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4225
|
+
if (ele.AJAR_subject) {
|
|
4226
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4230
|
+
stored = {};
|
|
4231
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4232
|
+
_context2.prev = 5;
|
|
4233
|
+
_iterator.s();
|
|
4234
|
+
case 7:
|
|
4235
|
+
if ((_step = _iterator.n()).done) {
|
|
4236
|
+
_context2.next = 15;
|
|
4237
|
+
break;
|
|
4238
|
+
}
|
|
4239
|
+
m = _step.value;
|
|
4240
|
+
stored[m.uri] = true;
|
|
4241
|
+
if (displayed[m.uri]) {
|
|
4242
|
+
_context2.next = 13;
|
|
4243
|
+
break;
|
|
4244
|
+
}
|
|
4245
|
+
_context2.next = 13;
|
|
4246
|
+
return addMessage(m, messageTable);
|
|
4247
|
+
case 13:
|
|
4248
|
+
_context2.next = 7;
|
|
4249
|
+
break;
|
|
4250
|
+
case 15:
|
|
4251
|
+
_context2.next = 20;
|
|
4252
|
+
break;
|
|
4253
|
+
case 17:
|
|
4254
|
+
_context2.prev = 17;
|
|
4255
|
+
_context2.t0 = _context2["catch"](5);
|
|
4256
|
+
_iterator.e(_context2.t0);
|
|
4257
|
+
case 20:
|
|
4258
|
+
_context2.prev = 20;
|
|
4259
|
+
_iterator.f();
|
|
4260
|
+
return _context2.finish(20);
|
|
4261
|
+
case 23:
|
|
4262
|
+
// eslint-disable-next-line space-in-parens
|
|
4263
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4264
|
+
ele2 = ele.nextSibling;
|
|
4265
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4266
|
+
messageTable.removeChild(ele);
|
|
4267
|
+
}
|
|
4268
|
+
ele = ele2;
|
|
4269
|
+
}
|
|
4270
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4271
|
+
if (ele.AJAR_subject) {
|
|
4272
|
+
// Refresh thumbs up etc
|
|
4273
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
case 25:
|
|
4277
|
+
case "end":
|
|
4278
|
+
return _context2.stop();
|
|
4279
|
+
}
|
|
4280
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4281
|
+
}));
|
|
4282
|
+
return _syncMessages.apply(this, arguments);
|
|
4283
|
+
};
|
|
4284
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4285
|
+
return _syncMessages.apply(this, arguments);
|
|
3935
4286
|
};
|
|
3936
|
-
|
|
3937
4287
|
// Body of main function
|
|
3938
4288
|
|
|
3939
4289
|
options = options || {};
|
|
@@ -3949,23 +4299,33 @@ function _infiniteMessageArea() {
|
|
|
3949
4299
|
statusArea: statusArea,
|
|
3950
4300
|
div: statusArea
|
|
3951
4301
|
}; // logged on state, pointers to user's stuff
|
|
3952
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3953
4302
|
earliest = {
|
|
3954
4303
|
messageTable: null
|
|
3955
4304
|
}; // Stuff about each end of the loaded days
|
|
3956
4305
|
latest = {
|
|
3957
4306
|
messageTable: null
|
|
3958
4307
|
};
|
|
4308
|
+
if (options.thread) {
|
|
4309
|
+
thread = options.thread;
|
|
4310
|
+
threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
|
|
4311
|
+
if (threadRootMessage) {
|
|
4312
|
+
threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
|
|
4313
|
+
if (threadTime) {
|
|
4314
|
+
earliest.limit = new Date(threadTime.value);
|
|
4315
|
+
debug.log(' inifinite: thread start at ' + earliest.limit);
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
3959
4319
|
lock = false;
|
|
3960
|
-
|
|
4320
|
+
_context15.next = 34;
|
|
3961
4321
|
return loadInitialContent();
|
|
3962
|
-
case
|
|
3963
|
-
return
|
|
3964
|
-
case
|
|
4322
|
+
case 34:
|
|
4323
|
+
return _context15.abrupt("return", div);
|
|
4324
|
+
case 35:
|
|
3965
4325
|
case "end":
|
|
3966
|
-
return
|
|
4326
|
+
return _context15.stop();
|
|
3967
4327
|
}
|
|
3968
|
-
},
|
|
4328
|
+
}, _callee15);
|
|
3969
4329
|
}));
|
|
3970
4330
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3971
4331
|
}
|
|
@@ -3994,6 +4354,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
3994
4354
|
exports.renderMessageRow = renderMessageRow;
|
|
3995
4355
|
exports.switchToEditor = switchToEditor;
|
|
3996
4356
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4357
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
3997
4358
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
3998
4359
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
3999
4360
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4011,7 +4372,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4011
4372
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4012
4373
|
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); }
|
|
4013
4374
|
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; }
|
|
4014
|
-
function
|
|
4375
|
+
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; }
|
|
4376
|
+
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; }
|
|
4377
|
+
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; } } }; }
|
|
4015
4378
|
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); }
|
|
4016
4379
|
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; }
|
|
4017
4380
|
var dom = window.document;
|
|
@@ -4090,122 +4453,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4090
4453
|
/**
|
|
4091
4454
|
* Renders a chat message, read-only mode
|
|
4092
4455
|
*/
|
|
4093
|
-
function renderMessageRow(
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4456
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4457
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4458
|
+
}
|
|
4459
|
+
function _renderMessageRow() {
|
|
4460
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4461
|
+
var colorizeByAuthor, creator, date, latestVersion, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
|
|
4462
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4463
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4464
|
+
case 0:
|
|
4465
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4466
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4467
|
+
};
|
|
4468
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4469
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4470
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4471
|
+
_context10.next = 6;
|
|
4472
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4473
|
+
case 6:
|
|
4474
|
+
latestVersion = _context10.sent;
|
|
4475
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4476
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4477
|
+
_context10.next = 10;
|
|
4478
|
+
return (0, _chatLogic.allVersions)(message);
|
|
4479
|
+
case 10:
|
|
4480
|
+
versions = _context10.sent;
|
|
4481
|
+
if (versions.length > 1) {
|
|
4482
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4483
|
+
}
|
|
4484
|
+
// be tolerant in accepting replies on any version of a message
|
|
4485
|
+
replies = versions.map(function (version) {
|
|
4486
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4487
|
+
}).flat();
|
|
4488
|
+
thread = null;
|
|
4489
|
+
straightReplies = [];
|
|
4490
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4491
|
+
try {
|
|
4492
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4493
|
+
reply = _step2.value;
|
|
4494
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4495
|
+
thread = reply;
|
|
4496
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4497
|
+
} else {
|
|
4498
|
+
straightReplies.push(reply);
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
} catch (err) {
|
|
4502
|
+
_iterator2.e(err);
|
|
4503
|
+
} finally {
|
|
4504
|
+
_iterator2.f();
|
|
4505
|
+
}
|
|
4506
|
+
if (straightReplies.length > 1) {
|
|
4507
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4508
|
+
}
|
|
4509
|
+
_context10.next = 20;
|
|
4510
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4511
|
+
case 20:
|
|
4512
|
+
originalMessage = _context10.sent;
|
|
4513
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4514
|
+
// @@@ kludge!
|
|
4515
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4516
|
+
messageRow = dom.createElement('tr');
|
|
4517
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4518
|
+
messageRow.AJAR_subject = message;
|
|
4519
|
+
td1 = dom.createElement('td');
|
|
4520
|
+
messageRow.appendChild(td1);
|
|
4521
|
+
if (!options.authorDateOnLeft) {
|
|
4522
|
+
img = dom.createElement('img');
|
|
4523
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4524
|
+
widgets.setImage(img, creator);
|
|
4525
|
+
td1.appendChild(img);
|
|
4526
|
+
} else {
|
|
4527
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4528
|
+
}
|
|
4529
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4530
|
+
if (edited) {
|
|
4531
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
// Render the content ot the message itself
|
|
4535
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4536
|
+
if (!options.authorDateOnLeft) {
|
|
4537
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4538
|
+
// widgets.shortDate(dateString)
|
|
4539
|
+
message);
|
|
4540
|
+
}
|
|
4541
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4542
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4543
|
+
para = null;
|
|
4544
|
+
if (isURI) {
|
|
4545
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4546
|
+
if (isImage && options.expandImagesInline) {
|
|
4547
|
+
_img = elementForImageURI(text, options);
|
|
4548
|
+
td2.appendChild(_img);
|
|
4549
|
+
} else {
|
|
4550
|
+
// Link but not Image
|
|
4551
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4552
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4553
|
+
anc.href = text;
|
|
4554
|
+
para.textContent = text;
|
|
4555
|
+
td2.appendChild(anc);
|
|
4556
|
+
}
|
|
4557
|
+
} else {
|
|
4558
|
+
// text
|
|
4559
|
+
para = dom.createElement('p');
|
|
4560
|
+
td2.appendChild(para);
|
|
4561
|
+
para.textContent = text;
|
|
4562
|
+
}
|
|
4563
|
+
if (para) {
|
|
4564
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4565
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4566
|
+
}
|
|
4567
|
+
_context10.next = 40;
|
|
4568
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4569
|
+
case 40:
|
|
4570
|
+
strip = _context10.sent;
|
|
4571
|
+
if (strip.children.length) {
|
|
4572
|
+
td2.appendChild(dom.createElement('br'));
|
|
4573
|
+
td2.appendChild(strip);
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
// Message tool bar button
|
|
4577
|
+
td3 = dom.createElement('td');
|
|
4578
|
+
messageRow.appendChild(td3);
|
|
4579
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4580
|
+
td3.appendChild(toolsButton);
|
|
4581
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4582
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4583
|
+
var toolsTR, tools, toolsTD;
|
|
4584
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4585
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4586
|
+
case 0:
|
|
4587
|
+
if (!messageRow.toolTR) {
|
|
4588
|
+
_context9.next = 4;
|
|
4589
|
+
break;
|
|
4590
|
+
}
|
|
4591
|
+
// already got a toolbar? Toogle
|
|
4592
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4593
|
+
delete messageRow.toolTR;
|
|
4594
|
+
return _context9.abrupt("return");
|
|
4595
|
+
case 4:
|
|
4596
|
+
toolsTR = dom.createElement('tr');
|
|
4597
|
+
_context9.next = 7;
|
|
4598
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4599
|
+
chatOptions: options
|
|
4600
|
+
}), channelObject);
|
|
4601
|
+
case 7:
|
|
4602
|
+
tools = _context9.sent;
|
|
4603
|
+
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
|
|
4604
|
+
if (messageRow.nextSibling) {
|
|
4605
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4606
|
+
} else {
|
|
4607
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4608
|
+
}
|
|
4609
|
+
messageRow.toolTR = toolsTR;
|
|
4610
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4611
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4612
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4613
|
+
toolsTD.appendChild(tools);
|
|
4614
|
+
case 15:
|
|
4615
|
+
case "end":
|
|
4616
|
+
return _context9.stop();
|
|
4617
|
+
}
|
|
4618
|
+
}, _callee8);
|
|
4619
|
+
}));
|
|
4620
|
+
return function (_x20) {
|
|
4621
|
+
return _ref4.apply(this, arguments);
|
|
4622
|
+
};
|
|
4623
|
+
}());
|
|
4624
|
+
if (thread && options.showThread) {
|
|
4625
|
+
debug.log(' message has thread ' + thread);
|
|
4626
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
4627
|
+
// right arrow .. @@ think of stg better
|
|
4628
|
+
'see thread', function (_e) {
|
|
4629
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
4630
|
+
options.showThread(thread, options);
|
|
4631
|
+
}));
|
|
4632
|
+
}
|
|
4633
|
+
return _context10.abrupt("return", messageRow);
|
|
4634
|
+
case 49:
|
|
4635
|
+
case "end":
|
|
4636
|
+
return _context10.stop();
|
|
4637
|
+
}
|
|
4638
|
+
}, _callee9);
|
|
4639
|
+
}));
|
|
4640
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4192
4641
|
}
|
|
4193
|
-
function switchToEditor(
|
|
4194
|
-
|
|
4195
|
-
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
4196
|
-
messageTable.insertBefore(editRow, messageRow);
|
|
4197
|
-
editRow.originalRow = messageRow;
|
|
4198
|
-
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4642
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4643
|
+
return _switchToEditor.apply(this, arguments);
|
|
4199
4644
|
}
|
|
4200
4645
|
/* Control for a new message -- or editing an old message ***************
|
|
4201
4646
|
*
|
|
4202
4647
|
*/
|
|
4648
|
+
function _switchToEditor() {
|
|
4649
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
4650
|
+
var messageTable, editRow;
|
|
4651
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
4652
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
4653
|
+
case 0:
|
|
4654
|
+
messageTable = messageRow.parentNode;
|
|
4655
|
+
_context11.t0 = renderMessageEditor;
|
|
4656
|
+
_context11.t1 = channelObject;
|
|
4657
|
+
_context11.t2 = messageTable;
|
|
4658
|
+
_context11.t3 = userContext;
|
|
4659
|
+
_context11.t4 = channelObject.options;
|
|
4660
|
+
_context11.next = 8;
|
|
4661
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4662
|
+
case 8:
|
|
4663
|
+
_context11.t5 = _context11.sent;
|
|
4664
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
4665
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
4666
|
+
editRow.originalRow = messageRow;
|
|
4667
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4668
|
+
case 13:
|
|
4669
|
+
case "end":
|
|
4670
|
+
return _context11.stop();
|
|
4671
|
+
}
|
|
4672
|
+
}, _callee10);
|
|
4673
|
+
}));
|
|
4674
|
+
return _switchToEditor.apply(this, arguments);
|
|
4675
|
+
}
|
|
4203
4676
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4204
4677
|
function revertEditing(messageEditor) {
|
|
4205
4678
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4206
4679
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4207
4680
|
}
|
|
4208
|
-
function handleFieldInput(
|
|
4681
|
+
function handleFieldInput(_x10) {
|
|
4209
4682
|
return _handleFieldInput.apply(this, arguments);
|
|
4210
4683
|
}
|
|
4211
4684
|
function _handleFieldInput() {
|
|
@@ -4223,72 +4696,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4223
4696
|
}));
|
|
4224
4697
|
return _handleFieldInput.apply(this, arguments);
|
|
4225
4698
|
}
|
|
4226
|
-
function sendMessage(
|
|
4699
|
+
function sendMessage(_x11, _x12) {
|
|
4227
4700
|
return _sendMessage.apply(this, arguments);
|
|
4228
4701
|
} // sendMessage
|
|
4229
4702
|
// DRAG AND DROP
|
|
4230
4703
|
function _sendMessage() {
|
|
4231
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4232
|
-
var sendComplete, message, statusArea;
|
|
4233
|
-
return _regenerator["default"].wrap(function
|
|
4234
|
-
while (1) switch (
|
|
4704
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
4705
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
4706
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
4707
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4235
4708
|
case 0:
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4247
|
-
} else {
|
|
4248
|
-
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4249
|
-
oldRow.style.backgroundColor = '#fee';
|
|
4250
|
-
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4251
|
-
}
|
|
4709
|
+
_sendComplete = function _sendComplete3() {
|
|
4710
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
4711
|
+
var oldRow;
|
|
4712
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
4713
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4714
|
+
case 0:
|
|
4715
|
+
_context7.next = 2;
|
|
4716
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
4717
|
+
case 2:
|
|
4718
|
+
// not green
|
|
4252
4719
|
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
}
|
|
4264
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4265
|
-
};
|
|
4720
|
+
if (originalMessage) {
|
|
4721
|
+
// editing another message
|
|
4722
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
4723
|
+
if (oldRow.parentNode) {
|
|
4724
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4725
|
+
} else {
|
|
4726
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4727
|
+
oldRow.style.backgroundColor = '#fee';
|
|
4728
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4729
|
+
}
|
|
4266
4730
|
|
|
4731
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
4732
|
+
} else {
|
|
4733
|
+
if (fromMainField) {
|
|
4734
|
+
field.value = ''; // clear from out for reuse
|
|
4735
|
+
field.setAttribute('style', messageBodyStyle);
|
|
4736
|
+
field.disabled = false;
|
|
4737
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
4738
|
+
field.focus(); // Start typing next line immediately
|
|
4739
|
+
field.select();
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4743
|
+
case 3:
|
|
4744
|
+
case "end":
|
|
4745
|
+
return _context7.stop();
|
|
4746
|
+
}
|
|
4747
|
+
}, _callee6);
|
|
4748
|
+
}));
|
|
4749
|
+
return _sendComplete.apply(this, arguments);
|
|
4750
|
+
};
|
|
4751
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
4752
|
+
return _sendComplete.apply(this, arguments);
|
|
4753
|
+
};
|
|
4267
4754
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4268
4755
|
if (fromMainField) {
|
|
4269
4756
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4270
4757
|
field.disabled = true;
|
|
4271
4758
|
}
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4275
|
-
case
|
|
4276
|
-
message =
|
|
4277
|
-
|
|
4759
|
+
_context8.prev = 3;
|
|
4760
|
+
_context8.next = 6;
|
|
4761
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
4762
|
+
case 6:
|
|
4763
|
+
message = _context8.sent;
|
|
4764
|
+
_context8.next = 14;
|
|
4278
4765
|
break;
|
|
4279
|
-
case
|
|
4280
|
-
|
|
4281
|
-
|
|
4766
|
+
case 9:
|
|
4767
|
+
_context8.prev = 9;
|
|
4768
|
+
_context8.t0 = _context8["catch"](3);
|
|
4282
4769
|
statusArea = userContext.statusArea || messageEditor;
|
|
4283
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4284
|
-
return
|
|
4285
|
-
case 13:
|
|
4286
|
-
sendComplete(message, text);
|
|
4770
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4771
|
+
return _context8.abrupt("return");
|
|
4287
4772
|
case 14:
|
|
4773
|
+
_context8.next = 16;
|
|
4774
|
+
return sendComplete(message, text);
|
|
4775
|
+
case 16:
|
|
4288
4776
|
case "end":
|
|
4289
|
-
return
|
|
4777
|
+
return _context8.stop();
|
|
4290
4778
|
}
|
|
4291
|
-
},
|
|
4779
|
+
}, _callee7, null, [[3, 9]]);
|
|
4292
4780
|
}));
|
|
4293
4781
|
return _sendMessage.apply(this, arguments);
|
|
4294
4782
|
}
|
|
@@ -4307,7 +4795,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4307
4795
|
}
|
|
4308
4796
|
}, _callee);
|
|
4309
4797
|
}));
|
|
4310
|
-
return function (
|
|
4798
|
+
return function (_x13, _x14) {
|
|
4311
4799
|
return _ref.apply(this, arguments);
|
|
4312
4800
|
};
|
|
4313
4801
|
}());
|
|
@@ -4351,7 +4839,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4351
4839
|
}
|
|
4352
4840
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4353
4841
|
}));
|
|
4354
|
-
return function droppedURIHandler(
|
|
4842
|
+
return function droppedURIHandler(_x15) {
|
|
4355
4843
|
return _ref2.apply(this, arguments);
|
|
4356
4844
|
};
|
|
4357
4845
|
}();
|
|
@@ -4362,7 +4850,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4362
4850
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4363
4851
|
return imageDoc;
|
|
4364
4852
|
}
|
|
4365
|
-
function tookPicture(
|
|
4853
|
+
function tookPicture(_x16) {
|
|
4366
4854
|
return _tookPicture.apply(this, arguments);
|
|
4367
4855
|
} // Body of turnOnInput
|
|
4368
4856
|
function _tookPicture() {
|
|
@@ -4439,7 +4927,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4439
4927
|
}
|
|
4440
4928
|
}, _callee3);
|
|
4441
4929
|
}));
|
|
4442
|
-
return function (
|
|
4930
|
+
return function (_x17) {
|
|
4443
4931
|
return _ref3.apply(this, arguments);
|
|
4444
4932
|
};
|
|
4445
4933
|
}(), false);
|
|
@@ -4501,7 +4989,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4501
4989
|
turnOnInput();
|
|
4502
4990
|
Object.assign(context, userContext);
|
|
4503
4991
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4504
|
-
//
|
|
4992
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4505
4993
|
});
|
|
4506
4994
|
});
|
|
4507
4995
|
return messageEditor;
|
|
@@ -4524,12 +5012,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4524
5012
|
Object.defineProperty(exports, "__esModule", ({
|
|
4525
5013
|
value: true
|
|
4526
5014
|
}));
|
|
5015
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5016
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5017
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4527
5018
|
exports.messageToolbar = messageToolbar;
|
|
4528
5019
|
exports.sentimentStrip = sentimentStrip;
|
|
4529
5020
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4530
5021
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4531
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4532
5022
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5023
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4533
5024
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4534
5025
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4535
5026
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4570,30 +5061,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4570
5061
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4571
5062
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4572
5063
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5064
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4573
5065
|
/**
|
|
4574
5066
|
* Emoji in Unicode
|
|
4575
5067
|
*/
|
|
4576
|
-
var
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
5068
|
+
var emojiMap = {};
|
|
5069
|
+
emojiMap[ns.schema('AgreeAction')] = '👍';
|
|
5070
|
+
emojiMap[ns.schema('DisagreeAction')] = '👎';
|
|
5071
|
+
emojiMap[ns.schema('EndorseAction')] = '⭐️';
|
|
5072
|
+
emojiMap[ns.schema('LikeAction')] = '❤️';
|
|
5073
|
+
function emojiFromActionClass(action) {
|
|
5074
|
+
return emojiMap[action] || null;
|
|
5075
|
+
}
|
|
5076
|
+
function ActionClassFromEmoji(emoji) {
|
|
5077
|
+
for (var a in emojiMap) {
|
|
5078
|
+
if (emojiMap[a] === emoji) {
|
|
5079
|
+
return rdf.sym(a.slice(1, -1)); // remove < >
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
|
|
5083
|
+
return null;
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
// Allow the action to give its own emoji as content,
|
|
5087
|
+
// or get the emoji from the class of action.
|
|
5088
|
+
function emojiFromAction(action) {
|
|
5089
|
+
var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
|
|
5090
|
+
if (content) return content;
|
|
5091
|
+
var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
|
|
5092
|
+
if (klass) {
|
|
5093
|
+
var em = emojiFromActionClass(klass);
|
|
5094
|
+
if (em) return em;
|
|
5095
|
+
}
|
|
5096
|
+
return '⬜️';
|
|
5097
|
+
}
|
|
4581
5098
|
|
|
4582
5099
|
/**
|
|
4583
5100
|
* Create strip of sentiments expressed
|
|
4584
5101
|
*/
|
|
4585
|
-
function sentimentStrip(
|
|
4586
|
-
|
|
4587
|
-
var latest = (0, _chatLogic.mostRecentVersion)(target);
|
|
4588
|
-
var actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
4589
|
-
var sentiments = actions.map(function (a) {
|
|
4590
|
-
return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
|
|
4591
|
-
});
|
|
4592
|
-
sentiments.sort();
|
|
4593
|
-
var strings = sentiments.map(function (x) {
|
|
4594
|
-
return emoji[x] || '';
|
|
4595
|
-
});
|
|
4596
|
-
return dom.createTextNode(strings.join(' '));
|
|
5102
|
+
function sentimentStrip(_x, _x2) {
|
|
5103
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4597
5104
|
}
|
|
4598
5105
|
/**
|
|
4599
5106
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4601,276 +5108,445 @@ function sentimentStrip(target, doc) {
|
|
|
4601
5108
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4602
5109
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4603
5110
|
*/
|
|
4604
|
-
function
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
5111
|
+
function _sentimentStrip() {
|
|
5112
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5113
|
+
var versions, actions, strings;
|
|
5114
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5115
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5116
|
+
case 0:
|
|
5117
|
+
_context.next = 2;
|
|
5118
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5119
|
+
case 2:
|
|
5120
|
+
versions = _context.sent;
|
|
5121
|
+
debug.log('sentimentStrip Versions for ' + target, versions);
|
|
5122
|
+
actions = versions.map(function (version) {
|
|
5123
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5124
|
+
}).flat();
|
|
5125
|
+
debug.log('sentimentStrip: Actions for ' + target, actions);
|
|
5126
|
+
strings = actions.map(function (action) {
|
|
5127
|
+
return emojiFromAction(action) || '';
|
|
5128
|
+
});
|
|
5129
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5130
|
+
case 8:
|
|
5131
|
+
case "end":
|
|
5132
|
+
return _context.stop();
|
|
4623
5133
|
}
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
return strip;
|
|
5134
|
+
}, _callee);
|
|
5135
|
+
}));
|
|
5136
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5137
|
+
}
|
|
5138
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5139
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4631
5140
|
}
|
|
4632
5141
|
/**
|
|
4633
5142
|
* Creates a message toolbar component
|
|
4634
5143
|
*/
|
|
4635
|
-
function
|
|
4636
|
-
function
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
5144
|
+
function _sentimentStripLinked() {
|
|
5145
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5146
|
+
var strip, refresh, _refresh;
|
|
5147
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5149
|
+
case 0:
|
|
5150
|
+
_refresh = function _refresh3() {
|
|
5151
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5152
|
+
var versions, actions, sentiments;
|
|
5153
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5154
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5155
|
+
case 0:
|
|
5156
|
+
strip.innerHTML = '';
|
|
5157
|
+
if (!(0, _chatLogic.isDeleted)(target)) {
|
|
5158
|
+
_context2.next = 3;
|
|
5159
|
+
break;
|
|
5160
|
+
}
|
|
5161
|
+
return _context2.abrupt("return", strip);
|
|
5162
|
+
case 3:
|
|
5163
|
+
_context2.next = 5;
|
|
5164
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5165
|
+
case 5:
|
|
5166
|
+
versions = _context2.sent;
|
|
5167
|
+
debug.log('sentimentStripLinked: Versions for ' + target, versions);
|
|
5168
|
+
actions = versions.map(function (version) {
|
|
5169
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5170
|
+
}).flat();
|
|
5171
|
+
debug.log('sentimentStripLinked: Actions for ' + target, actions);
|
|
5172
|
+
if (!(actions.length === 0)) {
|
|
5173
|
+
_context2.next = 11;
|
|
5174
|
+
break;
|
|
5175
|
+
}
|
|
5176
|
+
return _context2.abrupt("return", strip);
|
|
5177
|
+
case 11:
|
|
5178
|
+
sentiments = actions.map(function (a) {
|
|
5179
|
+
return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.sioc('content'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
|
|
5180
|
+
});
|
|
5181
|
+
debug.log(' Actions sentiments ', sentiments);
|
|
5182
|
+
sentiments.sort();
|
|
5183
|
+
sentiments.forEach(function (ss) {
|
|
5184
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 3),
|
|
5185
|
+
theClass = _ss[0],
|
|
5186
|
+
content = _ss[1],
|
|
5187
|
+
agent = _ss[2];
|
|
5188
|
+
var res;
|
|
5189
|
+
if (agent) {
|
|
5190
|
+
res = dom.createElement('a');
|
|
5191
|
+
res.setAttribute('href', agent.uri);
|
|
5192
|
+
} else {
|
|
5193
|
+
res = dom.createTextNode('');
|
|
5194
|
+
}
|
|
5195
|
+
res.textContent = content || emojiMap[theClass] || '⬜️';
|
|
5196
|
+
strip.appendChild(res);
|
|
5197
|
+
});
|
|
5198
|
+
debug.log(' Actions strip ', strip);
|
|
5199
|
+
case 16:
|
|
5200
|
+
case "end":
|
|
5201
|
+
return _context2.stop();
|
|
5202
|
+
}
|
|
5203
|
+
}, _callee2);
|
|
5204
|
+
}));
|
|
5205
|
+
return _refresh.apply(this, arguments);
|
|
5206
|
+
};
|
|
5207
|
+
refresh = function _refresh2() {
|
|
5208
|
+
return _refresh.apply(this, arguments);
|
|
5209
|
+
};
|
|
5210
|
+
strip = dom.createElement('span');
|
|
5211
|
+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
|
|
5212
|
+
strip.refresh = refresh;
|
|
5213
|
+
return _context3.abrupt("return", strip);
|
|
5214
|
+
case 6:
|
|
5215
|
+
case "end":
|
|
5216
|
+
return _context3.stop();
|
|
5217
|
+
}
|
|
5218
|
+
}, _callee3);
|
|
5219
|
+
}));
|
|
5220
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5221
|
+
}
|
|
5222
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5223
|
+
return _messageToolbar.apply(this, arguments);
|
|
5224
|
+
}
|
|
5225
|
+
function _messageToolbar() {
|
|
5226
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5227
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5228
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5229
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5230
|
+
case 0:
|
|
5231
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5232
|
+
function setColor() {
|
|
5233
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
4649
5234
|
}
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
5235
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5236
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5237
|
+
var insertMe, dirty, i, a;
|
|
5238
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5239
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5240
|
+
case 0:
|
|
5241
|
+
if (!action) {
|
|
5242
|
+
_context4.next = 7;
|
|
5243
|
+
break;
|
|
5244
|
+
}
|
|
5245
|
+
_context4.next = 3;
|
|
5246
|
+
return deleteThingThen(action);
|
|
5247
|
+
case 3:
|
|
5248
|
+
action = null;
|
|
5249
|
+
setColor();
|
|
5250
|
+
_context4.next = 25;
|
|
5251
|
+
break;
|
|
5252
|
+
case 7:
|
|
5253
|
+
// no action
|
|
5254
|
+
action = widgets.newThing(doc);
|
|
5255
|
+
insertMe = [rdf.st(action, ns.schema('agent'), context.me, doc), rdf.st(action, ns.rdf('type'), actionClass, doc), rdf.st(action, ns.schema('target'), target, doc)];
|
|
5256
|
+
_context4.next = 11;
|
|
5257
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5258
|
+
case 11:
|
|
5259
|
+
setColor();
|
|
5260
|
+
if (!mutuallyExclusive) {
|
|
5261
|
+
_context4.next = 25;
|
|
5262
|
+
break;
|
|
5263
|
+
}
|
|
5264
|
+
// Delete incompative sentiments
|
|
5265
|
+
dirty = false;
|
|
5266
|
+
i = 0;
|
|
5267
|
+
case 15:
|
|
5268
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5269
|
+
_context4.next = 24;
|
|
5270
|
+
break;
|
|
5271
|
+
}
|
|
5272
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5273
|
+
if (!a) {
|
|
5274
|
+
_context4.next = 21;
|
|
5275
|
+
break;
|
|
5276
|
+
}
|
|
5277
|
+
_context4.next = 20;
|
|
5278
|
+
return deleteThingThen(a);
|
|
5279
|
+
case 20:
|
|
5280
|
+
// but how refresh? refreshTree the parent?
|
|
5281
|
+
dirty = true;
|
|
5282
|
+
case 21:
|
|
5283
|
+
i++;
|
|
5284
|
+
_context4.next = 15;
|
|
5285
|
+
break;
|
|
5286
|
+
case 24:
|
|
5287
|
+
if (dirty) {
|
|
5288
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5289
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5290
|
+
}
|
|
5291
|
+
case 25:
|
|
5292
|
+
case "end":
|
|
5293
|
+
return _context4.stop();
|
|
5294
|
+
}
|
|
5295
|
+
}, _callee4);
|
|
5296
|
+
}));
|
|
5297
|
+
return function (_x11) {
|
|
5298
|
+
return _ref.apply(this, arguments);
|
|
5299
|
+
};
|
|
5300
|
+
}());
|
|
5301
|
+
function existingAction(actionClass) {
|
|
5302
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5303
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5304
|
+
}).filter(function (x) {
|
|
5305
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5306
|
+
});
|
|
5307
|
+
return actions.length ? actions[0] : null;
|
|
4657
5308
|
}
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
case 9:
|
|
4662
|
-
_context2.next = 18;
|
|
4663
|
-
break;
|
|
4664
|
-
case 11:
|
|
4665
|
-
_context2.prev = 11;
|
|
4666
|
-
_context2.t0 = _context2["catch"](6);
|
|
4667
|
-
msg = 'Error deleting messaage ' + _context2.t0;
|
|
4668
|
-
debug.warn(msg);
|
|
4669
|
-
alert(msg);
|
|
4670
|
-
area = userContext.statusArea || messageRow.parentNode;
|
|
4671
|
-
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
4672
|
-
case 18:
|
|
4673
|
-
messageRow.parentNode.removeChild(messageRow);
|
|
4674
|
-
_context2.next = 22;
|
|
4675
|
-
break;
|
|
4676
|
-
case 21:
|
|
4677
|
-
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
4678
|
-
case 22:
|
|
4679
|
-
closeToolbar();
|
|
4680
|
-
case 23:
|
|
4681
|
-
case "end":
|
|
4682
|
-
return _context2.stop();
|
|
4683
|
-
}
|
|
4684
|
-
}, _callee2, null, [[6, 11]]);
|
|
4685
|
-
}));
|
|
4686
|
-
return _deleteMessage.apply(this, arguments);
|
|
4687
|
-
}
|
|
4688
|
-
function editMessage(_x) {
|
|
4689
|
-
return _editMessage.apply(this, arguments);
|
|
4690
|
-
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
4691
|
-
function _editMessage() {
|
|
4692
|
-
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
4693
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4694
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
4695
|
-
case 0:
|
|
4696
|
-
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
4697
|
-
closeToolbar(); // edit is a one-off action
|
|
4698
|
-
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5309
|
+
function refresh() {
|
|
5310
|
+
action = existingAction(actionClass);
|
|
5311
|
+
setColor();
|
|
4699
5312
|
}
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
5313
|
+
var action;
|
|
5314
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5315
|
+
refresh();
|
|
5316
|
+
return button;
|
|
5317
|
+
};
|
|
5318
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5319
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5320
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5321
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5322
|
+
case 0:
|
|
5323
|
+
_context9.next = 2;
|
|
5324
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5325
|
+
case 2:
|
|
5326
|
+
case "end":
|
|
5327
|
+
return _context9.stop();
|
|
5328
|
+
}
|
|
5329
|
+
}, _callee9);
|
|
5330
|
+
}));
|
|
5331
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5332
|
+
};
|
|
5333
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5334
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5335
|
+
};
|
|
5336
|
+
closeToolbar = function _closeToolbar() {
|
|
5337
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5338
|
+
};
|
|
5339
|
+
_replyInThread = function _replyInThread3() {
|
|
5340
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5341
|
+
var thread, options;
|
|
5342
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5343
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5344
|
+
case 0:
|
|
5345
|
+
_context8.next = 2;
|
|
5346
|
+
return channelObject.createThread(message);
|
|
5347
|
+
case 2:
|
|
5348
|
+
thread = _context8.sent;
|
|
5349
|
+
options = userContext.chatOptions;
|
|
5350
|
+
if (options) {
|
|
5351
|
+
_context8.next = 6;
|
|
5352
|
+
break;
|
|
5353
|
+
}
|
|
5354
|
+
throw new Error('replyInThread: missing options');
|
|
5355
|
+
case 6:
|
|
5356
|
+
options.showThread(thread, options);
|
|
5357
|
+
closeToolbar(); // a one-off action
|
|
5358
|
+
case 8:
|
|
5359
|
+
case "end":
|
|
5360
|
+
return _context8.stop();
|
|
5361
|
+
}
|
|
5362
|
+
}, _callee8);
|
|
5363
|
+
}));
|
|
5364
|
+
return _replyInThread.apply(this, arguments);
|
|
5365
|
+
};
|
|
5366
|
+
replyInThread = function _replyInThread2() {
|
|
5367
|
+
return _replyInThread.apply(this, arguments);
|
|
5368
|
+
};
|
|
5369
|
+
_editMessage = function _editMessage3() {
|
|
5370
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5371
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5372
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5373
|
+
case 0:
|
|
5374
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5375
|
+
_context7.next = 4;
|
|
5376
|
+
break;
|
|
5377
|
+
}
|
|
5378
|
+
closeToolbar(); // edit is a one-off action
|
|
5379
|
+
_context7.next = 4;
|
|
5380
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5381
|
+
case 4:
|
|
5382
|
+
case "end":
|
|
5383
|
+
return _context7.stop();
|
|
5384
|
+
}
|
|
5385
|
+
}, _callee7);
|
|
5386
|
+
}));
|
|
5387
|
+
return _editMessage.apply(this, arguments);
|
|
5388
|
+
};
|
|
5389
|
+
editMessage = function _editMessage2(_x9) {
|
|
5390
|
+
return _editMessage.apply(this, arguments);
|
|
5391
|
+
};
|
|
5392
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5393
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5394
|
+
var author, msg, area;
|
|
5395
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5396
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5397
|
+
case 0:
|
|
5398
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5399
|
+
if (me) {
|
|
5400
|
+
_context6.next = 5;
|
|
5401
|
+
break;
|
|
5402
|
+
}
|
|
5403
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5404
|
+
_context6.next = 22;
|
|
5405
|
+
break;
|
|
5406
|
+
case 5:
|
|
5407
|
+
if (!me.sameTerm(author)) {
|
|
5408
|
+
_context6.next = 21;
|
|
5409
|
+
break;
|
|
5410
|
+
}
|
|
5411
|
+
_context6.prev = 6;
|
|
5412
|
+
_context6.next = 9;
|
|
5413
|
+
return channelObject.deleteMessage(message);
|
|
5414
|
+
case 9:
|
|
5415
|
+
_context6.next = 18;
|
|
5416
|
+
break;
|
|
5417
|
+
case 11:
|
|
5418
|
+
_context6.prev = 11;
|
|
5419
|
+
_context6.t0 = _context6["catch"](6);
|
|
5420
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5421
|
+
debug.warn(msg);
|
|
5422
|
+
alert(msg);
|
|
5423
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5424
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5425
|
+
case 18:
|
|
5426
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5427
|
+
_context6.next = 22;
|
|
5428
|
+
break;
|
|
5429
|
+
case 21:
|
|
5430
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5431
|
+
case 22:
|
|
5432
|
+
closeToolbar();
|
|
5433
|
+
case 23:
|
|
5434
|
+
case "end":
|
|
5435
|
+
return _context6.stop();
|
|
5436
|
+
}
|
|
5437
|
+
}, _callee6, null, [[6, 11]]);
|
|
5438
|
+
}));
|
|
5439
|
+
return _deleteMessage.apply(this, arguments);
|
|
5440
|
+
};
|
|
5441
|
+
deleteMessage = function _deleteMessage2() {
|
|
5442
|
+
return _deleteMessage.apply(this, arguments);
|
|
5443
|
+
};
|
|
5444
|
+
// alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5445
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5446
|
+
_context10.next = 13;
|
|
5447
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5448
|
+
case 13:
|
|
5449
|
+
_context10.t0 = _context10.sent;
|
|
5450
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5451
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5452
|
+
_context10.next = 17;
|
|
5453
|
+
break;
|
|
5454
|
+
}
|
|
5455
|
+
return _context10.abrupt("return", div);
|
|
5456
|
+
case 17:
|
|
5457
|
+
// Things only the original author can do
|
|
5458
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5459
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5460
|
+
// button to delete the message
|
|
5461
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5462
|
+
// button to edit the message
|
|
5463
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5464
|
+
return editMessage(messageRow);
|
|
5465
|
+
}));
|
|
5466
|
+
} // if mine
|
|
5467
|
+
// Things anyone can do if they have a bookmark list async
|
|
5468
|
+
/*
|
|
5469
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5470
|
+
if (bookmarkButton) {
|
|
5471
|
+
div.appendChild(bookmarkButton)
|
|
5472
|
+
}
|
|
5473
|
+
*/
|
|
5474
|
+
// Things anyone can do if they have a bookmark list
|
|
4749
5475
|
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
5476
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5477
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5478
|
+
});
|
|
4753
5479
|
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
while (1) switch (_context.prev = _context.next) {
|
|
4772
|
-
case 0:
|
|
4773
|
-
if (!action) {
|
|
4774
|
-
_context.next = 7;
|
|
4775
|
-
break;
|
|
4776
|
-
}
|
|
4777
|
-
_context.next = 3;
|
|
4778
|
-
return deleteThingThen(action);
|
|
4779
|
-
case 3:
|
|
4780
|
-
action = null;
|
|
4781
|
-
setColor();
|
|
4782
|
-
_context.next = 25;
|
|
4783
|
-
break;
|
|
4784
|
-
case 7:
|
|
4785
|
-
// no action
|
|
4786
|
-
action = widgets.newThing(doc);
|
|
4787
|
-
insertMe = [rdf.st(action, ns.schema('agent'), context.me, doc), rdf.st(action, ns.rdf('type'), actionClass, doc), rdf.st(action, ns.schema('target'), target, doc)];
|
|
4788
|
-
_context.next = 11;
|
|
4789
|
-
return _solidLogic.store.updater.update([], insertMe);
|
|
4790
|
-
case 11:
|
|
4791
|
-
setColor();
|
|
4792
|
-
if (!mutuallyExclusive) {
|
|
4793
|
-
_context.next = 25;
|
|
4794
|
-
break;
|
|
4795
|
-
}
|
|
4796
|
-
// Delete incompative sentiments
|
|
4797
|
-
dirty = false;
|
|
4798
|
-
i = 0;
|
|
4799
|
-
case 15:
|
|
4800
|
-
if (!(i < mutuallyExclusive.length)) {
|
|
4801
|
-
_context.next = 24;
|
|
4802
|
-
break;
|
|
4803
|
-
}
|
|
4804
|
-
a = existingAction(mutuallyExclusive[i]);
|
|
4805
|
-
if (!a) {
|
|
4806
|
-
_context.next = 21;
|
|
4807
|
-
break;
|
|
4808
|
-
}
|
|
4809
|
-
_context.next = 20;
|
|
4810
|
-
return deleteThingThen(a);
|
|
4811
|
-
case 20:
|
|
4812
|
-
// but how refresh? refreshTree the parent?
|
|
4813
|
-
dirty = true;
|
|
4814
|
-
case 21:
|
|
4815
|
-
i++;
|
|
4816
|
-
_context.next = 15;
|
|
4817
|
-
break;
|
|
4818
|
-
case 24:
|
|
4819
|
-
if (dirty) {
|
|
4820
|
-
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
4821
|
-
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
4822
|
-
}
|
|
4823
|
-
case 25:
|
|
4824
|
-
case "end":
|
|
4825
|
-
return _context.stop();
|
|
5480
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5481
|
+
*
|
|
5482
|
+
* @param context {Object} - Provide dom and me
|
|
5483
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5484
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5485
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5486
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5487
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5488
|
+
*/
|
|
5489
|
+
|
|
5490
|
+
// THUMBS_UP_ICON
|
|
5491
|
+
// https://schema.org/AgreeAction
|
|
5492
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5493
|
+
_context10.t2 = me;
|
|
5494
|
+
if (!_context10.t2) {
|
|
5495
|
+
_context10.next = 28;
|
|
5496
|
+
break;
|
|
4826
5497
|
}
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
// THUMBS_UP_ICON
|
|
4852
|
-
// https://schema.org/AgreeAction
|
|
4853
|
-
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
4854
|
-
// debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
|
|
5498
|
+
_context10.next = 25;
|
|
5499
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5500
|
+
case 25:
|
|
5501
|
+
_context10.t3 = _context10.sent;
|
|
5502
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5503
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5504
|
+
case 28:
|
|
5505
|
+
if (!_context10.t2) {
|
|
5506
|
+
_context10.next = 32;
|
|
5507
|
+
break;
|
|
5508
|
+
}
|
|
5509
|
+
context1 = {
|
|
5510
|
+
me: me,
|
|
5511
|
+
dom: dom,
|
|
5512
|
+
div: div
|
|
5513
|
+
};
|
|
5514
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5515
|
+
// @@ TODO use widgets.sentimentButton
|
|
5516
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5517
|
+
// Thumbs down
|
|
5518
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5519
|
+
case 32:
|
|
5520
|
+
// Reply buttton
|
|
4855
5521
|
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
5522
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5523
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5524
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5525
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5526
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5527
|
+
case 0:
|
|
5528
|
+
_context5.next = 2;
|
|
5529
|
+
return replyInThread();
|
|
5530
|
+
case 2:
|
|
5531
|
+
case "end":
|
|
5532
|
+
return _context5.stop();
|
|
5533
|
+
}
|
|
5534
|
+
}, _callee5);
|
|
5535
|
+
}))));
|
|
5536
|
+
}
|
|
5537
|
+
// X button to remove the tool UI itself
|
|
5538
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5539
|
+
cancelButton.style["float"] = 'right';
|
|
5540
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5541
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5542
|
+
return _context10.abrupt("return", div);
|
|
5543
|
+
case 38:
|
|
5544
|
+
case "end":
|
|
5545
|
+
return _context10.stop();
|
|
5546
|
+
}
|
|
5547
|
+
}, _callee10);
|
|
5548
|
+
}));
|
|
5549
|
+
return _messageToolbar.apply(this, arguments);
|
|
4874
5550
|
}
|
|
4875
5551
|
//# sourceMappingURL=messageTools.js.map
|
|
4876
5552
|
|
|
@@ -9502,6 +10178,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9502
10178
|
return new Promise(function (resolve, reject) {
|
|
9503
10179
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9504
10180
|
if (!sharedPreferences) {
|
|
10181
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
10182
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
10183
|
+
resolve(context);
|
|
10184
|
+
}
|
|
9505
10185
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9506
10186
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9507
10187
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -12922,8 +13602,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
12922
13602
|
}));
|
|
12923
13603
|
exports.versionInfo = void 0;
|
|
12924
13604
|
var versionInfo = {
|
|
12925
|
-
buildTime: '2023-04-11T07:
|
|
12926
|
-
commit: '
|
|
13605
|
+
buildTime: '2023-04-11T07:15:50Z',
|
|
13606
|
+
commit: '2ebac088b9ad4e3a70974ff50fb6c6c536beb035',
|
|
12927
13607
|
npmInfo: {
|
|
12928
13608
|
'solid-ui': '2.4.27',
|
|
12929
13609
|
npm: '8.19.4',
|