solid-ui 2.4.15 → 2.4.16-9d83fb17
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/lib/chat/bookmarks.js +14 -13
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +340 -0
- package/lib/chat/chatLogic.js.map +1 -0
- package/lib/chat/dateFolder.js +12 -12
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +285 -665
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +445 -71
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +165 -103
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +162 -32
- package/lib/chat/thread.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +1401 -986
- package/lib/webpack-bundle.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +8 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/package.json +1 -1
package/lib/webpack-bundle.js
CHANGED
|
@@ -5284,7 +5284,6 @@ var UI = {
|
|
|
5284
5284
|
var $rdf = UI.rdf;
|
|
5285
5285
|
var BOOK = $rdf.Namespace('http://www.w3.org/2002/01/bookmark#');
|
|
5286
5286
|
var BOOKMARK_ICON = 'noun_45961.svg';
|
|
5287
|
-
var kb = _logic.store;
|
|
5288
5287
|
var label = utils.label;
|
|
5289
5288
|
var dom = window.document || null;
|
|
5290
5289
|
/** Create a resource if it really does not exist
|
|
@@ -5295,19 +5294,20 @@ var dom = window.document || null;
|
|
|
5295
5294
|
|
|
5296
5295
|
function createIfNotExists(doc) {
|
|
5297
5296
|
return new Promise(function (resolve, reject) {
|
|
5298
|
-
|
|
5299
|
-
debug.log('createIfNotExists doc exists, all good ' + doc); //
|
|
5297
|
+
_logic.store.fetcher.load(doc).then(function (response) {
|
|
5298
|
+
debug.log('createIfNotExists doc exists, all good ' + doc); // store.fetcher.webOperation('HEAD', doc.uri).then(response => {
|
|
5300
5299
|
|
|
5301
5300
|
resolve(response);
|
|
5302
5301
|
}, function (err) {
|
|
5303
5302
|
if (err.response.status === 404) {
|
|
5304
5303
|
debug.log('createIfNotExists doc does NOT exist, will create... ' + doc);
|
|
5305
|
-
|
|
5304
|
+
|
|
5305
|
+
_logic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
5306
5306
|
data: '',
|
|
5307
5307
|
contentType: 'text/turtle'
|
|
5308
5308
|
}).then(function (response) {
|
|
5309
5309
|
// fetcher.requested[doc.uri] = 'done' // do not need to read ?? but no headers
|
|
5310
|
-
delete
|
|
5310
|
+
delete _logic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
5311
5311
|
|
|
5312
5312
|
debug.log('createIfNotExists doc created ok ' + doc);
|
|
5313
5313
|
resolve(response);
|
|
@@ -5326,13 +5326,14 @@ function createIfNotExists(doc) {
|
|
|
5326
5326
|
|
|
5327
5327
|
function updatePromise(del, ins) {
|
|
5328
5328
|
return new Promise(function (resolve, reject) {
|
|
5329
|
-
|
|
5329
|
+
_logic.store.updater.update(del, ins, function (uri, ok, errorBody) {
|
|
5330
5330
|
if (!ok) {
|
|
5331
5331
|
reject(new Error(errorBody));
|
|
5332
5332
|
} else {
|
|
5333
5333
|
resolve();
|
|
5334
5334
|
}
|
|
5335
5335
|
}); // callback
|
|
5336
|
+
|
|
5336
5337
|
}); // promise
|
|
5337
5338
|
} // export findBookmarkDocument,
|
|
5338
5339
|
|
|
@@ -5461,8 +5462,8 @@ function _addBookmark() {
|
|
|
5461
5462
|
throw new Error('Must be logged on to add Bookmark');
|
|
5462
5463
|
|
|
5463
5464
|
case 4:
|
|
5464
|
-
author =
|
|
5465
|
-
title = label(author) + ': ' +
|
|
5465
|
+
author = _logic.store.any(target, ns.foaf('maker'));
|
|
5466
|
+
title = label(author) + ': ' + _logic.store.anyValue(target, ns.sioc('content')).slice(0, 80); // @@ add chat title too?
|
|
5466
5467
|
|
|
5467
5468
|
bookmarkDoc = context.bookmarkDocument;
|
|
5468
5469
|
bookmark = UI.widgets.newThing(bookmarkDoc, title);
|
|
@@ -5507,10 +5508,10 @@ function _toggleBookmark() {
|
|
|
5507
5508
|
switch (_context3.prev = _context3.next) {
|
|
5508
5509
|
case 0:
|
|
5509
5510
|
_context3.next = 2;
|
|
5510
|
-
return
|
|
5511
|
+
return _logic.store.fetcher.load(userContext.bookmarkDocument);
|
|
5511
5512
|
|
|
5512
5513
|
case 2:
|
|
5513
|
-
bookmarks =
|
|
5514
|
+
bookmarks = _logic.store.each(null, BOOK('recalls'), target, userContext.bookmarkDocument);
|
|
5514
5515
|
|
|
5515
5516
|
if (!bookmarks.length) {
|
|
5516
5517
|
_context3.next = 24;
|
|
@@ -5535,7 +5536,7 @@ function _toggleBookmark() {
|
|
|
5535
5536
|
|
|
5536
5537
|
_context3.prev = 8;
|
|
5537
5538
|
_context3.next = 11;
|
|
5538
|
-
return updatePromise(
|
|
5539
|
+
return updatePromise(_logic.store.connectedStatements(bookmarks[i]), []);
|
|
5539
5540
|
|
|
5540
5541
|
case 11:
|
|
5541
5542
|
bookmarkButton.style.backgroundColor = 'white';
|
|
@@ -5597,10 +5598,10 @@ function _renderBookmarksButton() {
|
|
|
5597
5598
|
switch (_context4.prev = _context4.next) {
|
|
5598
5599
|
case 0:
|
|
5599
5600
|
_context4.next = 2;
|
|
5600
|
-
return
|
|
5601
|
+
return _logic.store.fetcher.load(userContext.bookmarkDocument);
|
|
5601
5602
|
|
|
5602
5603
|
case 2:
|
|
5603
|
-
bookmarked =
|
|
5604
|
+
bookmarked = _logic.store.any(null, BOOK('recalls'), bookmarkButton.target, userContext.bookmarkDocument);
|
|
5604
5605
|
bookmarkButton.style = UI.style.buttonStyle;
|
|
5605
5606
|
if (bookmarked) bookmarkButton.style.backgroundColor = 'yellow';
|
|
5606
5607
|
|
|
@@ -5646,6 +5647,357 @@ function _renderBookmarksButton() {
|
|
|
5646
5647
|
|
|
5647
5648
|
/***/ }),
|
|
5648
5649
|
|
|
5650
|
+
/***/ "./lib/chat/chatLogic.js":
|
|
5651
|
+
/*!*******************************!*\
|
|
5652
|
+
!*** ./lib/chat/chatLogic.js ***!
|
|
5653
|
+
\*******************************/
|
|
5654
|
+
/*! no static exports found */
|
|
5655
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
5656
|
+
|
|
5657
|
+
"use strict";
|
|
5658
|
+
|
|
5659
|
+
|
|
5660
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
5661
|
+
|
|
5662
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
5663
|
+
|
|
5664
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5665
|
+
value: true
|
|
5666
|
+
});
|
|
5667
|
+
exports.ChatChannel = void 0;
|
|
5668
|
+
exports._createIfNotExists = _createIfNotExists;
|
|
5669
|
+
exports.isDeleted = isDeleted;
|
|
5670
|
+
exports.isHidden = isHidden;
|
|
5671
|
+
exports.isReplaced = isReplaced;
|
|
5672
|
+
exports.mostRecentVersion = mostRecentVersion;
|
|
5673
|
+
exports.nick = nick;
|
|
5674
|
+
exports.originalVersion = originalVersion;
|
|
5675
|
+
|
|
5676
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
5677
|
+
|
|
5678
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
5679
|
+
|
|
5680
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
5681
|
+
|
|
5682
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
5683
|
+
|
|
5684
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
5685
|
+
|
|
5686
|
+
var _index = __webpack_require__(/*! ../authn/index */ "./lib/authn/index.js");
|
|
5687
|
+
|
|
5688
|
+
var _dateFolder = __webpack_require__(/*! ./dateFolder */ "./lib/chat/dateFolder.js");
|
|
5689
|
+
|
|
5690
|
+
var _logic = __webpack_require__(/*! ../logic */ "./lib/logic.js");
|
|
5691
|
+
|
|
5692
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
5693
|
+
|
|
5694
|
+
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
5695
|
+
|
|
5696
|
+
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
5697
|
+
|
|
5698
|
+
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); }
|
|
5699
|
+
|
|
5700
|
+
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; }
|
|
5701
|
+
|
|
5702
|
+
/**
|
|
5703
|
+
* Contains the [[ChatChannel]] class and logic for Solid Chat
|
|
5704
|
+
* @packageDocumentation
|
|
5705
|
+
*/
|
|
5706
|
+
// pull in first avoid cross-refs
|
|
5707
|
+
|
|
5708
|
+
/* The Solid logic for a 'LongChat'
|
|
5709
|
+
*/
|
|
5710
|
+
|
|
5711
|
+
/**
|
|
5712
|
+
* Common code for a chat (discussion area of messages about something)
|
|
5713
|
+
* This version runs over a series of files for different time periods
|
|
5714
|
+
*
|
|
5715
|
+
* Parameters for the whole chat like its title are stored on
|
|
5716
|
+
* index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
|
|
5717
|
+
*
|
|
5718
|
+
*/
|
|
5719
|
+
var ChatChannel = /*#__PURE__*/function () {
|
|
5720
|
+
function ChatChannel(channel, options) {
|
|
5721
|
+
(0, _classCallCheck2["default"])(this, ChatChannel);
|
|
5722
|
+
this.channel = channel;
|
|
5723
|
+
this.channelRoot = channel.doc();
|
|
5724
|
+
this.options = options;
|
|
5725
|
+
this.dateFolder = new _dateFolder.DateFolder(this.channelRoot, 'chat.ttl');
|
|
5726
|
+
this.div = null; // : HTMLElement
|
|
5727
|
+
}
|
|
5728
|
+
/* Store a new message in the web,
|
|
5729
|
+
*/
|
|
5730
|
+
|
|
5731
|
+
|
|
5732
|
+
(0, _createClass2["default"])(ChatChannel, [{
|
|
5733
|
+
key: "createMessage",
|
|
5734
|
+
value: function () {
|
|
5735
|
+
var _createMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(text) {
|
|
5736
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5737
|
+
while (1) {
|
|
5738
|
+
switch (_context.prev = _context.next) {
|
|
5739
|
+
case 0:
|
|
5740
|
+
return _context.abrupt("return", this.updateMessage(text));
|
|
5741
|
+
|
|
5742
|
+
case 1:
|
|
5743
|
+
case "end":
|
|
5744
|
+
return _context.stop();
|
|
5745
|
+
}
|
|
5746
|
+
}
|
|
5747
|
+
}, _callee, this);
|
|
5748
|
+
}));
|
|
5749
|
+
|
|
5750
|
+
function createMessage(_x) {
|
|
5751
|
+
return _createMessage.apply(this, arguments);
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
return createMessage;
|
|
5755
|
+
}()
|
|
5756
|
+
/* Store a new message in the web,
|
|
5757
|
+
as a replacement for an existing one.
|
|
5758
|
+
The old one iis left, and the two are linked
|
|
5759
|
+
*/
|
|
5760
|
+
|
|
5761
|
+
}, {
|
|
5762
|
+
key: "updateMessage",
|
|
5763
|
+
value: function () {
|
|
5764
|
+
var _updateMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(text) {
|
|
5765
|
+
var oldMsg,
|
|
5766
|
+
deleteIt,
|
|
5767
|
+
sts,
|
|
5768
|
+
now,
|
|
5769
|
+
timestamp,
|
|
5770
|
+
dateStamp,
|
|
5771
|
+
chatDocument,
|
|
5772
|
+
message,
|
|
5773
|
+
me,
|
|
5774
|
+
msg,
|
|
5775
|
+
_args2 = arguments;
|
|
5776
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5777
|
+
while (1) {
|
|
5778
|
+
switch (_context2.prev = _context2.next) {
|
|
5779
|
+
case 0:
|
|
5780
|
+
oldMsg = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
|
|
5781
|
+
deleteIt = _args2.length > 2 ? _args2[2] : undefined;
|
|
5782
|
+
sts = [];
|
|
5783
|
+
now = new Date();
|
|
5784
|
+
timestamp = '' + now.getTime();
|
|
5785
|
+
dateStamp = $rdf.term(now);
|
|
5786
|
+
chatDocument = oldMsg ? oldMsg.doc() : this.dateFolder.leafDocumentFromDate(now);
|
|
5787
|
+
message = _logic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
5788
|
+
|
|
5789
|
+
me = _index.authn.currentUser(); // If already logged on
|
|
5790
|
+
|
|
5791
|
+
if (oldMsg) {
|
|
5792
|
+
// edit message replaces old one
|
|
5793
|
+
sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument));
|
|
5794
|
+
|
|
5795
|
+
if (deleteIt) {
|
|
5796
|
+
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
5797
|
+
}
|
|
5798
|
+
} else {
|
|
5799
|
+
// link new message to channel
|
|
5800
|
+
sts.push($rdf.st(this.channel, ns.wf('message'), message, chatDocument));
|
|
5801
|
+
}
|
|
5802
|
+
|
|
5803
|
+
sts.push($rdf.st(message, ns.sioc('content'), _logic.store.literal(text), chatDocument));
|
|
5804
|
+
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
5805
|
+
|
|
5806
|
+
if (me) {
|
|
5807
|
+
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
5808
|
+
}
|
|
5809
|
+
|
|
5810
|
+
_context2.prev = 13;
|
|
5811
|
+
_context2.next = 16;
|
|
5812
|
+
return _logic.store.updater.update([], sts);
|
|
5813
|
+
|
|
5814
|
+
case 16:
|
|
5815
|
+
_context2.next = 24;
|
|
5816
|
+
break;
|
|
5817
|
+
|
|
5818
|
+
case 18:
|
|
5819
|
+
_context2.prev = 18;
|
|
5820
|
+
_context2.t0 = _context2["catch"](13);
|
|
5821
|
+
msg = 'Error saving chat message: ' + _context2.t0;
|
|
5822
|
+
debug.warn(msg);
|
|
5823
|
+
alert(msg);
|
|
5824
|
+
throw new Error(msg);
|
|
5825
|
+
|
|
5826
|
+
case 24:
|
|
5827
|
+
return _context2.abrupt("return", message);
|
|
5828
|
+
|
|
5829
|
+
case 25:
|
|
5830
|
+
case "end":
|
|
5831
|
+
return _context2.stop();
|
|
5832
|
+
}
|
|
5833
|
+
}
|
|
5834
|
+
}, _callee2, this, [[13, 18]]);
|
|
5835
|
+
}));
|
|
5836
|
+
|
|
5837
|
+
function updateMessage(_x2) {
|
|
5838
|
+
return _updateMessage.apply(this, arguments);
|
|
5839
|
+
}
|
|
5840
|
+
|
|
5841
|
+
return updateMessage;
|
|
5842
|
+
}()
|
|
5843
|
+
/* Mark a message as deleted
|
|
5844
|
+
* Wee add a new version of the message,m witha deletion flag (deletion date)
|
|
5845
|
+
* so that the deletion can be revoked by adding another non-deleted update
|
|
5846
|
+
*/
|
|
5847
|
+
|
|
5848
|
+
}, {
|
|
5849
|
+
key: "deleteMessage",
|
|
5850
|
+
value: function () {
|
|
5851
|
+
var _deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message) {
|
|
5852
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5853
|
+
while (1) {
|
|
5854
|
+
switch (_context3.prev = _context3.next) {
|
|
5855
|
+
case 0:
|
|
5856
|
+
return _context3.abrupt("return", this.updateMessage('(message deleted)', message, true));
|
|
5857
|
+
|
|
5858
|
+
case 1:
|
|
5859
|
+
case "end":
|
|
5860
|
+
return _context3.stop();
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5863
|
+
}, _callee3, this);
|
|
5864
|
+
}));
|
|
5865
|
+
|
|
5866
|
+
function deleteMessage(_x3) {
|
|
5867
|
+
return _deleteMessage.apply(this, arguments);
|
|
5868
|
+
}
|
|
5869
|
+
|
|
5870
|
+
return deleteMessage;
|
|
5871
|
+
}()
|
|
5872
|
+
}]);
|
|
5873
|
+
return ChatChannel;
|
|
5874
|
+
}(); // class ChatChannel
|
|
5875
|
+
|
|
5876
|
+
|
|
5877
|
+
exports.ChatChannel = ChatChannel;
|
|
5878
|
+
|
|
5879
|
+
function originalVersion(message) {
|
|
5880
|
+
var msg = message;
|
|
5881
|
+
|
|
5882
|
+
while (msg) {
|
|
5883
|
+
message = msg;
|
|
5884
|
+
msg = _logic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5887
|
+
return message;
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5890
|
+
function mostRecentVersion(message) {
|
|
5891
|
+
var msg = message;
|
|
5892
|
+
|
|
5893
|
+
while (msg) {
|
|
5894
|
+
message = msg;
|
|
5895
|
+
msg = _logic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
5896
|
+
}
|
|
5897
|
+
|
|
5898
|
+
return message;
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
function isDeleted(message) {
|
|
5902
|
+
return _logic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5905
|
+
function isReplaced(message) {
|
|
5906
|
+
return _logic.store.holds(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
5907
|
+
}
|
|
5908
|
+
|
|
5909
|
+
function isHidden(message) {
|
|
5910
|
+
return this.isDeleted(message) || this.isReplaced(message);
|
|
5911
|
+
} // A Nickname for a person
|
|
5912
|
+
|
|
5913
|
+
|
|
5914
|
+
function nick(person) {
|
|
5915
|
+
var s = _logic.store.any(person, ns.foaf('nick'));
|
|
5916
|
+
|
|
5917
|
+
if (s) return '' + s.value;
|
|
5918
|
+
return '' + utils.label(person);
|
|
5919
|
+
}
|
|
5920
|
+
|
|
5921
|
+
function _createIfNotExists(_x4) {
|
|
5922
|
+
return _createIfNotExists2.apply(this, arguments);
|
|
5923
|
+
} // ends
|
|
5924
|
+
|
|
5925
|
+
|
|
5926
|
+
function _createIfNotExists2() {
|
|
5927
|
+
_createIfNotExists2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(doc) {
|
|
5928
|
+
var contentType,
|
|
5929
|
+
data,
|
|
5930
|
+
response,
|
|
5931
|
+
_args4 = arguments;
|
|
5932
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5933
|
+
while (1) {
|
|
5934
|
+
switch (_context4.prev = _context4.next) {
|
|
5935
|
+
case 0:
|
|
5936
|
+
contentType = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 'text/turtle';
|
|
5937
|
+
data = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : '';
|
|
5938
|
+
_context4.prev = 2;
|
|
5939
|
+
_context4.next = 5;
|
|
5940
|
+
return _logic.store.fetcher.load(doc);
|
|
5941
|
+
|
|
5942
|
+
case 5:
|
|
5943
|
+
response = _context4.sent;
|
|
5944
|
+
_context4.next = 28;
|
|
5945
|
+
break;
|
|
5946
|
+
|
|
5947
|
+
case 8:
|
|
5948
|
+
_context4.prev = 8;
|
|
5949
|
+
_context4.t0 = _context4["catch"](2);
|
|
5950
|
+
|
|
5951
|
+
if (!(_context4.t0.response.status === 404)) {
|
|
5952
|
+
_context4.next = 26;
|
|
5953
|
+
break;
|
|
5954
|
+
}
|
|
5955
|
+
|
|
5956
|
+
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
5957
|
+
_context4.prev = 12;
|
|
5958
|
+
_context4.next = 15;
|
|
5959
|
+
return _logic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
5960
|
+
data: data,
|
|
5961
|
+
contentType: contentType
|
|
5962
|
+
});
|
|
5963
|
+
|
|
5964
|
+
case 15:
|
|
5965
|
+
response = _context4.sent;
|
|
5966
|
+
_context4.next = 22;
|
|
5967
|
+
break;
|
|
5968
|
+
|
|
5969
|
+
case 18:
|
|
5970
|
+
_context4.prev = 18;
|
|
5971
|
+
_context4.t1 = _context4["catch"](12);
|
|
5972
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context4.t1);
|
|
5973
|
+
throw _context4.t1;
|
|
5974
|
+
|
|
5975
|
+
case 22:
|
|
5976
|
+
delete _logic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
5977
|
+
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
5978
|
+
|
|
5979
|
+
return _context4.abrupt("return", response);
|
|
5980
|
+
|
|
5981
|
+
case 26:
|
|
5982
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context4.t0);
|
|
5983
|
+
throw _context4.t0;
|
|
5984
|
+
|
|
5985
|
+
case 28:
|
|
5986
|
+
return _context4.abrupt("return", response);
|
|
5987
|
+
|
|
5988
|
+
case 29:
|
|
5989
|
+
case "end":
|
|
5990
|
+
return _context4.stop();
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
}, _callee4, null, [[2, 8], [12, 18]]);
|
|
5994
|
+
}));
|
|
5995
|
+
return _createIfNotExists2.apply(this, arguments);
|
|
5996
|
+
}
|
|
5997
|
+
//# sourceMappingURL=chatLogic.js.map
|
|
5998
|
+
|
|
5999
|
+
/***/ }),
|
|
6000
|
+
|
|
5649
6001
|
/***/ "./lib/chat/dateFolder.js":
|
|
5650
6002
|
/*!********************************!*\
|
|
5651
6003
|
!*** ./lib/chat/dateFolder.js ***!
|
|
@@ -5687,14 +6039,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
5687
6039
|
|
|
5688
6040
|
/**
|
|
5689
6041
|
* Contains the [[DateFolder]] class
|
|
5690
|
-
*
|
|
6042
|
+
* This tracks data stored in dated folders and sub-folders
|
|
6043
|
+
*
|
|
5691
6044
|
*/
|
|
5692
6045
|
// pull in first avoid cross-refs
|
|
5693
|
-
|
|
6046
|
+
|
|
5694
6047
|
/**
|
|
5695
6048
|
* Track back through the YYYY/MM/DD tree to find the previous/next day
|
|
5696
6049
|
*/
|
|
5697
|
-
|
|
5698
6050
|
var DateFolder = /*#__PURE__*/function () {
|
|
5699
6051
|
function DateFolder(rootThing, leafFileName, membershipProperty) {
|
|
5700
6052
|
(0, _classCallCheck2["default"])(this, DateFolder);
|
|
@@ -5718,7 +6070,7 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
5718
6070
|
var path = isoDate.split('T')[0].replace(/-/g, '/'); // Like "2018/05/07"
|
|
5719
6071
|
|
|
5720
6072
|
path = this.root.dir().uri + path + '/' + this.leafFileName;
|
|
5721
|
-
return
|
|
6073
|
+
return _logic.store.sym(path);
|
|
5722
6074
|
}
|
|
5723
6075
|
/* Generate a date object from the leaf file name
|
|
5724
6076
|
*/
|
|
@@ -5780,12 +6132,12 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
5780
6132
|
}
|
|
5781
6133
|
|
|
5782
6134
|
_folder = siblings.pop();
|
|
5783
|
-
leafDocument =
|
|
6135
|
+
leafDocument = _logic.store.sym(_folder.uri + thisDateFolder.leafFileName);
|
|
5784
6136
|
_context.next = 10;
|
|
5785
|
-
return
|
|
6137
|
+
return _logic.store.fetcher.load(leafDocument);
|
|
5786
6138
|
|
|
5787
6139
|
case 10:
|
|
5788
|
-
if (!(
|
|
6140
|
+
if (!(_logic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
|
|
5789
6141
|
_context.next = 12;
|
|
5790
6142
|
break;
|
|
5791
6143
|
}
|
|
@@ -5829,10 +6181,10 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
5829
6181
|
// debug.log(' previousPeriod level' + level + ' file ' + file)
|
|
5830
6182
|
parent = file.dir();
|
|
5831
6183
|
_context2.next = 7;
|
|
5832
|
-
return
|
|
6184
|
+
return _logic.store.fetcher.load(parent);
|
|
5833
6185
|
|
|
5834
6186
|
case 7:
|
|
5835
|
-
siblings =
|
|
6187
|
+
siblings = _logic.store.each(parent, ns.ldp('contains'));
|
|
5836
6188
|
siblings = siblings.filter(younger);
|
|
5837
6189
|
_context2.next = 11;
|
|
5838
6190
|
return lastNonEmpty(siblings);
|
|
@@ -5871,10 +6223,10 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
5871
6223
|
|
|
5872
6224
|
case 21:
|
|
5873
6225
|
_context2.next = 23;
|
|
5874
|
-
return
|
|
6226
|
+
return _logic.store.fetcher.load(uncle);
|
|
5875
6227
|
|
|
5876
6228
|
case 23:
|
|
5877
|
-
cousins =
|
|
6229
|
+
cousins = _logic.store.each(uncle, ns.ldp('contains'));
|
|
5878
6230
|
_context2.next = 26;
|
|
5879
6231
|
return lastNonEmpty(cousins);
|
|
5880
6232
|
|
|
@@ -5910,7 +6262,7 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
5910
6262
|
break;
|
|
5911
6263
|
}
|
|
5912
6264
|
|
|
5913
|
-
doc =
|
|
6265
|
+
doc = _logic.store.sym(found.uri + this.leafFileName);
|
|
5914
6266
|
return _context3.abrupt("return", this.dateFromLeafDocument(doc));
|
|
5915
6267
|
|
|
5916
6268
|
case 10:
|
|
@@ -6081,166 +6433,103 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
6081
6433
|
Object.defineProperty(exports, "__esModule", {
|
|
6082
6434
|
value: true
|
|
6083
6435
|
});
|
|
6084
|
-
exports.createIfNotExists = createIfNotExists;
|
|
6085
6436
|
exports.desktopNotification = desktopNotification;
|
|
6086
6437
|
exports.infiniteMessageArea = infiniteMessageArea;
|
|
6438
|
+
exports.insertMessageIntoTable = insertMessageIntoTable;
|
|
6087
6439
|
|
|
6088
6440
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
6089
6441
|
|
|
6090
6442
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
6091
6443
|
|
|
6092
|
-
var _index = __webpack_require__(/*! ../authn/index */ "./lib/authn/index.js");
|
|
6093
|
-
|
|
6094
6444
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
6095
6445
|
|
|
6096
6446
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
6097
6447
|
|
|
6098
6448
|
var _logic = __webpack_require__(/*! ../logic */ "./lib/logic.js");
|
|
6099
6449
|
|
|
6100
|
-
var _index2 = __webpack_require__(/*! ../media/index */ "./lib/media/index.js");
|
|
6101
|
-
|
|
6102
6450
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
6103
6451
|
|
|
6104
|
-
var
|
|
6105
|
-
|
|
6106
|
-
var _dateFolder = __webpack_require__(/*! ./dateFolder */ "./lib/chat/dateFolder.js");
|
|
6452
|
+
var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js");
|
|
6107
6453
|
|
|
6108
6454
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
6109
6455
|
|
|
6110
|
-
var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./lib/chat/bookmarks.js");
|
|
6111
|
-
|
|
6112
6456
|
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
6113
6457
|
|
|
6114
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
6115
|
-
|
|
6116
|
-
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
6117
|
-
|
|
6118
6458
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
6119
6459
|
|
|
6120
6460
|
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); }
|
|
6121
6461
|
|
|
6122
6462
|
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; }
|
|
6123
6463
|
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6464
|
+
/**
|
|
6465
|
+
* Contains the [[infiniteMessageArea]] class
|
|
6466
|
+
* @packageDocumentation
|
|
6467
|
+
*/
|
|
6468
|
+
// import { authn } from '../authn/index'
|
|
6469
|
+
// import { media } from '../media/index'
|
|
6470
|
+
// import * as pad from '../pad'
|
|
6471
|
+
// import { DateFolder } from './dateFolder'
|
|
6472
|
+
// import { findBookmarkDocument } from './bookmarks'
|
|
6473
|
+
// pull in first avoid cross-refs
|
|
6474
|
+
// import * as style from '../style'
|
|
6475
|
+
// import * as utils from '../utils'
|
|
6476
|
+
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
6477
|
+
function desktopNotification(str) {
|
|
6478
|
+
// Let's check if the browser supports notifications
|
|
6479
|
+
if (!('Notification' in window)) {
|
|
6480
|
+
debug.warn('This browser does no t support desktop notification');
|
|
6481
|
+
} else if (Notification.permission === 'granted') {
|
|
6482
|
+
// Let's check whether notificatio n permissions have already been granted
|
|
6483
|
+
// eslint-disable-next-line no-new
|
|
6484
|
+
new Notification(str);
|
|
6485
|
+
} else if (Notification.permission !== 'denied') {
|
|
6486
|
+
// Otherwise, we need to ask the user for permission
|
|
6487
|
+
Notification.requestPermission().then(function (permission) {
|
|
6488
|
+
// If the user accepts, let's create a notification
|
|
6489
|
+
if (permission === 'granted') {
|
|
6490
|
+
// eslint-disable-next-line no-new
|
|
6491
|
+
new Notification(str);
|
|
6492
|
+
}
|
|
6493
|
+
});
|
|
6494
|
+
} // At last, if the user has denied notifications, and you
|
|
6495
|
+
// want to be respectful there is no need to bother them any more.
|
|
6127
6496
|
|
|
6128
|
-
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; }
|
|
6129
|
-
|
|
6130
|
-
var UI = {
|
|
6131
|
-
authn: _index.authn,
|
|
6132
|
-
icons: _iconBase.icons,
|
|
6133
|
-
ns: ns,
|
|
6134
|
-
media: _index2.media,
|
|
6135
|
-
pad: pad,
|
|
6136
|
-
$rdf: $rdf,
|
|
6137
|
-
store: _logic.store,
|
|
6138
|
-
style: style,
|
|
6139
|
-
utils: utils,
|
|
6140
|
-
widgets: widgets
|
|
6141
|
-
};
|
|
6142
|
-
/* global alert */
|
|
6143
|
-
|
|
6144
|
-
var SERVER_MKDIRP_BUG = false; // Set false timbl 2021-10-31 should be fixed by now
|
|
6145
|
-
|
|
6146
|
-
function createIfNotExists(_x) {
|
|
6147
|
-
return _createIfNotExists.apply(this, arguments);
|
|
6148
6497
|
}
|
|
6498
|
+
/**
|
|
6499
|
+
* Renders a chat message inside a `messageTable`
|
|
6500
|
+
*/
|
|
6149
6501
|
|
|
6150
|
-
function _createIfNotExists() {
|
|
6151
|
-
_createIfNotExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(doc) {
|
|
6152
|
-
var contentType,
|
|
6153
|
-
data,
|
|
6154
|
-
fetcher,
|
|
6155
|
-
response,
|
|
6156
|
-
_args = arguments;
|
|
6157
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
6158
|
-
while (1) {
|
|
6159
|
-
switch (_context.prev = _context.next) {
|
|
6160
|
-
case 0:
|
|
6161
|
-
contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'text/turtle';
|
|
6162
|
-
data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
|
|
6163
|
-
fetcher = UI.store.fetcher;
|
|
6164
|
-
_context.prev = 3;
|
|
6165
|
-
_context.next = 6;
|
|
6166
|
-
return fetcher.load(doc);
|
|
6167
|
-
|
|
6168
|
-
case 6:
|
|
6169
|
-
response = _context.sent;
|
|
6170
|
-
_context.next = 29;
|
|
6171
|
-
break;
|
|
6172
|
-
|
|
6173
|
-
case 9:
|
|
6174
|
-
_context.prev = 9;
|
|
6175
|
-
_context.t0 = _context["catch"](3);
|
|
6176
|
-
|
|
6177
|
-
if (!(_context.t0.response.status === 404)) {
|
|
6178
|
-
_context.next = 27;
|
|
6179
|
-
break;
|
|
6180
|
-
}
|
|
6181
|
-
|
|
6182
|
-
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
6183
|
-
_context.prev = 13;
|
|
6184
|
-
_context.next = 16;
|
|
6185
|
-
return fetcher.webOperation('PUT', doc.uri, {
|
|
6186
|
-
data: data,
|
|
6187
|
-
contentType: contentType
|
|
6188
|
-
});
|
|
6189
|
-
|
|
6190
|
-
case 16:
|
|
6191
|
-
response = _context.sent;
|
|
6192
|
-
_context.next = 23;
|
|
6193
|
-
break;
|
|
6194
|
-
|
|
6195
|
-
case 19:
|
|
6196
|
-
_context.prev = 19;
|
|
6197
|
-
_context.t1 = _context["catch"](13);
|
|
6198
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
|
|
6199
|
-
throw _context.t1;
|
|
6200
6502
|
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
6503
|
+
function insertMessageIntoTable(channelObject, messageTable, message, fresh, options, userContext) {
|
|
6504
|
+
var messageRow = (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext); // const message = messageRow.AJAR_subject
|
|
6204
6505
|
|
|
6205
|
-
|
|
6506
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
6507
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
6508
|
+
options.selectedElement = messageRow;
|
|
6509
|
+
messageTable.selectedElement = messageRow;
|
|
6510
|
+
}
|
|
6206
6511
|
|
|
6207
|
-
|
|
6208
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
|
|
6209
|
-
throw _context.t0;
|
|
6512
|
+
var done = false;
|
|
6210
6513
|
|
|
6211
|
-
|
|
6212
|
-
|
|
6514
|
+
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
6515
|
+
if (!ele) {
|
|
6516
|
+
// empty
|
|
6517
|
+
break;
|
|
6518
|
+
}
|
|
6213
6519
|
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
return _context.stop();
|
|
6217
|
-
}
|
|
6218
|
-
}
|
|
6219
|
-
}, _callee, null, [[3, 9], [13, 19]]);
|
|
6220
|
-
}));
|
|
6221
|
-
return _createIfNotExists.apply(this, arguments);
|
|
6222
|
-
}
|
|
6520
|
+
var newestFirst = options.newestfirst === true;
|
|
6521
|
+
var dateString = messageRow.AJAR_date;
|
|
6223
6522
|
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
// eslint-disable-next-line no-new
|
|
6231
|
-
new Notification(str);
|
|
6232
|
-
} else if (Notification.permission !== 'denied') {
|
|
6233
|
-
// Otherwise, we need to ask the user for permission
|
|
6234
|
-
Notification.requestPermission().then(function (permission) {
|
|
6235
|
-
// If the user accepts, let's create a notification
|
|
6236
|
-
if (permission === 'granted') {
|
|
6237
|
-
// eslint-disable-next-line no-new
|
|
6238
|
-
new Notification(str);
|
|
6239
|
-
}
|
|
6240
|
-
});
|
|
6241
|
-
} // At last, if the user has denied notifications, and you
|
|
6242
|
-
// want to be respectful there is no need to bother them any more.
|
|
6523
|
+
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
6524
|
+
messageTable.insertBefore(messageRow, ele);
|
|
6525
|
+
done = true;
|
|
6526
|
+
break;
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6243
6529
|
|
|
6530
|
+
if (!done) {
|
|
6531
|
+
messageTable.appendChild(messageRow);
|
|
6532
|
+
}
|
|
6244
6533
|
}
|
|
6245
6534
|
/**
|
|
6246
6535
|
* Common code for a chat (discussion area of messages about something)
|
|
@@ -6248,27 +6537,42 @@ function desktopNotification(str) {
|
|
|
6248
6537
|
*
|
|
6249
6538
|
* Parameters for the whole chat like its title are stored on
|
|
6250
6539
|
* index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
|
|
6540
|
+
*
|
|
6541
|
+
* Use to import store as param 2, now ignores it and uses the UI main store
|
|
6542
|
+
*
|
|
6543
|
+
* Options include:
|
|
6544
|
+
|
|
6545
|
+
- shiftEnterSendsMessage: Use shift/enter to send message, Enter to add newline, instead of the reverse.
|
|
6546
|
+
- authorDateOnLeft: Display the author's anme and date of the message in the left column instead of first above the content
|
|
6547
|
+
- selectedMessage: Display one message highlighted with the chat around it
|
|
6548
|
+
- solo: By itelf on a webpage, so user scroll anywhere in the web page scan scroll the chat.
|
|
6549
|
+
- newestFirst: Arrange the chat messages chronologically newest at the top insted of at the bottom
|
|
6550
|
+
- infinite: Use infinite scroll
|
|
6551
|
+
- showDeletedMessages: Show messages which have been delted as "deleted message". Otherwise hide them.
|
|
6552
|
+
- expandImagesInline: If a URI by itself in a message looks like an image URI, replace it with the image
|
|
6553
|
+
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
6554
|
+
|
|
6251
6555
|
*/
|
|
6252
6556
|
|
|
6253
6557
|
|
|
6254
|
-
function infiniteMessageArea(_x2, _x3, _x4
|
|
6558
|
+
function infiniteMessageArea(_x, _x2, _x3, _x4) {
|
|
6255
6559
|
return _infiniteMessageArea.apply(this, arguments);
|
|
6256
6560
|
}
|
|
6257
6561
|
|
|
6258
6562
|
function _infiniteMessageArea() {
|
|
6259
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6260
|
-
var
|
|
6563
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dom, wasStore, chatChannel, options) {
|
|
6564
|
+
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;
|
|
6261
6565
|
|
|
6262
|
-
return _regenerator["default"].wrap(function
|
|
6566
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
6263
6567
|
while (1) {
|
|
6264
|
-
switch (
|
|
6568
|
+
switch (_context12.prev = _context12.next) {
|
|
6265
6569
|
case 0:
|
|
6266
6570
|
_loadInitialContent = function _loadInitialContent3() {
|
|
6267
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6571
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
6268
6572
|
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
6269
|
-
return _regenerator["default"].wrap(function
|
|
6573
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
6270
6574
|
while (1) {
|
|
6271
|
-
switch (
|
|
6575
|
+
switch (_context11.prev = _context11.next) {
|
|
6272
6576
|
case 0:
|
|
6273
6577
|
fixScroll = function _fixScroll() {
|
|
6274
6578
|
if (options.selectedElement) {
|
|
@@ -6296,27 +6600,27 @@ function _infiniteMessageArea() {
|
|
|
6296
6600
|
}
|
|
6297
6601
|
|
|
6298
6602
|
if (!(options.selectedMessage && !live)) {
|
|
6299
|
-
|
|
6603
|
+
_context11.next = 15;
|
|
6300
6604
|
break;
|
|
6301
6605
|
}
|
|
6302
6606
|
|
|
6303
6607
|
selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
|
|
6304
|
-
|
|
6608
|
+
_context11.next = 7;
|
|
6305
6609
|
return createMessageTable(selectedDate, live);
|
|
6306
6610
|
|
|
6307
6611
|
case 7:
|
|
6308
|
-
selectedMessageTable =
|
|
6612
|
+
selectedMessageTable = _context11.sent;
|
|
6309
6613
|
div.appendChild(selectedMessageTable);
|
|
6310
6614
|
earliest.messageTable = selectedMessageTable;
|
|
6311
6615
|
latest.messageTable = selectedMessageTable;
|
|
6312
6616
|
yank();
|
|
6313
6617
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
6314
6618
|
|
|
6315
|
-
|
|
6619
|
+
_context11.next = 19;
|
|
6316
6620
|
break;
|
|
6317
6621
|
|
|
6318
6622
|
case 15:
|
|
6319
|
-
|
|
6623
|
+
_context11.next = 17;
|
|
6320
6624
|
return appendCurrentMessages();
|
|
6321
6625
|
|
|
6322
6626
|
case 17:
|
|
@@ -6324,7 +6628,7 @@ function _infiniteMessageArea() {
|
|
|
6324
6628
|
latest.messageTable = liveMessageTable;
|
|
6325
6629
|
|
|
6326
6630
|
case 19:
|
|
6327
|
-
|
|
6631
|
+
_context11.next = 21;
|
|
6328
6632
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
6329
6633
|
|
|
6330
6634
|
case 21:
|
|
@@ -6336,10 +6640,10 @@ function _infiniteMessageArea() {
|
|
|
6336
6640
|
|
|
6337
6641
|
case 23:
|
|
6338
6642
|
case "end":
|
|
6339
|
-
return
|
|
6643
|
+
return _context11.stop();
|
|
6340
6644
|
}
|
|
6341
6645
|
}
|
|
6342
|
-
},
|
|
6646
|
+
}, _callee11);
|
|
6343
6647
|
}));
|
|
6344
6648
|
return _loadInitialContent.apply(this, arguments);
|
|
6345
6649
|
};
|
|
@@ -6349,18 +6653,18 @@ function _infiniteMessageArea() {
|
|
|
6349
6653
|
};
|
|
6350
6654
|
|
|
6351
6655
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
6352
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6656
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(event, fixScroll) {
|
|
6353
6657
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
6354
|
-
return _regenerator["default"].wrap(function
|
|
6658
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
6355
6659
|
while (1) {
|
|
6356
|
-
switch (
|
|
6660
|
+
switch (_context10.prev = _context10.next) {
|
|
6357
6661
|
case 0:
|
|
6358
6662
|
if (!lock) {
|
|
6359
|
-
|
|
6663
|
+
_context10.next = 2;
|
|
6360
6664
|
break;
|
|
6361
6665
|
}
|
|
6362
6666
|
|
|
6363
|
-
return
|
|
6667
|
+
return _context10.abrupt("return");
|
|
6364
6668
|
|
|
6365
6669
|
case 2:
|
|
6366
6670
|
lock = true;
|
|
@@ -6370,12 +6674,12 @@ function _infiniteMessageArea() {
|
|
|
6370
6674
|
|
|
6371
6675
|
case 5:
|
|
6372
6676
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
6373
|
-
|
|
6677
|
+
_context10.next = 21;
|
|
6374
6678
|
break;
|
|
6375
6679
|
}
|
|
6376
6680
|
|
|
6377
6681
|
if (!(div.scrollHeight === 0)) {
|
|
6378
|
-
|
|
6682
|
+
_context10.next = 10;
|
|
6379
6683
|
break;
|
|
6380
6684
|
}
|
|
6381
6685
|
|
|
@@ -6383,17 +6687,17 @@ function _infiniteMessageArea() {
|
|
|
6383
6687
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
6384
6688
|
|
|
6385
6689
|
lock = false;
|
|
6386
|
-
return
|
|
6690
|
+
return _context10.abrupt("return");
|
|
6387
6691
|
|
|
6388
6692
|
case 10:
|
|
6389
6693
|
// console.log(' chat/loadMoreWhereNeeded: Going now')
|
|
6390
6694
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
6391
6695
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
6392
|
-
|
|
6696
|
+
_context10.next = 14;
|
|
6393
6697
|
return earliest.messageTable.extendBackwards();
|
|
6394
6698
|
|
|
6395
6699
|
case 14:
|
|
6396
|
-
done =
|
|
6700
|
+
done = _context10.sent;
|
|
6397
6701
|
|
|
6398
6702
|
if (freeze) {
|
|
6399
6703
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
@@ -6402,14 +6706,14 @@ function _infiniteMessageArea() {
|
|
|
6402
6706
|
if (fixScroll) fixScroll();
|
|
6403
6707
|
|
|
6404
6708
|
if (!done) {
|
|
6405
|
-
|
|
6709
|
+
_context10.next = 19;
|
|
6406
6710
|
break;
|
|
6407
6711
|
}
|
|
6408
6712
|
|
|
6409
|
-
return
|
|
6713
|
+
return _context10.abrupt("break", 21);
|
|
6410
6714
|
|
|
6411
6715
|
case 19:
|
|
6412
|
-
|
|
6716
|
+
_context10.next = 5;
|
|
6413
6717
|
break;
|
|
6414
6718
|
|
|
6415
6719
|
case 21:
|
|
@@ -6417,17 +6721,17 @@ function _infiniteMessageArea() {
|
|
|
6417
6721
|
div.scrollHeight - div.scrollTop - div.clientHeight < magicZone && // we are scrolled right to the bottom
|
|
6418
6722
|
latest.messageTable && !latest.messageTable["final"] && // there is more data to come
|
|
6419
6723
|
latest.messageTable.extendForwards)) {
|
|
6420
|
-
|
|
6724
|
+
_context10.next = 33;
|
|
6421
6725
|
break;
|
|
6422
6726
|
}
|
|
6423
6727
|
|
|
6424
6728
|
scrollTop = div.scrollTop;
|
|
6425
6729
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
6426
|
-
|
|
6730
|
+
_context10.next = 26;
|
|
6427
6731
|
return latest.messageTable.extendForwards();
|
|
6428
6732
|
|
|
6429
6733
|
case 26:
|
|
6430
|
-
done =
|
|
6734
|
+
done = _context10.sent;
|
|
6431
6735
|
|
|
6432
6736
|
// then add more data on the bottom
|
|
6433
6737
|
if (freeze) {
|
|
@@ -6437,14 +6741,14 @@ function _infiniteMessageArea() {
|
|
|
6437
6741
|
if (fixScroll) fixScroll();
|
|
6438
6742
|
|
|
6439
6743
|
if (!done) {
|
|
6440
|
-
|
|
6744
|
+
_context10.next = 31;
|
|
6441
6745
|
break;
|
|
6442
6746
|
}
|
|
6443
6747
|
|
|
6444
|
-
return
|
|
6748
|
+
return _context10.abrupt("break", 33);
|
|
6445
6749
|
|
|
6446
6750
|
case 31:
|
|
6447
|
-
|
|
6751
|
+
_context10.next = 21;
|
|
6448
6752
|
break;
|
|
6449
6753
|
|
|
6450
6754
|
case 33:
|
|
@@ -6452,72 +6756,68 @@ function _infiniteMessageArea() {
|
|
|
6452
6756
|
|
|
6453
6757
|
case 34:
|
|
6454
6758
|
case "end":
|
|
6455
|
-
return
|
|
6759
|
+
return _context10.stop();
|
|
6456
6760
|
}
|
|
6457
6761
|
}
|
|
6458
|
-
},
|
|
6762
|
+
}, _callee10);
|
|
6459
6763
|
}));
|
|
6460
6764
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
6461
6765
|
};
|
|
6462
6766
|
|
|
6463
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
6767
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x10, _x11) {
|
|
6464
6768
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
6465
6769
|
};
|
|
6466
6770
|
|
|
6467
6771
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
6468
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6772
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
6469
6773
|
var now, chatDocument, messageTable;
|
|
6470
|
-
return _regenerator["default"].wrap(function
|
|
6774
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
6471
6775
|
while (1) {
|
|
6472
|
-
switch (
|
|
6776
|
+
switch (_context9.prev = _context9.next) {
|
|
6473
6777
|
case 0:
|
|
6474
6778
|
now = new Date();
|
|
6475
|
-
chatDocument = dateFolder.leafDocumentFromDate(now);
|
|
6476
|
-
/* Don't actually make the documemnt until a message is sent @@@@@ WHEN SERVER FIXED
|
|
6477
|
-
* currently server won't patch to a file ina non-existent directory
|
|
6478
|
-
*/
|
|
6479
|
-
|
|
6480
|
-
/*
|
|
6481
|
-
if (SERVER_MKDIRP_BUG) {
|
|
6482
|
-
try {
|
|
6483
|
-
await createIfNotExists(chatDocument)
|
|
6484
|
-
} catch (e) {
|
|
6485
|
-
div.appendChild(UI.widgets.errorMessageBlock(
|
|
6486
|
-
dom, 'Problem accessing chat file: ' + e))
|
|
6487
|
-
return
|
|
6488
|
-
}
|
|
6489
|
-
}
|
|
6490
|
-
*/
|
|
6491
|
-
/// ///////////////////////////////////////////////////////////
|
|
6779
|
+
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
6492
6780
|
|
|
6493
|
-
|
|
6781
|
+
_context9.next = 4;
|
|
6494
6782
|
return createMessageTable(now, true);
|
|
6495
6783
|
|
|
6496
6784
|
case 4:
|
|
6497
|
-
messageTable =
|
|
6785
|
+
messageTable = _context9.sent;
|
|
6498
6786
|
div.appendChild(messageTable);
|
|
6787
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
6788
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
6789
|
+
while (1) {
|
|
6790
|
+
switch (_context8.prev = _context8.next) {
|
|
6791
|
+
case 0:
|
|
6792
|
+
_context8.next = 2;
|
|
6793
|
+
return addNewChatDocumentIfNewDay(new Date());
|
|
6794
|
+
|
|
6795
|
+
case 2:
|
|
6796
|
+
syncMessages(chatChannel, messageTable); // @@ livemessagetable??
|
|
6797
|
+
|
|
6798
|
+
desktopNotification(chatChannel);
|
|
6799
|
+
|
|
6800
|
+
case 4:
|
|
6801
|
+
case "end":
|
|
6802
|
+
return _context8.stop();
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
}, _callee8);
|
|
6806
|
+
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
6499
6807
|
|
|
6500
|
-
div.refresh
|
|
6501
|
-
// only the last messageTable is live
|
|
6502
|
-
addNewTableIfNewDay(new Date()).then(function () {
|
|
6503
|
-
syncMessages(chatChannel, messageTable);
|
|
6504
|
-
desktopNotification(chatChannel);
|
|
6505
|
-
});
|
|
6506
|
-
}; // The short chat version fors live update in the pane but we do it in the widget
|
|
6507
|
-
|
|
6808
|
+
_logic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
6508
6809
|
|
|
6509
|
-
kb.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
6510
6810
|
|
|
6511
6811
|
liveMessageTable = messageTable;
|
|
6512
6812
|
latest.messageTable = liveMessageTable;
|
|
6513
|
-
return
|
|
6813
|
+
return _context9.abrupt("return", messageTable);
|
|
6514
6814
|
|
|
6515
6815
|
case 11:
|
|
6516
6816
|
case "end":
|
|
6517
|
-
return
|
|
6817
|
+
return _context9.stop();
|
|
6518
6818
|
}
|
|
6519
6819
|
}
|
|
6520
|
-
},
|
|
6820
|
+
}, _callee9);
|
|
6521
6821
|
}));
|
|
6522
6822
|
return _appendCurrentMessages.apply(this, arguments);
|
|
6523
6823
|
};
|
|
@@ -6526,19 +6826,18 @@ function _infiniteMessageArea() {
|
|
|
6526
6826
|
return _appendCurrentMessages.apply(this, arguments);
|
|
6527
6827
|
};
|
|
6528
6828
|
|
|
6529
|
-
|
|
6530
|
-
|
|
6829
|
+
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
6830
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
6531
6831
|
var newChatDocument, oldChatDocument, sts;
|
|
6532
|
-
return _regenerator["default"].wrap(function
|
|
6832
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
6533
6833
|
while (1) {
|
|
6534
|
-
switch (
|
|
6834
|
+
switch (_context7.prev = _context7.next) {
|
|
6535
6835
|
case 0:
|
|
6536
|
-
// let now = new Date()
|
|
6537
6836
|
// @@ Remove listener from previous table as it is now static
|
|
6538
|
-
newChatDocument = dateFolder.leafDocumentFromDate(
|
|
6837
|
+
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
6539
6838
|
|
|
6540
6839
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
6541
|
-
|
|
6840
|
+
_context7.next = 7;
|
|
6542
6841
|
break;
|
|
6543
6842
|
}
|
|
6544
6843
|
|
|
@@ -6549,36 +6848,37 @@ function _infiniteMessageArea() {
|
|
|
6549
6848
|
}
|
|
6550
6849
|
|
|
6551
6850
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
6552
|
-
|
|
6851
|
+
_context7.next = 6;
|
|
6553
6852
|
return appendCurrentMessages();
|
|
6554
6853
|
|
|
6555
6854
|
case 6:
|
|
6556
6855
|
// Adding a link in the document will ping listeners to add the new block too
|
|
6557
|
-
if (!
|
|
6856
|
+
if (!_logic.store.holds(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)) {
|
|
6558
6857
|
sts = [$rdf.st(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)];
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6858
|
+
|
|
6859
|
+
try {
|
|
6860
|
+
_logic.store.updater.update([], sts);
|
|
6861
|
+
} catch (err) {
|
|
6862
|
+
alert('Unable to link old chat file to new one:' + err);
|
|
6863
|
+
}
|
|
6564
6864
|
}
|
|
6565
6865
|
|
|
6566
6866
|
case 7:
|
|
6567
6867
|
case "end":
|
|
6568
|
-
return
|
|
6868
|
+
return _context7.stop();
|
|
6569
6869
|
}
|
|
6570
6870
|
}
|
|
6571
|
-
},
|
|
6871
|
+
}, _callee7);
|
|
6572
6872
|
}));
|
|
6573
|
-
return
|
|
6873
|
+
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
6574
6874
|
};
|
|
6575
6875
|
|
|
6576
|
-
|
|
6577
|
-
return
|
|
6876
|
+
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
6877
|
+
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
6578
6878
|
};
|
|
6579
6879
|
|
|
6580
6880
|
renderMessageTable = function _renderMessageTable(date, live) {
|
|
6581
|
-
var
|
|
6881
|
+
var scrollBackbutton;
|
|
6582
6882
|
var scrollForwardButton; /// ///////////////// Scroll down adding more above
|
|
6583
6883
|
|
|
6584
6884
|
function extendBackwards() {
|
|
@@ -6586,23 +6886,23 @@ function _infiniteMessageArea() {
|
|
|
6586
6886
|
}
|
|
6587
6887
|
|
|
6588
6888
|
function _extendBackwards() {
|
|
6589
|
-
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6889
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
6590
6890
|
var done;
|
|
6591
|
-
return _regenerator["default"].wrap(function
|
|
6891
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
6592
6892
|
while (1) {
|
|
6593
|
-
switch (
|
|
6893
|
+
switch (_context.prev = _context.next) {
|
|
6594
6894
|
case 0:
|
|
6595
|
-
|
|
6895
|
+
_context.next = 2;
|
|
6596
6896
|
return insertPreviousMessages(true);
|
|
6597
6897
|
|
|
6598
6898
|
case 2:
|
|
6599
|
-
done =
|
|
6899
|
+
done = _context.sent;
|
|
6600
6900
|
|
|
6601
6901
|
if (done) {
|
|
6602
|
-
if (
|
|
6603
|
-
|
|
6902
|
+
if (scrollBackbutton) {
|
|
6903
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
6604
6904
|
|
|
6605
|
-
|
|
6905
|
+
scrollBackbutton.disabled = true;
|
|
6606
6906
|
}
|
|
6607
6907
|
|
|
6608
6908
|
messageTable.initial = true;
|
|
@@ -6610,67 +6910,67 @@ function _infiniteMessageArea() {
|
|
|
6610
6910
|
messageTable.extendedBack = true;
|
|
6611
6911
|
}
|
|
6612
6912
|
|
|
6613
|
-
|
|
6614
|
-
return
|
|
6913
|
+
setScrollBackbuttonIcon();
|
|
6914
|
+
return _context.abrupt("return", done);
|
|
6615
6915
|
|
|
6616
6916
|
case 6:
|
|
6617
6917
|
case "end":
|
|
6618
|
-
return
|
|
6918
|
+
return _context.stop();
|
|
6619
6919
|
}
|
|
6620
6920
|
}
|
|
6621
|
-
},
|
|
6921
|
+
}, _callee);
|
|
6622
6922
|
}));
|
|
6623
6923
|
return _extendBackwards.apply(this, arguments);
|
|
6624
6924
|
}
|
|
6625
6925
|
|
|
6626
|
-
function
|
|
6627
|
-
if (!
|
|
6926
|
+
function setScrollBackbuttonIcon() {
|
|
6927
|
+
if (!scrollBackbutton) {
|
|
6628
6928
|
return;
|
|
6629
6929
|
}
|
|
6630
6930
|
|
|
6631
6931
|
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
6632
6932
|
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
6633
|
-
|
|
6933
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
6634
6934
|
|
|
6635
6935
|
function getScrollbackIcon(sense) {
|
|
6636
6936
|
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
6637
6937
|
}
|
|
6638
6938
|
}
|
|
6639
6939
|
|
|
6640
|
-
function
|
|
6641
|
-
return
|
|
6940
|
+
function scrollBackbuttonHandler(_x8) {
|
|
6941
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
6642
6942
|
} /// ////////////// Scroll up adding more below
|
|
6643
6943
|
|
|
6644
6944
|
|
|
6645
|
-
function
|
|
6646
|
-
|
|
6647
|
-
return _regenerator["default"].wrap(function
|
|
6945
|
+
function _scrollBackbuttonHandler() {
|
|
6946
|
+
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
|
|
6947
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
6648
6948
|
while (1) {
|
|
6649
|
-
switch (
|
|
6949
|
+
switch (_context2.prev = _context2.next) {
|
|
6650
6950
|
case 0:
|
|
6651
6951
|
if (!messageTable.extendedBack) {
|
|
6652
|
-
|
|
6952
|
+
_context2.next = 6;
|
|
6653
6953
|
break;
|
|
6654
6954
|
}
|
|
6655
6955
|
|
|
6656
6956
|
removePreviousMessages(true, messageTable);
|
|
6657
6957
|
messageTable.extendedBack = false;
|
|
6658
|
-
|
|
6659
|
-
|
|
6958
|
+
setScrollBackbuttonIcon();
|
|
6959
|
+
_context2.next = 8;
|
|
6660
6960
|
break;
|
|
6661
6961
|
|
|
6662
6962
|
case 6:
|
|
6663
|
-
|
|
6963
|
+
_context2.next = 8;
|
|
6664
6964
|
return extendBackwards();
|
|
6665
6965
|
|
|
6666
6966
|
case 8:
|
|
6667
6967
|
case "end":
|
|
6668
|
-
return
|
|
6968
|
+
return _context2.stop();
|
|
6669
6969
|
}
|
|
6670
6970
|
}
|
|
6671
|
-
},
|
|
6971
|
+
}, _callee2);
|
|
6672
6972
|
}));
|
|
6673
|
-
return
|
|
6973
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
6674
6974
|
}
|
|
6675
6975
|
|
|
6676
6976
|
function extendForwards() {
|
|
@@ -6678,20 +6978,20 @@ function _infiniteMessageArea() {
|
|
|
6678
6978
|
}
|
|
6679
6979
|
|
|
6680
6980
|
function _extendForwards() {
|
|
6681
|
-
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6981
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
6682
6982
|
var done;
|
|
6683
|
-
return _regenerator["default"].wrap(function
|
|
6983
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
6684
6984
|
while (1) {
|
|
6685
|
-
switch (
|
|
6985
|
+
switch (_context3.prev = _context3.next) {
|
|
6686
6986
|
case 0:
|
|
6687
|
-
|
|
6987
|
+
_context3.next = 2;
|
|
6688
6988
|
return insertPreviousMessages(false);
|
|
6689
6989
|
|
|
6690
6990
|
case 2:
|
|
6691
|
-
done =
|
|
6991
|
+
done = _context3.sent;
|
|
6692
6992
|
|
|
6693
6993
|
if (done) {
|
|
6694
|
-
scrollForwardButton.firstChild.setAttribute('src',
|
|
6994
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
|
|
6695
6995
|
scrollForwardButton.disabled = true;
|
|
6696
6996
|
messageTable["final"] = true;
|
|
6697
6997
|
} else {
|
|
@@ -6699,14 +6999,14 @@ function _infiniteMessageArea() {
|
|
|
6699
6999
|
}
|
|
6700
7000
|
|
|
6701
7001
|
setScrollForwardButtonIcon();
|
|
6702
|
-
return
|
|
7002
|
+
return _context3.abrupt("return", done);
|
|
6703
7003
|
|
|
6704
7004
|
case 6:
|
|
6705
7005
|
case "end":
|
|
6706
|
-
return
|
|
7006
|
+
return _context3.stop();
|
|
6707
7007
|
}
|
|
6708
7008
|
}
|
|
6709
|
-
},
|
|
7009
|
+
}, _callee3);
|
|
6710
7010
|
}));
|
|
6711
7011
|
return _extendForwards.apply(this, arguments);
|
|
6712
7012
|
}
|
|
@@ -6715,37 +7015,48 @@ function _infiniteMessageArea() {
|
|
|
6715
7015
|
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
6716
7016
|
|
|
6717
7017
|
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
6718
|
-
scrollForwardButton.firstChild.setAttribute('src',
|
|
7018
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
6719
7019
|
|
|
6720
7020
|
function getScrollForwardButtonIcon(sense) {
|
|
6721
7021
|
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
6722
7022
|
}
|
|
6723
7023
|
}
|
|
6724
7024
|
|
|
6725
|
-
function scrollForwardButtonHandler(
|
|
7025
|
+
function scrollForwardButtonHandler(_x9) {
|
|
6726
7026
|
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
6727
7027
|
} /// ///////////////////////
|
|
6728
7028
|
|
|
7029
|
+
/*
|
|
7030
|
+
options = options || {}
|
|
7031
|
+
options.authorDateOnLeft = true
|
|
7032
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
7033
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
7034
|
+
const dateFolder = channelObject.dateFolder
|
|
7035
|
+
const div = dom.createElement('div')
|
|
7036
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
7037
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
7038
|
+
*/
|
|
7039
|
+
|
|
6729
7040
|
|
|
6730
7041
|
function _scrollForwardButtonHandler() {
|
|
6731
|
-
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
6732
|
-
return _regenerator["default"].wrap(function
|
|
7042
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
7043
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
6733
7044
|
while (1) {
|
|
6734
|
-
switch (
|
|
7045
|
+
switch (_context4.prev = _context4.next) {
|
|
6735
7046
|
case 0:
|
|
6736
7047
|
if (!messageTable.extendedForwards) {
|
|
6737
|
-
|
|
7048
|
+
_context4.next = 6;
|
|
6738
7049
|
break;
|
|
6739
7050
|
}
|
|
6740
7051
|
|
|
6741
7052
|
removePreviousMessages(false, messageTable);
|
|
6742
7053
|
messageTable.extendedForwards = false;
|
|
6743
7054
|
setScrollForwardButtonIcon();
|
|
6744
|
-
|
|
7055
|
+
_context4.next = 9;
|
|
6745
7056
|
break;
|
|
6746
7057
|
|
|
6747
7058
|
case 6:
|
|
6748
|
-
|
|
7059
|
+
_context4.next = 8;
|
|
6749
7060
|
return extendForwards();
|
|
6750
7061
|
|
|
6751
7062
|
case 8:
|
|
@@ -6754,10 +7065,10 @@ function _infiniteMessageArea() {
|
|
|
6754
7065
|
|
|
6755
7066
|
case 9:
|
|
6756
7067
|
case "end":
|
|
6757
|
-
return
|
|
7068
|
+
return _context4.stop();
|
|
6758
7069
|
}
|
|
6759
7070
|
}
|
|
6760
|
-
},
|
|
7071
|
+
}, _callee4);
|
|
6761
7072
|
}));
|
|
6762
7073
|
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
6763
7074
|
}
|
|
@@ -6777,7 +7088,7 @@ function _infiniteMessageArea() {
|
|
|
6777
7088
|
messageTable["final"] = true;
|
|
6778
7089
|
liveMessageTable = messageTable;
|
|
6779
7090
|
latest.messageTable = messageTable;
|
|
6780
|
-
var tr =
|
|
7091
|
+
var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
6781
7092
|
|
|
6782
7093
|
if (newestFirst) {
|
|
6783
7094
|
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
@@ -6792,27 +7103,27 @@ function _infiniteMessageArea() {
|
|
|
6792
7103
|
|
|
6793
7104
|
|
|
6794
7105
|
if (options.infinite) {
|
|
6795
|
-
var
|
|
6796
|
-
var
|
|
7106
|
+
var scrollBackbuttonTR = dom.createElement('tr');
|
|
7107
|
+
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
6797
7108
|
// down triangles: noun_1369241.svg
|
|
6798
7109
|
|
|
6799
7110
|
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
6800
7111
|
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
7112
|
+
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
7113
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
7114
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
6804
7115
|
messageTable.extendedBack = false;
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
var dateCell =
|
|
7116
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
7117
|
+
setScrollBackbuttonIcon();
|
|
7118
|
+
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
6808
7119
|
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
6809
|
-
dateCell.textContent =
|
|
7120
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
6810
7121
|
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
6811
7122
|
|
|
6812
|
-
var scrollForwardButtonCell =
|
|
7123
|
+
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
6813
7124
|
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
6814
7125
|
|
|
6815
|
-
scrollForwardButton =
|
|
7126
|
+
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
6816
7127
|
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
6817
7128
|
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
6818
7129
|
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
@@ -6822,13 +7133,13 @@ function _infiniteMessageArea() {
|
|
|
6822
7133
|
|
|
6823
7134
|
if (!newestFirst) {
|
|
6824
7135
|
// opposite end from the entry field
|
|
6825
|
-
messageTable.insertBefore(
|
|
7136
|
+
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
6826
7137
|
} else {
|
|
6827
|
-
messageTable.appendChild(
|
|
7138
|
+
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
6828
7139
|
}
|
|
6829
7140
|
}
|
|
6830
7141
|
|
|
6831
|
-
var sts =
|
|
7142
|
+
var sts = _logic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
6832
7143
|
|
|
6833
7144
|
if (!live && sts.length === 0) {// not todays
|
|
6834
7145
|
// no need buttomns at the moment
|
|
@@ -6845,57 +7156,57 @@ function _infiniteMessageArea() {
|
|
|
6845
7156
|
};
|
|
6846
7157
|
|
|
6847
7158
|
_createMessageTable = function _createMessageTable3() {
|
|
6848
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
7159
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(date, live) {
|
|
6849
7160
|
var chatDocument, messageTable, statusTR;
|
|
6850
|
-
return _regenerator["default"].wrap(function
|
|
7161
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
6851
7162
|
while (1) {
|
|
6852
|
-
switch (
|
|
7163
|
+
switch (_context6.prev = _context6.next) {
|
|
6853
7164
|
case 0:
|
|
6854
7165
|
debug.log(' createMessageTable for ' + date);
|
|
6855
7166
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
return
|
|
7167
|
+
_context6.prev = 2;
|
|
7168
|
+
_context6.next = 5;
|
|
7169
|
+
return _logic.store.fetcher.load(chatDocument);
|
|
6859
7170
|
|
|
6860
7171
|
case 5:
|
|
6861
|
-
|
|
7172
|
+
_context6.next = 19;
|
|
6862
7173
|
break;
|
|
6863
7174
|
|
|
6864
7175
|
case 7:
|
|
6865
|
-
|
|
6866
|
-
|
|
7176
|
+
_context6.prev = 7;
|
|
7177
|
+
_context6.t0 = _context6["catch"](2);
|
|
6867
7178
|
messageTable = dom.createElement('table');
|
|
6868
7179
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
6869
7180
|
|
|
6870
|
-
if (!(
|
|
6871
|
-
|
|
7181
|
+
if (!(_context6.t0.response && _context6.t0.response.status && _context6.t0.response.status === 404)) {
|
|
7182
|
+
_context6.next = 16;
|
|
6872
7183
|
break;
|
|
6873
7184
|
}
|
|
6874
7185
|
|
|
6875
7186
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
6876
|
-
return
|
|
7187
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
6877
7188
|
|
|
6878
7189
|
case 16:
|
|
6879
7190
|
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
6880
|
-
statusTR.appendChild(
|
|
7191
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context6.t0, 'pink'));
|
|
6881
7192
|
|
|
6882
7193
|
case 18:
|
|
6883
|
-
return
|
|
7194
|
+
return _context6.abrupt("return", statusTR);
|
|
6884
7195
|
|
|
6885
7196
|
case 19:
|
|
6886
|
-
return
|
|
7197
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
6887
7198
|
|
|
6888
7199
|
case 20:
|
|
6889
7200
|
case "end":
|
|
6890
|
-
return
|
|
7201
|
+
return _context6.stop();
|
|
6891
7202
|
}
|
|
6892
7203
|
}
|
|
6893
|
-
},
|
|
7204
|
+
}, _callee6, null, [[2, 7]]);
|
|
6894
7205
|
}));
|
|
6895
7206
|
return _createMessageTable.apply(this, arguments);
|
|
6896
7207
|
};
|
|
6897
7208
|
|
|
6898
|
-
createMessageTable = function _createMessageTable2(
|
|
7209
|
+
createMessageTable = function _createMessageTable2(_x6, _x7) {
|
|
6899
7210
|
return _createMessageTable.apply(this, arguments);
|
|
6900
7211
|
};
|
|
6901
7212
|
|
|
@@ -6917,38 +7228,38 @@ function _infiniteMessageArea() {
|
|
|
6917
7228
|
};
|
|
6918
7229
|
|
|
6919
7230
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
6920
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
7231
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
|
|
6921
7232
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
6922
|
-
return _regenerator["default"].wrap(function
|
|
7233
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
6923
7234
|
while (1) {
|
|
6924
|
-
switch (
|
|
7235
|
+
switch (_context5.prev = _context5.next) {
|
|
6925
7236
|
case 0:
|
|
6926
7237
|
extremity = backwards ? earliest : latest;
|
|
6927
7238
|
date = extremity.messageTable.date; // day in mssecs
|
|
6928
7239
|
|
|
6929
|
-
|
|
7240
|
+
_context5.next = 4;
|
|
6930
7241
|
return dateFolder.loadPrevious(date, backwards);
|
|
6931
7242
|
|
|
6932
7243
|
case 4:
|
|
6933
|
-
date =
|
|
7244
|
+
date = _context5.sent;
|
|
6934
7245
|
// backwards
|
|
6935
7246
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
6936
7247
|
|
|
6937
7248
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
6938
|
-
|
|
7249
|
+
_context5.next = 9;
|
|
6939
7250
|
break;
|
|
6940
7251
|
}
|
|
6941
7252
|
|
|
6942
|
-
|
|
7253
|
+
_context5.next = 9;
|
|
6943
7254
|
return appendCurrentMessages();
|
|
6944
7255
|
|
|
6945
7256
|
case 9:
|
|
6946
7257
|
if (date) {
|
|
6947
|
-
|
|
7258
|
+
_context5.next = 11;
|
|
6948
7259
|
break;
|
|
6949
7260
|
}
|
|
6950
7261
|
|
|
6951
|
-
return
|
|
7262
|
+
return _context5.abrupt("return", true);
|
|
6952
7263
|
|
|
6953
7264
|
case 11:
|
|
6954
7265
|
// done
|
|
@@ -6960,11 +7271,11 @@ function _infiniteMessageArea() {
|
|
|
6960
7271
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
6961
7272
|
}
|
|
6962
7273
|
|
|
6963
|
-
|
|
7274
|
+
_context5.next = 15;
|
|
6964
7275
|
return createMessageTable(date, live);
|
|
6965
7276
|
|
|
6966
7277
|
case 15:
|
|
6967
|
-
newMessageTable =
|
|
7278
|
+
newMessageTable = _context5.sent;
|
|
6968
7279
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
6969
7280
|
|
|
6970
7281
|
if (backwards ? newestFirst : !newestFirst) {
|
|
@@ -6975,30 +7286,30 @@ function _infiniteMessageArea() {
|
|
|
6975
7286
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
6976
7287
|
}
|
|
6977
7288
|
|
|
6978
|
-
return
|
|
7289
|
+
return _context5.abrupt("return", live);
|
|
6979
7290
|
|
|
6980
7291
|
case 19:
|
|
6981
7292
|
case "end":
|
|
6982
|
-
return
|
|
7293
|
+
return _context5.stop();
|
|
6983
7294
|
}
|
|
6984
7295
|
}
|
|
6985
|
-
},
|
|
7296
|
+
}, _callee5);
|
|
6986
7297
|
}));
|
|
6987
7298
|
return _insertPreviousMessages.apply(this, arguments);
|
|
6988
7299
|
};
|
|
6989
7300
|
|
|
6990
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
7301
|
+
insertPreviousMessages = function _insertPreviousMessag(_x5) {
|
|
6991
7302
|
return _insertPreviousMessages.apply(this, arguments);
|
|
6992
7303
|
};
|
|
6993
7304
|
|
|
6994
7305
|
addMessage = function _addMessage(message, messageTable) {
|
|
6995
|
-
var
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
(
|
|
7306
|
+
var latest = (0, _chatLogic.mostRecentVersion)(message); // const content = store.any(latest, ns.sioc('content'))
|
|
7307
|
+
|
|
7308
|
+
if ((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages) {
|
|
7309
|
+
return; // ignore deleted messaged -- @@ could also leave a placeholder
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext); // fresh from elsewhere
|
|
7002
7313
|
};
|
|
7003
7314
|
|
|
7004
7315
|
syncMessages = function _syncMessages(about, messageTable) {
|
|
@@ -7011,9 +7322,10 @@ function _infiniteMessageArea() {
|
|
|
7011
7322
|
}
|
|
7012
7323
|
}
|
|
7013
7324
|
|
|
7014
|
-
var messages =
|
|
7325
|
+
var messages = _logic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
|
|
7015
7326
|
return st.object;
|
|
7016
7327
|
});
|
|
7328
|
+
|
|
7017
7329
|
var stored = {};
|
|
7018
7330
|
messages.forEach(function (m) {
|
|
7019
7331
|
stored[m.uri] = true;
|
|
@@ -7036,470 +7348,130 @@ function _infiniteMessageArea() {
|
|
|
7036
7348
|
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
7037
7349
|
if (ele.AJAR_subject) {
|
|
7038
7350
|
// Refresh thumbs up etc
|
|
7039
|
-
|
|
7351
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
7040
7352
|
}
|
|
7041
7353
|
}
|
|
7042
7354
|
};
|
|
7043
7355
|
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
var middle = dom.createElement('td');
|
|
7048
|
-
var rhs = dom.createElement('td');
|
|
7049
|
-
form.appendChild(lhs);
|
|
7050
|
-
form.appendChild(middle);
|
|
7051
|
-
form.appendChild(rhs);
|
|
7052
|
-
form.AJAR_date = '9999-01-01T00:00:00Z'; // ISO format for field sort
|
|
7053
|
-
|
|
7054
|
-
var field, sendButton;
|
|
7055
|
-
|
|
7056
|
-
function sendMessage(_x6) {
|
|
7057
|
-
return _sendMessage.apply(this, arguments);
|
|
7058
|
-
} // sendMessage
|
|
7356
|
+
// Body of main function
|
|
7357
|
+
options = options || {};
|
|
7358
|
+
options.authorDateOnLeft = false; // @@ make a user optiosn
|
|
7059
7359
|
|
|
7360
|
+
newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
|
|
7060
7361
|
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
'?date': dateStamp,
|
|
7073
|
-
'?creator': me
|
|
7074
|
-
};
|
|
7075
|
-
(0, _message.renderMessage)(liveMessageTable, bindings, false, options, userContext); // not green
|
|
7362
|
+
channelObject = new _chatLogic.ChatChannel(chatChannel, options);
|
|
7363
|
+
dateFolder = channelObject.dateFolder;
|
|
7364
|
+
div = dom.createElement('div');
|
|
7365
|
+
channelObject.div = div;
|
|
7366
|
+
statusArea = div.appendChild(dom.createElement('div'));
|
|
7367
|
+
userContext = {
|
|
7368
|
+
dom: dom,
|
|
7369
|
+
statusArea: statusArea,
|
|
7370
|
+
div: statusArea
|
|
7371
|
+
}; // logged on state, pointers to user's stuff
|
|
7372
|
+
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
7076
7373
|
|
|
7077
|
-
|
|
7078
|
-
|
|
7374
|
+
earliest = {
|
|
7375
|
+
messageTable: null
|
|
7376
|
+
}; // Stuff about each end of the loaded days
|
|
7079
7377
|
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7378
|
+
latest = {
|
|
7379
|
+
messageTable: null
|
|
7380
|
+
};
|
|
7381
|
+
lock = false;
|
|
7382
|
+
_context12.next = 30;
|
|
7383
|
+
return loadInitialContent();
|
|
7083
7384
|
|
|
7084
|
-
|
|
7385
|
+
case 30:
|
|
7386
|
+
return _context12.abrupt("return", div);
|
|
7085
7387
|
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7388
|
+
case 31:
|
|
7389
|
+
case "end":
|
|
7390
|
+
return _context12.stop();
|
|
7391
|
+
}
|
|
7392
|
+
}
|
|
7393
|
+
}, _callee12);
|
|
7394
|
+
}));
|
|
7395
|
+
return _infiniteMessageArea.apply(this, arguments);
|
|
7396
|
+
}
|
|
7397
|
+
//# sourceMappingURL=infinite.js.map
|
|
7089
7398
|
|
|
7090
|
-
|
|
7091
|
-
_context6.next = 4;
|
|
7092
|
-
return addNewTableIfNewDay(now);
|
|
7399
|
+
/***/ }),
|
|
7093
7400
|
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7401
|
+
/***/ "./lib/chat/message.js":
|
|
7402
|
+
/*!*****************************!*\
|
|
7403
|
+
!*** ./lib/chat/message.js ***!
|
|
7404
|
+
\*****************************/
|
|
7405
|
+
/*! no static exports found */
|
|
7406
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
7097
7407
|
|
|
7098
|
-
|
|
7099
|
-
}
|
|
7408
|
+
"use strict";
|
|
7100
7409
|
|
|
7101
|
-
sts = [];
|
|
7102
|
-
timestamp = '' + now.getTime();
|
|
7103
|
-
dateStamp = $rdf.term(now);
|
|
7104
|
-
chatDocument = dateFolder.leafDocumentFromDate(now);
|
|
7105
|
-
message = kb.sym(chatDocument.uri + '#' + 'Msg' + timestamp);
|
|
7106
|
-
content = kb.literal(text || field.value); // if (text) field.value = text No - don't destroy half-finsihed user input
|
|
7107
7410
|
|
|
7108
|
-
|
|
7109
|
-
sts.push(new $rdf.Statement(message, ns.sioc('content'), content, chatDocument));
|
|
7110
|
-
sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, chatDocument));
|
|
7411
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
7111
7412
|
|
|
7112
|
-
|
|
7113
|
-
sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, chatDocument));
|
|
7114
|
-
}
|
|
7413
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
7115
7414
|
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7415
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7416
|
+
value: true
|
|
7417
|
+
});
|
|
7418
|
+
exports.creatorAndDate = creatorAndDate;
|
|
7419
|
+
exports.creatorAndDateHorizontal = creatorAndDateHorizontal;
|
|
7420
|
+
exports.elementForImageURI = elementForImageURI;
|
|
7421
|
+
exports.renderMessageEditor = renderMessageEditor;
|
|
7422
|
+
exports.renderMessageRow = renderMessageRow;
|
|
7423
|
+
exports.switchToEditor = switchToEditor;
|
|
7120
7424
|
|
|
7121
|
-
|
|
7122
|
-
_context6.next = 19;
|
|
7123
|
-
return createIfNotExists(chatDocument);
|
|
7425
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
7124
7426
|
|
|
7125
|
-
|
|
7126
|
-
_context6.prev = 19;
|
|
7127
|
-
_context6.next = 22;
|
|
7128
|
-
return updater.update([], sts);
|
|
7427
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
7129
7428
|
|
|
7130
|
-
|
|
7131
|
-
_context6.next = 28;
|
|
7132
|
-
break;
|
|
7429
|
+
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
7133
7430
|
|
|
7134
|
-
|
|
7135
|
-
_context6.prev = 24;
|
|
7136
|
-
_context6.t0 = _context6["catch"](19);
|
|
7137
|
-
form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + _context6.t0));
|
|
7138
|
-
return _context6.abrupt("return");
|
|
7431
|
+
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
7139
7432
|
|
|
7140
|
-
|
|
7141
|
-
sendComplete();
|
|
7433
|
+
var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./lib/chat/bookmarks.js");
|
|
7142
7434
|
|
|
7143
|
-
|
|
7144
|
-
case "end":
|
|
7145
|
-
return _context6.stop();
|
|
7146
|
-
}
|
|
7147
|
-
}
|
|
7148
|
-
}, _callee6, null, [[19, 24]]);
|
|
7149
|
-
}));
|
|
7150
|
-
return _sendMessage.apply(this, arguments);
|
|
7151
|
-
}
|
|
7435
|
+
var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js");
|
|
7152
7436
|
|
|
7153
|
-
|
|
7437
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
7154
7438
|
|
|
7155
|
-
|
|
7156
|
-
var base = messageTable.chatDocument.dir().uri;
|
|
7157
|
-
UI.widgets.uploadFiles(kb.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
|
|
7158
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(theFile, destURI) {
|
|
7159
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
7160
|
-
while (1) {
|
|
7161
|
-
switch (_context2.prev = _context2.next) {
|
|
7162
|
-
case 0:
|
|
7163
|
-
_context2.next = 2;
|
|
7164
|
-
return sendMessage(destURI);
|
|
7439
|
+
var _index = __webpack_require__(/*! ../authn/index */ "./lib/authn/index.js");
|
|
7165
7440
|
|
|
7166
|
-
|
|
7167
|
-
case "end":
|
|
7168
|
-
return _context2.stop();
|
|
7169
|
-
}
|
|
7170
|
-
}
|
|
7171
|
-
}, _callee2);
|
|
7172
|
-
}));
|
|
7441
|
+
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
7173
7442
|
|
|
7174
|
-
|
|
7175
|
-
return _ref.apply(this, arguments);
|
|
7176
|
-
};
|
|
7177
|
-
}());
|
|
7178
|
-
} // When a set of URIs are dropped on the field
|
|
7443
|
+
var _logic = __webpack_require__(/*! ../logic */ "./lib/logic.js");
|
|
7179
7444
|
|
|
7445
|
+
var _index2 = __webpack_require__(/*! ../media/index */ "./lib/media/index.js");
|
|
7180
7446
|
|
|
7181
|
-
|
|
7182
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(uris) {
|
|
7183
|
-
var _iterator, _step, uri;
|
|
7447
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
7184
7448
|
|
|
7185
|
-
|
|
7186
|
-
while (1) {
|
|
7187
|
-
switch (_context3.prev = _context3.next) {
|
|
7188
|
-
case 0:
|
|
7189
|
-
_iterator = _createForOfIteratorHelper(uris);
|
|
7190
|
-
_context3.prev = 1;
|
|
7449
|
+
var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./lib/pad.js"));
|
|
7191
7450
|
|
|
7192
|
-
|
|
7451
|
+
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
7193
7452
|
|
|
7194
|
-
|
|
7195
|
-
if ((_step = _iterator.n()).done) {
|
|
7196
|
-
_context3.next = 9;
|
|
7197
|
-
break;
|
|
7198
|
-
}
|
|
7453
|
+
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
7199
7454
|
|
|
7200
|
-
|
|
7201
|
-
_context3.next = 7;
|
|
7202
|
-
return sendMessage(uri);
|
|
7455
|
+
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
7203
7456
|
|
|
7204
|
-
|
|
7205
|
-
_context3.next = 3;
|
|
7206
|
-
break;
|
|
7457
|
+
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); }
|
|
7207
7458
|
|
|
7208
|
-
|
|
7209
|
-
_context3.next = 14;
|
|
7210
|
-
break;
|
|
7459
|
+
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; }
|
|
7211
7460
|
|
|
7212
|
-
|
|
7213
|
-
_context3.prev = 11;
|
|
7214
|
-
_context3.t0 = _context3["catch"](1);
|
|
7461
|
+
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; } } }; }
|
|
7215
7462
|
|
|
7216
|
-
|
|
7463
|
+
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); }
|
|
7217
7464
|
|
|
7218
|
-
|
|
7219
|
-
_context3.prev = 14;
|
|
7465
|
+
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; }
|
|
7220
7466
|
|
|
7221
|
-
|
|
7467
|
+
// const UI = { authn, icons, ns, media, pad, rdf, store, style, utils, widgets }
|
|
7468
|
+
var dom = window.document; // const store = store
|
|
7222
7469
|
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
}
|
|
7229
|
-
}
|
|
7230
|
-
}, _callee3, null, [[1, 11, 14, 17]]);
|
|
7231
|
-
}));
|
|
7232
|
-
|
|
7233
|
-
return function droppedURIHandler(_x9) {
|
|
7234
|
-
return _ref2.apply(this, arguments);
|
|
7235
|
-
};
|
|
7236
|
-
}(); // When we are actually logged on
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
function turnOnInput() {
|
|
7240
|
-
if (options.menuHandler && menuButton) {
|
|
7241
|
-
var menuOptions = {
|
|
7242
|
-
me: me,
|
|
7243
|
-
dom: dom,
|
|
7244
|
-
div: div,
|
|
7245
|
-
newBase: messageTable.chatDocument.dir().uri
|
|
7246
|
-
};
|
|
7247
|
-
menuButton.addEventListener('click', function (event) {
|
|
7248
|
-
options.menuHandler(event, chatChannel, menuOptions);
|
|
7249
|
-
}, false);
|
|
7250
|
-
} // Turn on message input
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
(0, _message.creatorAndDate)(lhs, me, '', null);
|
|
7254
|
-
field = dom.createElement('textarea');
|
|
7255
|
-
middle.innerHTML = '';
|
|
7256
|
-
middle.appendChild(field);
|
|
7257
|
-
field.rows = 3; // field.cols = 40
|
|
7258
|
-
|
|
7259
|
-
field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
|
|
7260
|
-
|
|
7261
|
-
field.addEventListener('keydown', /*#__PURE__*/function () {
|
|
7262
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(e) {
|
|
7263
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
7264
|
-
while (1) {
|
|
7265
|
-
switch (_context4.prev = _context4.next) {
|
|
7266
|
-
case 0:
|
|
7267
|
-
if (!(e.keyCode === 13)) {
|
|
7268
|
-
_context4.next = 4;
|
|
7269
|
-
break;
|
|
7270
|
-
}
|
|
7271
|
-
|
|
7272
|
-
if (e.altKey) {
|
|
7273
|
-
_context4.next = 4;
|
|
7274
|
-
break;
|
|
7275
|
-
}
|
|
7276
|
-
|
|
7277
|
-
_context4.next = 4;
|
|
7278
|
-
return sendMessage();
|
|
7279
|
-
|
|
7280
|
-
case 4:
|
|
7281
|
-
case "end":
|
|
7282
|
-
return _context4.stop();
|
|
7283
|
-
}
|
|
7284
|
-
}
|
|
7285
|
-
}, _callee4);
|
|
7286
|
-
}));
|
|
7287
|
-
|
|
7288
|
-
return function (_x10) {
|
|
7289
|
-
return _ref3.apply(this, arguments);
|
|
7290
|
-
};
|
|
7291
|
-
}(), false);
|
|
7292
|
-
UI.widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
|
|
7293
|
-
rhs.innerHTML = '';
|
|
7294
|
-
sendButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_383448.svg', 'Send');
|
|
7295
|
-
sendButton.setAttribute('style', UI.style.buttonStyle + 'float: right;');
|
|
7296
|
-
sendButton.addEventListener('click', function (_event) {
|
|
7297
|
-
return sendMessage();
|
|
7298
|
-
}, false);
|
|
7299
|
-
rhs.appendChild(sendButton);
|
|
7300
|
-
var chatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
7301
|
-
var imageDoc;
|
|
7302
|
-
|
|
7303
|
-
function getImageDoc() {
|
|
7304
|
-
imageDoc = kb.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
7305
|
-
return imageDoc;
|
|
7306
|
-
}
|
|
7307
|
-
|
|
7308
|
-
function tookPicture(_x11) {
|
|
7309
|
-
return _tookPicture.apply(this, arguments);
|
|
7310
|
-
}
|
|
7311
|
-
|
|
7312
|
-
function _tookPicture() {
|
|
7313
|
-
_tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(imageDoc) {
|
|
7314
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
7315
|
-
while (1) {
|
|
7316
|
-
switch (_context5.prev = _context5.next) {
|
|
7317
|
-
case 0:
|
|
7318
|
-
if (!imageDoc) {
|
|
7319
|
-
_context5.next = 3;
|
|
7320
|
-
break;
|
|
7321
|
-
}
|
|
7322
|
-
|
|
7323
|
-
_context5.next = 3;
|
|
7324
|
-
return sendMessage(imageDoc.uri);
|
|
7325
|
-
|
|
7326
|
-
case 3:
|
|
7327
|
-
case "end":
|
|
7328
|
-
return _context5.stop();
|
|
7329
|
-
}
|
|
7330
|
-
}
|
|
7331
|
-
}, _callee5);
|
|
7332
|
-
}));
|
|
7333
|
-
return _tookPicture.apply(this, arguments);
|
|
7334
|
-
}
|
|
7335
|
-
|
|
7336
|
-
middle.appendChild(UI.media.cameraButton(dom, kb, getImageDoc, tookPicture));
|
|
7337
|
-
UI.pad.recordParticipation(chatChannel, chatChannel.doc()); // participation =
|
|
7338
|
-
} // turn on inpuut
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
var context = {
|
|
7342
|
-
div: middle,
|
|
7343
|
-
dom: dom
|
|
7344
|
-
};
|
|
7345
|
-
UI.authn.logIn(context).then(function (context) {
|
|
7346
|
-
me = context.me;
|
|
7347
|
-
turnOnInput();
|
|
7348
|
-
Object.assign(context, userContext);
|
|
7349
|
-
(0, _bookmarks.findBookmarkDocument)(context).then(function (context) {
|
|
7350
|
-
debug.log('Bookmark file: ' + context.bookmarkDocument);
|
|
7351
|
-
});
|
|
7352
|
-
});
|
|
7353
|
-
return form;
|
|
7354
|
-
};
|
|
7355
|
-
|
|
7356
|
-
kb = kb || UI.store;
|
|
7357
|
-
ns = UI.ns;
|
|
7358
|
-
WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#');
|
|
7359
|
-
DCT = $rdf.Namespace('http://purl.org/dc/terms/'); // const POSIX = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
|
|
7360
|
-
|
|
7361
|
-
options = options || {};
|
|
7362
|
-
newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
|
|
7363
|
-
|
|
7364
|
-
dateFolder = new _dateFolder.DateFolder(chatChannel, 'chat.ttl');
|
|
7365
|
-
options.authorAboveContent = true; // var participation // An object tracking users use and prefs
|
|
7366
|
-
|
|
7367
|
-
messageBodyStyle = UI.style.messageBodyStyle; // var messageBodyStyle = 'white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;'
|
|
7368
|
-
// 'font-size: 100%; margin: 0.1em 1em 0.1em 1em; background-color: white; white-space: pre-wrap; padding: 0.1em;'
|
|
7369
|
-
|
|
7370
|
-
div = dom.createElement('div');
|
|
7371
|
-
statusArea = div.appendChild(dom.createElement('div'));
|
|
7372
|
-
userContext = {
|
|
7373
|
-
dom: dom,
|
|
7374
|
-
statusArea: statusArea,
|
|
7375
|
-
div: statusArea
|
|
7376
|
-
}; // logged on state, pointers to user's stuff
|
|
7377
|
-
|
|
7378
|
-
updater = UI.store.updater;
|
|
7379
|
-
/** Does a file exist on the web?
|
|
7380
|
-
* @returns {Boolean}
|
|
7381
|
-
*/
|
|
7382
|
-
|
|
7383
|
-
/*
|
|
7384
|
-
async function documentExists (doc) {
|
|
7385
|
-
try {
|
|
7386
|
-
await kb.fetcher.load(doc)
|
|
7387
|
-
} catch (err) {
|
|
7388
|
-
if (err.response.status === 404) {
|
|
7389
|
-
return false
|
|
7390
|
-
} else {
|
|
7391
|
-
debug.log('documentExists: doc load error NOT 404: ' + doc + ': ' + err)
|
|
7392
|
-
throw err
|
|
7393
|
-
}
|
|
7394
|
-
}
|
|
7395
|
-
return true
|
|
7396
|
-
}
|
|
7397
|
-
*/
|
|
7398
|
-
|
|
7399
|
-
/* Form for a new message
|
|
7400
|
-
*/
|
|
7401
|
-
|
|
7402
|
-
earliest = {
|
|
7403
|
-
messageTable: null
|
|
7404
|
-
}; // Stuff about each end of the loaded days
|
|
7405
|
-
|
|
7406
|
-
latest = {
|
|
7407
|
-
messageTable: null
|
|
7408
|
-
};
|
|
7409
|
-
lock = false;
|
|
7410
|
-
_context17.next = 35;
|
|
7411
|
-
return loadInitialContent();
|
|
7412
|
-
|
|
7413
|
-
case 35:
|
|
7414
|
-
return _context17.abrupt("return", div);
|
|
7415
|
-
|
|
7416
|
-
case 36:
|
|
7417
|
-
case "end":
|
|
7418
|
-
return _context17.stop();
|
|
7419
|
-
}
|
|
7420
|
-
}
|
|
7421
|
-
}, _callee17);
|
|
7422
|
-
}));
|
|
7423
|
-
return _infiniteMessageArea.apply(this, arguments);
|
|
7424
|
-
}
|
|
7425
|
-
//# sourceMappingURL=infinite.js.map
|
|
7426
|
-
|
|
7427
|
-
/***/ }),
|
|
7428
|
-
|
|
7429
|
-
/***/ "./lib/chat/message.js":
|
|
7430
|
-
/*!*****************************!*\
|
|
7431
|
-
!*** ./lib/chat/message.js ***!
|
|
7432
|
-
\*****************************/
|
|
7433
|
-
/*! no static exports found */
|
|
7434
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
7435
|
-
|
|
7436
|
-
"use strict";
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
7440
|
-
|
|
7441
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7442
|
-
value: true
|
|
7443
|
-
});
|
|
7444
|
-
exports.creatorAndDate = creatorAndDate;
|
|
7445
|
-
exports.creatorAndDateHorizontal = creatorAndDateHorizontal;
|
|
7446
|
-
exports.elementForImageURI = elementForImageURI;
|
|
7447
|
-
exports.renderMessage = renderMessage;
|
|
7448
|
-
|
|
7449
|
-
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
7450
|
-
|
|
7451
|
-
var _index = __webpack_require__(/*! ../authn/index */ "./lib/authn/index.js");
|
|
7452
|
-
|
|
7453
|
-
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
7454
|
-
|
|
7455
|
-
var _logic = __webpack_require__(/*! ../logic */ "./lib/logic.js");
|
|
7456
|
-
|
|
7457
|
-
var _index2 = __webpack_require__(/*! ../media/index */ "./lib/media/index.js");
|
|
7458
|
-
|
|
7459
|
-
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
7460
|
-
|
|
7461
|
-
var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./lib/pad.js"));
|
|
7462
|
-
|
|
7463
|
-
var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
7464
|
-
|
|
7465
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
7466
|
-
|
|
7467
|
-
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
7468
|
-
|
|
7469
|
-
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
7470
|
-
|
|
7471
|
-
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); }
|
|
7472
|
-
|
|
7473
|
-
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; }
|
|
7474
|
-
|
|
7475
|
-
/**
|
|
7476
|
-
* Contains the [[renderMessage]] function,
|
|
7477
|
-
* along with [[elementForImageURI]],
|
|
7478
|
-
* [[creatorAndDate]], and [[creatorAndDateHorizontal]]
|
|
7479
|
-
* @packageDocumentation
|
|
7480
|
-
*/
|
|
7481
|
-
|
|
7482
|
-
/* global $rdf */
|
|
7483
|
-
// pull in first avoid cross-refs
|
|
7484
|
-
var UI = {
|
|
7485
|
-
authn: _index.authn,
|
|
7486
|
-
icons: _iconBase.icons,
|
|
7487
|
-
ns: ns,
|
|
7488
|
-
media: _index2.media,
|
|
7489
|
-
pad: pad,
|
|
7490
|
-
rdf: rdf,
|
|
7491
|
-
store: _logic.store,
|
|
7492
|
-
style: style,
|
|
7493
|
-
utils: utils,
|
|
7494
|
-
widgets: widgets
|
|
7495
|
-
};
|
|
7496
|
-
var dom = UI.dom || window.document; // const kb = UI.store
|
|
7497
|
-
|
|
7498
|
-
var messageBodyStyle = UI.style.messageBodyStyle;
|
|
7499
|
-
var label = UI.utils.label;
|
|
7500
|
-
/**
|
|
7501
|
-
* HTML component for an image
|
|
7502
|
-
*/
|
|
7470
|
+
var messageBodyStyle = style.messageBodyStyle;
|
|
7471
|
+
var label = utils.label;
|
|
7472
|
+
/**
|
|
7473
|
+
* HTML component for an image
|
|
7474
|
+
*/
|
|
7503
7475
|
|
|
7504
7476
|
function elementForImageURI(imageUri, options) {
|
|
7505
7477
|
var img = dom.createElement('img');
|
|
@@ -7509,14 +7481,14 @@ function elementForImageURI(imageUri, options) {
|
|
|
7509
7481
|
height = ('' + options.inlineImageHeightEms).trim();
|
|
7510
7482
|
}
|
|
7511
7483
|
|
|
7512
|
-
img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); //
|
|
7484
|
+
img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); // widgets.makeDropTarget(img, handleURIsDroppedOnMugshot, droppedFileHandler)
|
|
7513
7485
|
|
|
7514
7486
|
if (imageUri) img.setAttribute('src', imageUri);
|
|
7515
7487
|
var anchor = dom.createElement('a');
|
|
7516
7488
|
anchor.setAttribute('href', imageUri);
|
|
7517
7489
|
anchor.setAttribute('target', 'images');
|
|
7518
7490
|
anchor.appendChild(img);
|
|
7519
|
-
|
|
7491
|
+
widgets.makeDraggable(img, $rdf.sym(imageUri));
|
|
7520
7492
|
return anchor;
|
|
7521
7493
|
}
|
|
7522
7494
|
|
|
@@ -7526,7 +7498,7 @@ var anchor = function anchor(text, term) {
|
|
|
7526
7498
|
|
|
7527
7499
|
if (term && term.uri) {
|
|
7528
7500
|
a.setAttribute('href', term.uri);
|
|
7529
|
-
a.addEventListener('click',
|
|
7501
|
+
a.addEventListener('click', widgets.openHrefInOutlineMode, true);
|
|
7530
7502
|
a.setAttribute('style', 'color: #3B5998; text-decoration: none; '); // font-weight: bold
|
|
7531
7503
|
}
|
|
7532
7504
|
|
|
@@ -7535,7 +7507,8 @@ var anchor = function anchor(text, term) {
|
|
|
7535
7507
|
};
|
|
7536
7508
|
|
|
7537
7509
|
function nick(person) {
|
|
7538
|
-
var s =
|
|
7510
|
+
var s = _logic.store.any(person, ns.foaf('nick'));
|
|
7511
|
+
|
|
7539
7512
|
if (s) return '' + s.value;
|
|
7540
7513
|
return '' + label(person);
|
|
7541
7514
|
}
|
|
@@ -7549,7 +7522,7 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
7549
7522
|
var nickAnchor = td1.appendChild(anchor(nick(creator), creator));
|
|
7550
7523
|
|
|
7551
7524
|
if (creator.uri) {
|
|
7552
|
-
|
|
7525
|
+
_logic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
7553
7526
|
nickAnchor.textContent = nick(creator);
|
|
7554
7527
|
});
|
|
7555
7528
|
}
|
|
@@ -7567,7 +7540,7 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
7567
7540
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
7568
7541
|
|
|
7569
7542
|
if (creator.uri) {
|
|
7570
|
-
|
|
7543
|
+
_logic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
7571
7544
|
nickAnchor.textContent = nick(creator);
|
|
7572
7545
|
});
|
|
7573
7546
|
}
|
|
@@ -7578,143 +7551,516 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
7578
7551
|
td1.appendChild(dom.createElement('br'));
|
|
7579
7552
|
}
|
|
7580
7553
|
/**
|
|
7581
|
-
* Renders a chat message
|
|
7554
|
+
* Renders a chat message, read-only mode
|
|
7555
|
+
*/
|
|
7556
|
+
|
|
7557
|
+
|
|
7558
|
+
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
7559
|
+
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
7560
|
+
|
|
7561
|
+
var creator = _logic.store.any(message, ns.foaf('maker'));
|
|
7562
|
+
|
|
7563
|
+
var date = _logic.store.any(message, ns.dct('created'));
|
|
7564
|
+
|
|
7565
|
+
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
7566
|
+
|
|
7567
|
+
var content = _logic.store.any(latestVersion, ns.sioc('content'));
|
|
7568
|
+
|
|
7569
|
+
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
7570
|
+
var edited = !message.sameTerm(originalMessage);
|
|
7571
|
+
|
|
7572
|
+
var sortDate = _logic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
7573
|
+
|
|
7574
|
+
|
|
7575
|
+
var messageRow = dom.createElement('tr');
|
|
7576
|
+
messageRow.AJAR_date = sortDate.value;
|
|
7577
|
+
messageRow.AJAR_subject = message;
|
|
7578
|
+
var td1 = dom.createElement('td');
|
|
7579
|
+
messageRow.appendChild(td1);
|
|
7580
|
+
|
|
7581
|
+
if (!options.authorDateOnLeft) {
|
|
7582
|
+
var img = dom.createElement('img');
|
|
7583
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
7584
|
+
widgets.setImage(img, creator);
|
|
7585
|
+
td1.appendChild(img);
|
|
7586
|
+
} else {
|
|
7587
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
7588
|
+
}
|
|
7589
|
+
|
|
7590
|
+
var bothDates = widgets.shortDate(sortDate.value);
|
|
7591
|
+
|
|
7592
|
+
if (edited) {
|
|
7593
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
7594
|
+
} // Render the content ot the message itself
|
|
7595
|
+
|
|
7596
|
+
|
|
7597
|
+
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
7598
|
+
|
|
7599
|
+
if (!options.authorDateOnLeft) {
|
|
7600
|
+
creatorAndDateHorizontal(td2, creator, bothDates, // widgets.shortDate(dateString)
|
|
7601
|
+
message);
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7604
|
+
var text = content.value.trim();
|
|
7605
|
+
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
7606
|
+
var para = null;
|
|
7607
|
+
|
|
7608
|
+
if (isURI) {
|
|
7609
|
+
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
7610
|
+
|
|
7611
|
+
if (isImage && options.expandImagesInline) {
|
|
7612
|
+
var _img = elementForImageURI(text, options);
|
|
7613
|
+
|
|
7614
|
+
td2.appendChild(_img);
|
|
7615
|
+
} else {
|
|
7616
|
+
// Link but not Image
|
|
7617
|
+
var anc = td2.appendChild(dom.createElement('a'));
|
|
7618
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
7619
|
+
anc.href = text;
|
|
7620
|
+
para.textContent = text;
|
|
7621
|
+
td2.appendChild(anc);
|
|
7622
|
+
}
|
|
7623
|
+
} else {
|
|
7624
|
+
// text
|
|
7625
|
+
para = dom.createElement('p');
|
|
7626
|
+
td2.appendChild(para);
|
|
7627
|
+
para.textContent = text;
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7630
|
+
if (para) {
|
|
7631
|
+
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
7632
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
7633
|
+
}
|
|
7634
|
+
|
|
7635
|
+
function getBgColor(fresh) {
|
|
7636
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
7637
|
+
} // Sentiment strip
|
|
7638
|
+
|
|
7639
|
+
|
|
7640
|
+
var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
7641
|
+
|
|
7642
|
+
if (strip.children.length) {
|
|
7643
|
+
td2.appendChild(dom.createElement('br'));
|
|
7644
|
+
td2.appendChild(strip);
|
|
7645
|
+
} // Message tool bar button
|
|
7646
|
+
|
|
7647
|
+
|
|
7648
|
+
var td3 = dom.createElement('td');
|
|
7649
|
+
messageRow.appendChild(td3);
|
|
7650
|
+
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
7651
|
+
td3.appendChild(toolsButton);
|
|
7652
|
+
toolsButton.addEventListener('click', function (_event) {
|
|
7653
|
+
if (messageRow.toolTR) {
|
|
7654
|
+
// already got a toolbar? Toogle
|
|
7655
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
7656
|
+
delete messageRow.toolTR;
|
|
7657
|
+
return;
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
var toolsTR = dom.createElement('tr');
|
|
7661
|
+
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
7662
|
+
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
|
|
7663
|
+
|
|
7664
|
+
if (messageRow.nextSibling) {
|
|
7665
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
7666
|
+
} else {
|
|
7667
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
7668
|
+
}
|
|
7669
|
+
|
|
7670
|
+
messageRow.toolTR = toolsTR;
|
|
7671
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
7672
|
+
|
|
7673
|
+
var toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
7674
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
7675
|
+
|
|
7676
|
+
toolsTD.appendChild(tools);
|
|
7677
|
+
});
|
|
7678
|
+
return messageRow;
|
|
7679
|
+
}
|
|
7680
|
+
|
|
7681
|
+
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
7682
|
+
var messageTable = messageRow.parentNode;
|
|
7683
|
+
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
7684
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
7685
|
+
editRow.originalRow = messageRow;
|
|
7686
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
7687
|
+
}
|
|
7688
|
+
/* Control for a new message -- or editing an old message ***************
|
|
7689
|
+
*
|
|
7582
7690
|
*/
|
|
7583
7691
|
|
|
7584
7692
|
|
|
7585
|
-
function
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7693
|
+
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
7694
|
+
function revertEditing(messageEditor) {
|
|
7695
|
+
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
7696
|
+
|
|
7697
|
+
messageEditor.parentNode.removeChild(messageEditor);
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7700
|
+
function handleFieldInput(_x) {
|
|
7701
|
+
return _handleFieldInput.apply(this, arguments);
|
|
7702
|
+
}
|
|
7703
|
+
|
|
7704
|
+
function _handleFieldInput() {
|
|
7705
|
+
_handleFieldInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_event) {
|
|
7706
|
+
return _regenerator["default"].wrap(function _callee5$(_context6) {
|
|
7707
|
+
while (1) {
|
|
7708
|
+
switch (_context6.prev = _context6.next) {
|
|
7709
|
+
case 0:
|
|
7710
|
+
_context6.next = 2;
|
|
7711
|
+
return sendMessage(field.value, true);
|
|
7712
|
+
|
|
7713
|
+
case 2:
|
|
7714
|
+
case "end":
|
|
7715
|
+
return _context6.stop();
|
|
7716
|
+
}
|
|
7717
|
+
}
|
|
7718
|
+
}, _callee5);
|
|
7719
|
+
}));
|
|
7720
|
+
return _handleFieldInput.apply(this, arguments);
|
|
7721
|
+
}
|
|
7722
|
+
|
|
7723
|
+
function sendMessage(_x2, _x3) {
|
|
7724
|
+
return _sendMessage.apply(this, arguments);
|
|
7725
|
+
} // sendMessage
|
|
7726
|
+
// DRAG AND DROP
|
|
7727
|
+
|
|
7728
|
+
|
|
7729
|
+
function _sendMessage() {
|
|
7730
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text, fromMainField) {
|
|
7731
|
+
var sendComplete, message, statusArea;
|
|
7732
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
7733
|
+
while (1) {
|
|
7734
|
+
switch (_context7.prev = _context7.next) {
|
|
7735
|
+
case 0:
|
|
7736
|
+
sendComplete = function _sendComplete(message, _text2) {
|
|
7737
|
+
// const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
|
|
7738
|
+
// const content = $rdf.literal(text2)
|
|
7739
|
+
(0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
|
|
7740
|
+
|
|
7741
|
+
if (originalMessage) {
|
|
7742
|
+
// editing another message
|
|
7743
|
+
var oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
7744
|
+
|
|
7745
|
+
if (oldRow.parentNode) {
|
|
7746
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
7747
|
+
} else {
|
|
7748
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
7749
|
+
oldRow.style.backgroundColor = '#fee';
|
|
7750
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
7751
|
+
}
|
|
7752
|
+
|
|
7753
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
7754
|
+
} else {
|
|
7755
|
+
if (fromMainField) {
|
|
7756
|
+
field.value = ''; // clear from out for reuse
|
|
7757
|
+
|
|
7758
|
+
field.setAttribute('style', messageBodyStyle);
|
|
7759
|
+
field.disabled = false;
|
|
7760
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
7761
|
+
|
|
7762
|
+
field.focus(); // Start typing next line immediately
|
|
7763
|
+
|
|
7764
|
+
field.select();
|
|
7765
|
+
}
|
|
7766
|
+
} // await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
7767
|
+
|
|
7768
|
+
};
|
|
7769
|
+
|
|
7770
|
+
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
7771
|
+
if (fromMainField) {
|
|
7772
|
+
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
7773
|
+
|
|
7774
|
+
field.disabled = true;
|
|
7775
|
+
}
|
|
7776
|
+
|
|
7777
|
+
_context7.prev = 2;
|
|
7778
|
+
_context7.next = 5;
|
|
7779
|
+
return channelObject.updateMessage(text, originalMessage);
|
|
7780
|
+
|
|
7781
|
+
case 5:
|
|
7782
|
+
message = _context7.sent;
|
|
7783
|
+
_context7.next = 13;
|
|
7784
|
+
break;
|
|
7785
|
+
|
|
7786
|
+
case 8:
|
|
7787
|
+
_context7.prev = 8;
|
|
7788
|
+
_context7.t0 = _context7["catch"](2);
|
|
7789
|
+
statusArea = userContext.statusArea || messageEditor;
|
|
7790
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context7.t0));
|
|
7791
|
+
return _context7.abrupt("return");
|
|
7792
|
+
|
|
7793
|
+
case 13:
|
|
7794
|
+
sendComplete(message, text);
|
|
7795
|
+
|
|
7796
|
+
case 14:
|
|
7797
|
+
case "end":
|
|
7798
|
+
return _context7.stop();
|
|
7799
|
+
}
|
|
7800
|
+
}
|
|
7801
|
+
}, _callee6, null, [[2, 8]]);
|
|
7802
|
+
}));
|
|
7803
|
+
return _sendMessage.apply(this, arguments);
|
|
7804
|
+
}
|
|
7805
|
+
|
|
7806
|
+
function droppedFileHandler(files) {
|
|
7807
|
+
var base = messageTable.chatDocument.dir().uri;
|
|
7808
|
+
widgets.uploadFiles(_logic.store.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
|
|
7809
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(theFile, destURI) {
|
|
7810
|
+
return _regenerator["default"].wrap(function _callee$(_context2) {
|
|
7811
|
+
while (1) {
|
|
7812
|
+
switch (_context2.prev = _context2.next) {
|
|
7813
|
+
case 0:
|
|
7814
|
+
_context2.next = 2;
|
|
7815
|
+
return sendMessage(destURI);
|
|
7816
|
+
|
|
7817
|
+
case 2:
|
|
7818
|
+
case "end":
|
|
7819
|
+
return _context2.stop();
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
}, _callee);
|
|
7823
|
+
}));
|
|
7824
|
+
|
|
7825
|
+
return function (_x4, _x5) {
|
|
7826
|
+
return _ref.apply(this, arguments);
|
|
7827
|
+
};
|
|
7828
|
+
}());
|
|
7829
|
+
} // When a set of URIs are dropped on the field
|
|
7830
|
+
|
|
7831
|
+
|
|
7832
|
+
var droppedURIHandler = /*#__PURE__*/function () {
|
|
7833
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(uris) {
|
|
7834
|
+
var _iterator, _step, uri;
|
|
7835
|
+
|
|
7836
|
+
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
7837
|
+
while (1) {
|
|
7838
|
+
switch (_context3.prev = _context3.next) {
|
|
7839
|
+
case 0:
|
|
7840
|
+
_iterator = _createForOfIteratorHelper(uris);
|
|
7841
|
+
_context3.prev = 1;
|
|
7842
|
+
|
|
7843
|
+
_iterator.s();
|
|
7844
|
+
|
|
7845
|
+
case 3:
|
|
7846
|
+
if ((_step = _iterator.n()).done) {
|
|
7847
|
+
_context3.next = 9;
|
|
7848
|
+
break;
|
|
7849
|
+
}
|
|
7850
|
+
|
|
7851
|
+
uri = _step.value;
|
|
7852
|
+
_context3.next = 7;
|
|
7853
|
+
return sendMessage(uri);
|
|
7854
|
+
|
|
7855
|
+
case 7:
|
|
7856
|
+
_context3.next = 3;
|
|
7857
|
+
break;
|
|
7858
|
+
|
|
7859
|
+
case 9:
|
|
7860
|
+
_context3.next = 14;
|
|
7861
|
+
break;
|
|
7862
|
+
|
|
7863
|
+
case 11:
|
|
7864
|
+
_context3.prev = 11;
|
|
7865
|
+
_context3.t0 = _context3["catch"](1);
|
|
7866
|
+
|
|
7867
|
+
_iterator.e(_context3.t0);
|
|
7868
|
+
|
|
7869
|
+
case 14:
|
|
7870
|
+
_context3.prev = 14;
|
|
7871
|
+
|
|
7872
|
+
_iterator.f();
|
|
7873
|
+
|
|
7874
|
+
return _context3.finish(14);
|
|
7875
|
+
|
|
7876
|
+
case 17:
|
|
7877
|
+
case "end":
|
|
7878
|
+
return _context3.stop();
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
7882
|
+
}));
|
|
7883
|
+
|
|
7884
|
+
return function droppedURIHandler(_x6) {
|
|
7885
|
+
return _ref2.apply(this, arguments);
|
|
7886
|
+
};
|
|
7887
|
+
}(); // When we are actually logged on
|
|
7888
|
+
|
|
7889
|
+
|
|
7890
|
+
function turnOnInput() {
|
|
7891
|
+
function getImageDoc() {
|
|
7892
|
+
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
7893
|
+
return imageDoc;
|
|
7894
|
+
}
|
|
7895
|
+
|
|
7896
|
+
function tookPicture(_x7) {
|
|
7897
|
+
return _tookPicture.apply(this, arguments);
|
|
7898
|
+
} // Body of turnOnInput
|
|
7899
|
+
|
|
7900
|
+
|
|
7901
|
+
function _tookPicture() {
|
|
7902
|
+
_tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(imageDoc) {
|
|
7903
|
+
return _regenerator["default"].wrap(function _callee4$(_context5) {
|
|
7904
|
+
while (1) {
|
|
7905
|
+
switch (_context5.prev = _context5.next) {
|
|
7906
|
+
case 0:
|
|
7907
|
+
if (!imageDoc) {
|
|
7908
|
+
_context5.next = 3;
|
|
7909
|
+
break;
|
|
7910
|
+
}
|
|
7911
|
+
|
|
7912
|
+
_context5.next = 3;
|
|
7913
|
+
return sendMessage(imageDoc.uri);
|
|
7914
|
+
|
|
7915
|
+
case 3:
|
|
7916
|
+
case "end":
|
|
7917
|
+
return _context5.stop();
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
}, _callee4);
|
|
7921
|
+
}));
|
|
7922
|
+
return _tookPicture.apply(this, arguments);
|
|
7923
|
+
}
|
|
7595
7924
|
|
|
7596
|
-
|
|
7597
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
7598
|
-
options.selectedElement = messageRow;
|
|
7599
|
-
messageTable.selectedElement = messageRow;
|
|
7600
|
-
}
|
|
7925
|
+
var menuButton;
|
|
7601
7926
|
|
|
7602
|
-
|
|
7927
|
+
if (options.menuHandler) {
|
|
7928
|
+
var _menuButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', 'More');
|
|
7603
7929
|
|
|
7604
|
-
|
|
7605
|
-
if (!ele) {
|
|
7606
|
-
// empty
|
|
7607
|
-
break;
|
|
7608
|
-
}
|
|
7930
|
+
_menuButton.setAttribute('style', style.buttonStyle + 'float: right;'); // menuButton.addEventListener('click', _event => sendMessage(), false) (done in turnoninput)
|
|
7609
7931
|
|
|
7610
|
-
var newestFirst = options.newestfirst === true;
|
|
7611
7932
|
|
|
7612
|
-
|
|
7613
|
-
messageTable.insertBefore(messageRow, ele);
|
|
7614
|
-
done = true;
|
|
7615
|
-
break;
|
|
7933
|
+
rhs.appendChild(_menuButton);
|
|
7616
7934
|
}
|
|
7617
|
-
}
|
|
7618
7935
|
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
}
|
|
7936
|
+
if (options.menuHandler && menuButton) {
|
|
7937
|
+
var _me = _index.authn.currentUser();
|
|
7622
7938
|
|
|
7623
|
-
|
|
7624
|
-
|
|
7939
|
+
var menuOptions = {
|
|
7940
|
+
me: _me,
|
|
7941
|
+
dom: dom,
|
|
7942
|
+
div: null,
|
|
7943
|
+
// @@ was: div
|
|
7944
|
+
newBase: messageTable.chatDocument.dir().uri
|
|
7945
|
+
};
|
|
7946
|
+
menuButton.addEventListener('click', function (event) {
|
|
7947
|
+
options.menuHandler(event, channelObject.chatChannel, menuOptions);
|
|
7948
|
+
}, false);
|
|
7949
|
+
}
|
|
7625
7950
|
|
|
7626
|
-
|
|
7627
|
-
var img = dom.createElement('img');
|
|
7628
|
-
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
7629
|
-
UI.widgets.setImage(img, creator);
|
|
7630
|
-
td1.appendChild(img);
|
|
7631
|
-
} else {
|
|
7632
|
-
creatorAndDate(td1, creator, UI.widgets.shortDate(dateString), message);
|
|
7633
|
-
} // Render the content ot the message itself
|
|
7951
|
+
var me = _index.authn.currentUser(); // If already logged on
|
|
7634
7952
|
|
|
7635
7953
|
|
|
7636
|
-
|
|
7954
|
+
creatorAndDate(lhs, me, '', null);
|
|
7955
|
+
field = dom.createElement('textarea');
|
|
7956
|
+
middle.innerHTML = '';
|
|
7957
|
+
middle.appendChild(field);
|
|
7958
|
+
field.rows = 3;
|
|
7637
7959
|
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7960
|
+
if (originalMessage) {
|
|
7961
|
+
field.value = _logic.store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc());
|
|
7962
|
+
} // field.cols = 40
|
|
7641
7963
|
|
|
7642
|
-
var text = content.value.trim();
|
|
7643
|
-
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
7644
|
-
var para = null;
|
|
7645
7964
|
|
|
7646
|
-
|
|
7647
|
-
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
7965
|
+
field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
|
|
7648
7966
|
|
|
7649
|
-
|
|
7650
|
-
var
|
|
7967
|
+
field.addEventListener('keydown', /*#__PURE__*/function () {
|
|
7968
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
|
|
7969
|
+
return _regenerator["default"].wrap(function _callee3$(_context4) {
|
|
7970
|
+
while (1) {
|
|
7971
|
+
switch (_context4.prev = _context4.next) {
|
|
7972
|
+
case 0:
|
|
7973
|
+
if (!(e.code === 'Enter')) {
|
|
7974
|
+
_context4.next = 4;
|
|
7975
|
+
break;
|
|
7976
|
+
}
|
|
7651
7977
|
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
para = anc.appendChild(dom.createElement('p'));
|
|
7657
|
-
anc.href = text;
|
|
7658
|
-
para.textContent = text;
|
|
7659
|
-
td2.appendChild(anc);
|
|
7660
|
-
}
|
|
7661
|
-
} else {
|
|
7662
|
-
// text
|
|
7663
|
-
para = dom.createElement('p');
|
|
7664
|
-
td2.appendChild(para);
|
|
7665
|
-
para.textContent = text;
|
|
7666
|
-
}
|
|
7978
|
+
if (!(!e.shiftKey && !options.shiftEnterSendsMessage || e.shiftKey && options.shiftEnterSendsMessage)) {
|
|
7979
|
+
_context4.next = 4;
|
|
7980
|
+
break;
|
|
7981
|
+
}
|
|
7667
7982
|
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
7671
|
-
}
|
|
7983
|
+
_context4.next = 4;
|
|
7984
|
+
return handleFieldInput(e);
|
|
7672
7985
|
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7986
|
+
case 4:
|
|
7987
|
+
case "end":
|
|
7988
|
+
return _context4.stop();
|
|
7989
|
+
}
|
|
7990
|
+
}
|
|
7991
|
+
}, _callee3);
|
|
7992
|
+
}));
|
|
7676
7993
|
|
|
7994
|
+
return function (_x8) {
|
|
7995
|
+
return _ref3.apply(this, arguments);
|
|
7996
|
+
};
|
|
7997
|
+
}(), false);
|
|
7998
|
+
widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
|
|
7999
|
+
rhs.innerHTML = '';
|
|
8000
|
+
sendButton = widgets.button(dom, sendIcon, 'Send');
|
|
8001
|
+
sendButton.style["float"] = 'right';
|
|
8002
|
+
sendButton.addEventListener('click', function (_event) {
|
|
8003
|
+
return handleFieldInput();
|
|
8004
|
+
}, false);
|
|
8005
|
+
rhs.appendChild(sendButton);
|
|
7677
8006
|
|
|
7678
|
-
|
|
8007
|
+
if (originalMessage) {
|
|
8008
|
+
// Are we editing another message?
|
|
8009
|
+
var cancelButton = rhs.appendChild(widgets.cancelButton(dom));
|
|
8010
|
+
cancelButton.style["float"] = 'left'; // cancelButton.firstChild.style.opacity = '0.3' // moved to buttons
|
|
7679
8011
|
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
8012
|
+
cancelButton.addEventListener('click', function (_event) {
|
|
8013
|
+
return revertEditing(messageEditor);
|
|
8014
|
+
}, false);
|
|
8015
|
+
rhs.appendChild(cancelButton);
|
|
8016
|
+
}
|
|
7684
8017
|
|
|
8018
|
+
var chatDocument = channelObject.dateFolder.leafDocumentFromDate(new Date());
|
|
8019
|
+
var imageDoc;
|
|
8020
|
+
middle.appendChild(_index2.media.cameraButton(dom, _logic.store, getImageDoc, tookPicture));
|
|
8021
|
+
pad.recordParticipation(channelObject.channel, channelObject.channel.doc()); // participation =
|
|
8022
|
+
} // turn on inpuut
|
|
8023
|
+
// Body of renderMessageEditor
|
|
7685
8024
|
|
|
7686
|
-
var td3 = dom.createElement('td');
|
|
7687
|
-
messageRow.appendChild(td3);
|
|
7688
|
-
var toolsButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_243787.svg', '...');
|
|
7689
|
-
td3.appendChild(toolsButton);
|
|
7690
|
-
toolsButton.addEventListener('click', function (_event) {
|
|
7691
|
-
if (messageRow.toolTR) {
|
|
7692
|
-
// already got a toolbar? Toogle
|
|
7693
|
-
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
7694
|
-
delete messageRow.toolTR;
|
|
7695
|
-
return;
|
|
7696
|
-
}
|
|
7697
8025
|
|
|
7698
|
-
|
|
7699
|
-
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext);
|
|
7700
|
-
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
|
|
8026
|
+
var sortDate, sendIcon;
|
|
7701
8027
|
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
} else {
|
|
7705
|
-
messageRow.parentElement.appendChild(toolsTR);
|
|
7706
|
-
}
|
|
8028
|
+
if (originalMessage) {
|
|
8029
|
+
sortDate = _logic.store.anyValue(originalMessage, ns.dct('created'), null, originalMessage.doc()); // text = store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc())
|
|
7707
8030
|
|
|
7708
|
-
|
|
7709
|
-
|
|
8031
|
+
sendIcon = _iconBase.icons.iconBase + 'noun_1180158.svg'; // Green check
|
|
8032
|
+
// cancelIcon = icons.iconBase + 'noun_1180156.svg' // Black cross
|
|
8033
|
+
} else {
|
|
8034
|
+
sendIcon = _iconBase.icons.iconBase + 'noun_383448.svg';
|
|
8035
|
+
sortDate = '9999-01-01T00:00:00Z'; // ISO format for field sort
|
|
8036
|
+
// text = ''
|
|
8037
|
+
}
|
|
7710
8038
|
|
|
7711
|
-
|
|
7712
|
-
|
|
8039
|
+
var messageEditor = dom.createElement('tr');
|
|
8040
|
+
var lhs = dom.createElement('td');
|
|
8041
|
+
var middle = dom.createElement('td');
|
|
8042
|
+
var rhs = dom.createElement('td');
|
|
8043
|
+
messageEditor.appendChild(lhs);
|
|
8044
|
+
messageEditor.appendChild(middle);
|
|
8045
|
+
messageEditor.appendChild(rhs);
|
|
8046
|
+
messageEditor.AJAR_date = sortDate; // messageEditor.appendChild(dom.createElement('br'))
|
|
7713
8047
|
|
|
7714
|
-
|
|
8048
|
+
var field, sendButton;
|
|
8049
|
+
var context = {
|
|
8050
|
+
div: middle,
|
|
8051
|
+
dom: dom
|
|
8052
|
+
};
|
|
8053
|
+
|
|
8054
|
+
_index.authn.logIn(context).then(function (context) {
|
|
8055
|
+
// me = context.me
|
|
8056
|
+
turnOnInput();
|
|
8057
|
+
Object.assign(context, userContext);
|
|
8058
|
+
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {// console.log('Bookmark file: ' + context.bookmarkDocument)
|
|
8059
|
+
});
|
|
7715
8060
|
});
|
|
7716
|
-
|
|
7717
|
-
|
|
8061
|
+
|
|
8062
|
+
return messageEditor;
|
|
8063
|
+
} // renderMessageEditor
|
|
7718
8064
|
//# sourceMappingURL=message.js.map
|
|
7719
8065
|
|
|
7720
8066
|
/***/ }),
|
|
@@ -7746,28 +8092,28 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
|
|
|
7746
8092
|
|
|
7747
8093
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
7748
8094
|
|
|
8095
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
8096
|
+
|
|
7749
8097
|
var _index = __webpack_require__(/*! ../authn/index */ "./lib/authn/index.js");
|
|
7750
8098
|
|
|
7751
8099
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
7752
8100
|
|
|
7753
8101
|
var _logic = __webpack_require__(/*! ../logic */ "./lib/logic.js");
|
|
7754
8102
|
|
|
7755
|
-
var _index2 = __webpack_require__(/*! ../media/index */ "./lib/media/index.js");
|
|
7756
|
-
|
|
7757
8103
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
7758
8104
|
|
|
7759
|
-
var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./lib/pad.js"));
|
|
7760
|
-
|
|
7761
8105
|
var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
7762
8106
|
|
|
7763
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
7764
|
-
|
|
7765
8107
|
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
7766
8108
|
|
|
7767
8109
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
7768
8110
|
|
|
7769
8111
|
var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./lib/chat/bookmarks.js");
|
|
7770
8112
|
|
|
8113
|
+
var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js");
|
|
8114
|
+
|
|
8115
|
+
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
8116
|
+
|
|
7771
8117
|
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); }
|
|
7772
8118
|
|
|
7773
8119
|
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; }
|
|
@@ -7781,52 +8127,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
7781
8127
|
* If you made it originally: edit, delete, attach
|
|
7782
8128
|
* @packageDocumentation
|
|
7783
8129
|
*/
|
|
7784
|
-
|
|
7785
|
-
|
|
8130
|
+
// import { media } from '../media/index'
|
|
8131
|
+
// import * as pad from '../pad'
|
|
7786
8132
|
// pull in first avoid cross-refs
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
pad: pad,
|
|
7793
|
-
rdf: rdf,
|
|
7794
|
-
store: _logic.store,
|
|
7795
|
-
style: style,
|
|
7796
|
-
utils: utils,
|
|
7797
|
-
widgets: widgets
|
|
7798
|
-
};
|
|
7799
|
-
var dom = window.document;
|
|
7800
|
-
var kb = _logic.store; // const label = UI.utils.label
|
|
7801
|
-
// THE UNUSED ICONS are here as reminders for possible future functionality
|
|
8133
|
+
// import * as style from '../style'
|
|
8134
|
+
// import { infiniteMessageArea } from './infinite.js'
|
|
8135
|
+
// import { renderMessage, creatorAndDate } from './message'
|
|
8136
|
+
// import * as debug from '../debug'
|
|
8137
|
+
var dom = window.document; // THE UNUSED ICONS are here as reminders for possible future functionality
|
|
7802
8138
|
// const BOOKMARK_ICON = 'noun_45961.svg'
|
|
7803
8139
|
// const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites
|
|
7804
8140
|
// const MENU_ICON = 'noun_897914.svg'
|
|
7805
8141
|
// const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message
|
|
7806
8142
|
// const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI
|
|
7807
|
-
|
|
8143
|
+
|
|
8144
|
+
var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
7808
8145
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
7809
8146
|
|
|
7810
8147
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
7811
|
-
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
7812
|
-
// @@@@ use the one in rdflib.js when it is avaiable and delete this
|
|
7813
|
-
|
|
7814
|
-
function updatePromise(del, ins) {
|
|
7815
|
-
return new Promise(function (resolve, reject) {
|
|
7816
|
-
kb.updater.update(del, ins, function (uri, ok, errorBody) {
|
|
7817
|
-
if (!ok) {
|
|
7818
|
-
reject(new Error(errorBody));
|
|
7819
|
-
} else {
|
|
7820
|
-
resolve();
|
|
7821
|
-
}
|
|
7822
|
-
}); // callback
|
|
7823
|
-
}); // promise
|
|
7824
|
-
}
|
|
8148
|
+
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
7825
8149
|
/**
|
|
7826
8150
|
* Emoji in Unicode
|
|
7827
8151
|
*/
|
|
7828
8152
|
|
|
7829
|
-
|
|
7830
8153
|
var emoji = {};
|
|
7831
8154
|
emoji[ns.schema('AgreeAction')] = '👍';
|
|
7832
8155
|
emoji[ns.schema('DisagreeAction')] = '👎';
|
|
@@ -7837,9 +8160,11 @@ emoji[ns.schema('LikeAction')] = '❤️';
|
|
|
7837
8160
|
*/
|
|
7838
8161
|
|
|
7839
8162
|
function sentimentStrip(target, doc) {
|
|
7840
|
-
|
|
8163
|
+
// alain seems not used
|
|
8164
|
+
var latest = (0, _chatLogic.mostRecentVersion)(target);
|
|
8165
|
+
var actions = _logic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _logic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
7841
8166
|
var sentiments = actions.map(function (a) {
|
|
7842
|
-
return
|
|
8167
|
+
return _logic.store.any(a, ns.rdf('type'), null, doc);
|
|
7843
8168
|
});
|
|
7844
8169
|
sentiments.sort();
|
|
7845
8170
|
var strings = sentiments.map(function (x) {
|
|
@@ -7860,9 +8185,9 @@ function sentimentStripLinked(target, doc) {
|
|
|
7860
8185
|
|
|
7861
8186
|
function refresh() {
|
|
7862
8187
|
strip.innerHTML = '';
|
|
7863
|
-
var actions =
|
|
8188
|
+
var actions = (0, _chatLogic.mostRecentVersion)(target).uri !== ns.schema('dateDeleted').uri ? _logic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
7864
8189
|
var sentiments = actions.map(function (a) {
|
|
7865
|
-
return [
|
|
8190
|
+
return [_logic.store.any(a, ns.rdf('type'), null, doc), _logic.store.any(a, ns.schema('agent'), null, doc)];
|
|
7866
8191
|
});
|
|
7867
8192
|
sentiments.sort();
|
|
7868
8193
|
sentiments.forEach(function (ss) {
|
|
@@ -7893,60 +8218,142 @@ function sentimentStripLinked(target, doc) {
|
|
|
7893
8218
|
*/
|
|
7894
8219
|
|
|
7895
8220
|
|
|
7896
|
-
function messageToolbar(message, messageRow, userContext) {
|
|
7897
|
-
|
|
8221
|
+
function messageToolbar(message, messageRow, userContext, channelObject) {
|
|
8222
|
+
function deleteMessage() {
|
|
8223
|
+
return _deleteMessage.apply(this, arguments);
|
|
8224
|
+
}
|
|
7898
8225
|
|
|
7899
|
-
function
|
|
7900
|
-
|
|
8226
|
+
function _deleteMessage() {
|
|
8227
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
8228
|
+
var author, msg, area;
|
|
8229
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
8230
|
+
while (1) {
|
|
8231
|
+
switch (_context2.prev = _context2.next) {
|
|
8232
|
+
case 0:
|
|
8233
|
+
author = _logic.store.any(message, ns.foaf('maker'));
|
|
8234
|
+
|
|
8235
|
+
if (me) {
|
|
8236
|
+
_context2.next = 5;
|
|
8237
|
+
break;
|
|
8238
|
+
}
|
|
8239
|
+
|
|
8240
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
8241
|
+
_context2.next = 22;
|
|
8242
|
+
break;
|
|
8243
|
+
|
|
8244
|
+
case 5:
|
|
8245
|
+
if (!me.sameTerm(author)) {
|
|
8246
|
+
_context2.next = 21;
|
|
8247
|
+
break;
|
|
8248
|
+
}
|
|
8249
|
+
|
|
8250
|
+
_context2.prev = 6;
|
|
8251
|
+
_context2.next = 9;
|
|
8252
|
+
return channelObject.deleteMessage(message);
|
|
8253
|
+
|
|
8254
|
+
case 9:
|
|
8255
|
+
_context2.next = 18;
|
|
8256
|
+
break;
|
|
8257
|
+
|
|
8258
|
+
case 11:
|
|
8259
|
+
_context2.prev = 11;
|
|
8260
|
+
_context2.t0 = _context2["catch"](6);
|
|
8261
|
+
msg = 'Error deleting messaage ' + _context2.t0;
|
|
8262
|
+
debug.warn(msg);
|
|
8263
|
+
alert(msg);
|
|
8264
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
8265
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
8266
|
+
|
|
8267
|
+
case 18:
|
|
8268
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
8269
|
+
_context2.next = 22;
|
|
8270
|
+
break;
|
|
8271
|
+
|
|
8272
|
+
case 21:
|
|
8273
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
8274
|
+
|
|
8275
|
+
case 22:
|
|
8276
|
+
closeToolbar();
|
|
8277
|
+
|
|
8278
|
+
case 23:
|
|
8279
|
+
case "end":
|
|
8280
|
+
return _context2.stop();
|
|
8281
|
+
}
|
|
8282
|
+
}
|
|
8283
|
+
}, _callee2, null, [[6, 11]]);
|
|
8284
|
+
}));
|
|
8285
|
+
return _deleteMessage.apply(this, arguments);
|
|
7901
8286
|
}
|
|
7902
8287
|
|
|
7903
|
-
function
|
|
7904
|
-
return
|
|
7905
|
-
} //
|
|
8288
|
+
function editMessage(_x) {
|
|
8289
|
+
return _editMessage.apply(this, arguments);
|
|
8290
|
+
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
7906
8291
|
|
|
7907
8292
|
|
|
7908
|
-
function
|
|
7909
|
-
|
|
8293
|
+
function _editMessage() {
|
|
8294
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
7910
8295
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
7911
8296
|
while (1) {
|
|
7912
8297
|
switch (_context3.prev = _context3.next) {
|
|
7913
8298
|
case 0:
|
|
7914
|
-
|
|
7915
|
-
|
|
8299
|
+
if (me.value === _logic.store.any(message, ns.foaf('maker')).value) {
|
|
8300
|
+
closeToolbar(); // edit is a one-off action
|
|
7916
8301
|
|
|
7917
|
-
|
|
8302
|
+
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
8303
|
+
}
|
|
8304
|
+
|
|
8305
|
+
case 1:
|
|
7918
8306
|
case "end":
|
|
7919
8307
|
return _context3.stop();
|
|
7920
8308
|
}
|
|
7921
8309
|
}
|
|
7922
8310
|
}, _callee3);
|
|
7923
8311
|
}));
|
|
7924
|
-
return
|
|
8312
|
+
return _editMessage.apply(this, arguments);
|
|
7925
8313
|
}
|
|
7926
8314
|
|
|
7927
|
-
var
|
|
8315
|
+
var div = dom.createElement('div'); // is message deleted ?
|
|
7928
8316
|
|
|
7929
|
-
if (
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
8317
|
+
if ((0, _chatLogic.mostRecentVersion)(message).value === ns.schema('dateDeleted').value) return div;
|
|
8318
|
+
|
|
8319
|
+
function closeToolbar() {
|
|
8320
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
8321
|
+
}
|
|
8322
|
+
|
|
8323
|
+
function deleteThingThen(_x2) {
|
|
8324
|
+
return _deleteThingThen.apply(this, arguments);
|
|
8325
|
+
} // Things only the original author can do
|
|
8326
|
+
|
|
8327
|
+
|
|
8328
|
+
function _deleteThingThen() {
|
|
8329
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(x) {
|
|
8330
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
7933
8331
|
while (1) {
|
|
7934
|
-
switch (
|
|
8332
|
+
switch (_context4.prev = _context4.next) {
|
|
7935
8333
|
case 0:
|
|
7936
|
-
|
|
7937
|
-
return
|
|
8334
|
+
_context4.next = 2;
|
|
8335
|
+
return _logic.store.updater.update(_logic.store.connectedStatements(x), []);
|
|
7938
8336
|
|
|
7939
8337
|
case 2:
|
|
7940
|
-
closeToolbar();
|
|
7941
|
-
|
|
7942
|
-
case 3:
|
|
7943
8338
|
case "end":
|
|
7944
|
-
return
|
|
8339
|
+
return _context4.stop();
|
|
7945
8340
|
}
|
|
7946
8341
|
}
|
|
7947
|
-
},
|
|
7948
|
-
}))
|
|
7949
|
-
|
|
8342
|
+
}, _callee4);
|
|
8343
|
+
}));
|
|
8344
|
+
return _deleteThingThen.apply(this, arguments);
|
|
8345
|
+
}
|
|
8346
|
+
|
|
8347
|
+
var me = _index.authn.currentUser(); // If already logged on
|
|
8348
|
+
|
|
8349
|
+
|
|
8350
|
+
if (me && _logic.store.holds(message, ns.foaf('maker'), me)) {
|
|
8351
|
+
// button to delete the message
|
|
8352
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage)); // button to edit the message
|
|
8353
|
+
|
|
8354
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
8355
|
+
return editMessage(messageRow);
|
|
8356
|
+
}));
|
|
7950
8357
|
} // if mine
|
|
7951
8358
|
// Things anyone can do if they have a bookmark list async
|
|
7952
8359
|
|
|
@@ -7977,39 +8384,39 @@ function messageToolbar(message, messageRow, userContext) {
|
|
|
7977
8384
|
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
7978
8385
|
}
|
|
7979
8386
|
|
|
7980
|
-
var button =
|
|
7981
|
-
var
|
|
8387
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
8388
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_event) {
|
|
7982
8389
|
var insertMe, dirty, i, a;
|
|
7983
|
-
return _regenerator["default"].wrap(function
|
|
8390
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
7984
8391
|
while (1) {
|
|
7985
|
-
switch (
|
|
8392
|
+
switch (_context.prev = _context.next) {
|
|
7986
8393
|
case 0:
|
|
7987
8394
|
if (!action) {
|
|
7988
|
-
|
|
8395
|
+
_context.next = 7;
|
|
7989
8396
|
break;
|
|
7990
8397
|
}
|
|
7991
8398
|
|
|
7992
|
-
|
|
8399
|
+
_context.next = 3;
|
|
7993
8400
|
return deleteThingThen(action);
|
|
7994
8401
|
|
|
7995
8402
|
case 3:
|
|
7996
8403
|
action = null;
|
|
7997
8404
|
setColor();
|
|
7998
|
-
|
|
8405
|
+
_context.next = 25;
|
|
7999
8406
|
break;
|
|
8000
8407
|
|
|
8001
8408
|
case 7:
|
|
8002
8409
|
// no action
|
|
8003
|
-
action =
|
|
8004
|
-
insertMe = [
|
|
8005
|
-
|
|
8006
|
-
return
|
|
8410
|
+
action = widgets.newThing(doc);
|
|
8411
|
+
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)];
|
|
8412
|
+
_context.next = 11;
|
|
8413
|
+
return _logic.store.updater.update([], insertMe);
|
|
8007
8414
|
|
|
8008
8415
|
case 11:
|
|
8009
8416
|
setColor();
|
|
8010
8417
|
|
|
8011
8418
|
if (!mutuallyExclusive) {
|
|
8012
|
-
|
|
8419
|
+
_context.next = 25;
|
|
8013
8420
|
break;
|
|
8014
8421
|
}
|
|
8015
8422
|
|
|
@@ -8019,18 +8426,18 @@ function messageToolbar(message, messageRow, userContext) {
|
|
|
8019
8426
|
|
|
8020
8427
|
case 15:
|
|
8021
8428
|
if (!(i < mutuallyExclusive.length)) {
|
|
8022
|
-
|
|
8429
|
+
_context.next = 24;
|
|
8023
8430
|
break;
|
|
8024
8431
|
}
|
|
8025
8432
|
|
|
8026
8433
|
a = existingAction(mutuallyExclusive[i]);
|
|
8027
8434
|
|
|
8028
8435
|
if (!a) {
|
|
8029
|
-
|
|
8436
|
+
_context.next = 21;
|
|
8030
8437
|
break;
|
|
8031
8438
|
}
|
|
8032
8439
|
|
|
8033
|
-
|
|
8440
|
+
_context.next = 20;
|
|
8034
8441
|
return deleteThingThen(a);
|
|
8035
8442
|
|
|
8036
8443
|
case 20:
|
|
@@ -8039,34 +8446,35 @@ function messageToolbar(message, messageRow, userContext) {
|
|
|
8039
8446
|
|
|
8040
8447
|
case 21:
|
|
8041
8448
|
i++;
|
|
8042
|
-
|
|
8449
|
+
_context.next = 15;
|
|
8043
8450
|
break;
|
|
8044
8451
|
|
|
8045
8452
|
case 24:
|
|
8046
8453
|
if (dirty) {
|
|
8047
|
-
//
|
|
8048
|
-
|
|
8454
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
8455
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
8049
8456
|
}
|
|
8050
8457
|
|
|
8051
8458
|
case 25:
|
|
8052
8459
|
case "end":
|
|
8053
|
-
return
|
|
8460
|
+
return _context.stop();
|
|
8054
8461
|
}
|
|
8055
8462
|
}
|
|
8056
|
-
},
|
|
8463
|
+
}, _callee);
|
|
8057
8464
|
}));
|
|
8058
8465
|
|
|
8059
|
-
return function (
|
|
8060
|
-
return
|
|
8466
|
+
return function (_x3) {
|
|
8467
|
+
return _ref.apply(this, arguments);
|
|
8061
8468
|
};
|
|
8062
8469
|
}());
|
|
8063
8470
|
|
|
8064
8471
|
function existingAction(actionClass) {
|
|
8065
|
-
var actions =
|
|
8066
|
-
return
|
|
8472
|
+
var actions = _logic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
8473
|
+
return _logic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
8067
8474
|
}).filter(function (x) {
|
|
8068
|
-
return
|
|
8475
|
+
return _logic.store.holds(x, ns.schema('target'), target, doc);
|
|
8069
8476
|
});
|
|
8477
|
+
|
|
8070
8478
|
return actions.length ? actions[0] : null;
|
|
8071
8479
|
}
|
|
8072
8480
|
|
|
@@ -8084,23 +8492,23 @@ function messageToolbar(message, messageRow, userContext) {
|
|
|
8084
8492
|
// https://schema.org/AgreeAction
|
|
8085
8493
|
|
|
8086
8494
|
|
|
8087
|
-
me =
|
|
8495
|
+
me = _index.authn.currentUser(); // If already logged on
|
|
8496
|
+
// debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
|
|
8088
8497
|
|
|
8089
|
-
if (me) {
|
|
8090
|
-
// Things you mnust be logged in for
|
|
8498
|
+
if (me && (0, _chatLogic.mostRecentVersion)(message).value !== ns.schema('dateDeleted').value) {
|
|
8091
8499
|
var context1 = {
|
|
8092
8500
|
me: me,
|
|
8093
8501
|
dom: dom,
|
|
8094
8502
|
div: div
|
|
8095
8503
|
};
|
|
8096
|
-
div.appendChild(sentimentButton(context1, message, // @@ TODO use
|
|
8097
|
-
|
|
8504
|
+
div.appendChild(sentimentButton(context1, message, // @@ TODO use widgets.sentimentButton
|
|
8505
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')])); // Thumbs down
|
|
8098
8506
|
|
|
8099
|
-
div.appendChild(sentimentButton(context1, message,
|
|
8507
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
8100
8508
|
} // X button to remove the tool UI itself
|
|
8101
8509
|
|
|
8102
8510
|
|
|
8103
|
-
var cancelButton = div.appendChild(
|
|
8511
|
+
var cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
8104
8512
|
cancelButton.style["float"] = 'right';
|
|
8105
8513
|
cancelButton.firstChild.style.opacity = '0.3';
|
|
8106
8514
|
cancelButton.addEventListener('click', closeToolbar);
|
|
@@ -15733,10 +16141,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15733
16141
|
});
|
|
15734
16142
|
exports["default"] = void 0;
|
|
15735
16143
|
var _default = {
|
|
15736
|
-
buildTime: '2022-01-
|
|
15737
|
-
commit: '
|
|
16144
|
+
buildTime: '2022-01-28T22:55:43Z',
|
|
16145
|
+
commit: '9d83fb1702a1835b5d82fb97bc51b3cb98285373',
|
|
15738
16146
|
npmInfo: {
|
|
15739
|
-
'solid-ui': '2.4.
|
|
16147
|
+
'solid-ui': '2.4.16',
|
|
15740
16148
|
npm: '6.14.15',
|
|
15741
16149
|
ares: '1.18.1',
|
|
15742
16150
|
brotli: '1.0.9',
|
|
@@ -16455,7 +16863,14 @@ function button(dom, iconURI, text, handler) {
|
|
|
16455
16863
|
|
|
16456
16864
|
|
|
16457
16865
|
function cancelButton(dom, handler) {
|
|
16458
|
-
|
|
16866
|
+
var b = button(dom, cancelIconURI, 'Cancel', handler);
|
|
16867
|
+
|
|
16868
|
+
if (b.firstChild) {
|
|
16869
|
+
// sigh for tsc
|
|
16870
|
+
b.firstChild.style.opacity = '0.3'; // Black X is too harsh: current language is grey X
|
|
16871
|
+
}
|
|
16872
|
+
|
|
16873
|
+
return b;
|
|
16459
16874
|
}
|
|
16460
16875
|
/* Make a continue button
|
|
16461
16876
|
*
|