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