solid-ui 2.4.27-5b3471ff → 2.4.27-62cefbe0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/670.solid-ui.min.js +1 -0
- package/dist/805.solid-ui.min.js +3 -0
- package/dist/805.solid-ui.min.js.LICENSE.txt +58 -0
- package/dist/805.solid-ui.min.js.map +1 -0
- package/dist/_2b19.solid-ui.js +14 -0
- package/dist/_2b19.solid-ui.js.map +1 -0
- package/dist/index.html +1 -9
- package/dist/{main.js → solid-ui.js} +4940 -20458
- package/dist/solid-ui.js.map +1 -0
- package/dist/solid-ui.min.js +3 -0
- package/dist/solid-ui.min.js.LICENSE.txt +50 -0
- package/dist/solid-ui.min.js.map +1 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +12134 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -0
- package/lib/acl/access-controller.d.ts +2 -3
- package/lib/acl/access-controller.d.ts.map +1 -1
- package/lib/acl/access-controller.js +17 -15
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.d.ts.map +1 -1
- package/lib/acl/access-groups.js +78 -8
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.d.ts.map +1 -1
- package/lib/acl/acl-control.js +10 -11
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -1
- package/lib/acl/acl.js +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.d.ts.map +1 -1
- package/lib/acl/add-agent-buttons.js +4 -3
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +250 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +129 -126
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +630 -423
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +290 -160
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +463 -277
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +168 -145
- package/lib/chat/thread.js.map +1 -1
- package/lib/footer/index.d.ts.map +1 -1
- package/lib/footer/index.js +5 -1
- package/lib/footer/index.js.map +1 -1
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +46 -20
- package/lib/header/index.js.map +1 -1
- package/lib/log.js +5 -5
- package/lib/log.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +63 -38
- package/lib/login/login.js.map +1 -1
- package/lib/pad.js +4 -1
- package/lib/pad.js.map +1 -1
- package/lib/participation.js +2 -1
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/style.js +60 -2
- package/lib/style.js.map +1 -1
- package/lib/utils/headerFooterHelpers.d.ts +0 -4
- package/lib/utils/headerFooterHelpers.d.ts.map +1 -1
- package/lib/utils/headerFooterHelpers.js +1 -26
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/versionInfo.js +5 -5
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +43 -51
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +8 -3
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +5 -0
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms.js +12 -5
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/peoplePicker.js +11 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/package.json +12 -11
- package/dist/main.js.map +0 -1
- package/lib/acl/styles.d.ts +0 -90
- package/lib/acl/styles.d.ts.map +0 -1
- package/lib/acl/styles.js +0 -98
- package/lib/acl/styles.js.map +0 -1
- package/lib/footer/styleMap.d.ts +0 -8
- package/lib/footer/styleMap.d.ts.map +0 -1
- package/lib/footer/styleMap.js +0 -15
- package/lib/footer/styleMap.js.map +0 -1
- package/lib/header/styleMap.d.ts +0 -117
- package/lib/header/styleMap.d.ts.map +0 -1
- package/lib/header/styleMap.js +0 -139
- package/lib/header/styleMap.js.map +0 -1
- package/lib/jss/index.d.ts +0 -20
- package/lib/jss/index.d.ts.map +0 -1
- package/lib/jss/index.js +0 -47
- package/lib/jss/index.js.map +0 -1
package/lib/chat/message.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
12
12
|
exports.renderMessageRow = renderMessageRow;
|
|
13
13
|
exports.switchToEditor = switchToEditor;
|
|
14
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
17
|
var _infinite = require("./infinite");
|
|
17
18
|
var _messageTools = require("./messageTools");
|
|
@@ -29,9 +30,14 @@ var utils = _interopRequireWildcard(require("../utils"));
|
|
|
29
30
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
30
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
-
function
|
|
33
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
33
36
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
34
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
37
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /** UI code for individual messages: display them, edit them
|
|
38
|
+
*
|
|
39
|
+
* @packageDocumentation
|
|
40
|
+
*/ /* global $rdf */
|
|
35
41
|
var dom = window.document;
|
|
36
42
|
var messageBodyStyle = style.messageBodyStyle;
|
|
37
43
|
var label = utils.label;
|
|
@@ -108,122 +114,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
108
114
|
/**
|
|
109
115
|
* Renders a chat message, read-only mode
|
|
110
116
|
*/
|
|
111
|
-
function renderMessageRow(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
117
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
118
|
+
return _renderMessageRow.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
function _renderMessageRow() {
|
|
121
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
122
|
+
var colorizeByAuthor, creator, date, latestVersion, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
|
|
123
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
124
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
getBgColor = function _getBgColor(fresh) {
|
|
127
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
128
|
+
};
|
|
129
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
130
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
131
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
132
|
+
_context10.next = 6;
|
|
133
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
134
|
+
case 6:
|
|
135
|
+
latestVersion = _context10.sent;
|
|
136
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
137
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
138
|
+
_context10.next = 10;
|
|
139
|
+
return (0, _chatLogic.allVersions)(message);
|
|
140
|
+
case 10:
|
|
141
|
+
versions = _context10.sent;
|
|
142
|
+
if (versions.length > 1) {
|
|
143
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
144
|
+
}
|
|
145
|
+
// be tolerant in accepting replies on any version of a message
|
|
146
|
+
replies = versions.map(function (version) {
|
|
147
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
148
|
+
}).flat();
|
|
149
|
+
thread = null;
|
|
150
|
+
straightReplies = [];
|
|
151
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
152
|
+
try {
|
|
153
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
154
|
+
reply = _step2.value;
|
|
155
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
156
|
+
thread = reply;
|
|
157
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
158
|
+
} else {
|
|
159
|
+
straightReplies.push(reply);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
} catch (err) {
|
|
163
|
+
_iterator2.e(err);
|
|
164
|
+
} finally {
|
|
165
|
+
_iterator2.f();
|
|
166
|
+
}
|
|
167
|
+
if (straightReplies.length > 1) {
|
|
168
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
169
|
+
}
|
|
170
|
+
_context10.next = 20;
|
|
171
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
172
|
+
case 20:
|
|
173
|
+
originalMessage = _context10.sent;
|
|
174
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
175
|
+
// @@@ kludge!
|
|
176
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
177
|
+
messageRow = dom.createElement('tr');
|
|
178
|
+
messageRow.AJAR_date = sortDate.value;
|
|
179
|
+
messageRow.AJAR_subject = message;
|
|
180
|
+
td1 = dom.createElement('td');
|
|
181
|
+
messageRow.appendChild(td1);
|
|
182
|
+
if (!options.authorDateOnLeft) {
|
|
183
|
+
img = dom.createElement('img');
|
|
184
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
185
|
+
widgets.setImage(img, creator);
|
|
186
|
+
td1.appendChild(img);
|
|
187
|
+
} else {
|
|
188
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
189
|
+
}
|
|
190
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
191
|
+
if (edited) {
|
|
192
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
193
|
+
}
|
|
175
194
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
195
|
+
// Render the content ot the message itself
|
|
196
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
197
|
+
if (!options.authorDateOnLeft) {
|
|
198
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
199
|
+
// widgets.shortDate(dateString)
|
|
200
|
+
message);
|
|
201
|
+
}
|
|
202
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
203
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
204
|
+
para = null;
|
|
205
|
+
if (isURI) {
|
|
206
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
207
|
+
if (isImage && options.expandImagesInline) {
|
|
208
|
+
_img = elementForImageURI(text, options);
|
|
209
|
+
td2.appendChild(_img);
|
|
210
|
+
} else {
|
|
211
|
+
// Link but not Image
|
|
212
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
213
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
214
|
+
anc.href = text;
|
|
215
|
+
para.textContent = text;
|
|
216
|
+
td2.appendChild(anc);
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
// text
|
|
220
|
+
para = dom.createElement('p');
|
|
221
|
+
td2.appendChild(para);
|
|
222
|
+
para.textContent = text;
|
|
223
|
+
}
|
|
224
|
+
if (para) {
|
|
225
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
226
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
227
|
+
}
|
|
228
|
+
_context10.next = 40;
|
|
229
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
230
|
+
case 40:
|
|
231
|
+
strip = _context10.sent;
|
|
232
|
+
if (strip.children.length) {
|
|
233
|
+
td2.appendChild(dom.createElement('br'));
|
|
234
|
+
td2.appendChild(strip);
|
|
235
|
+
}
|
|
182
236
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
237
|
+
// Message tool bar button
|
|
238
|
+
td3 = dom.createElement('td');
|
|
239
|
+
messageRow.appendChild(td3);
|
|
240
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
241
|
+
td3.appendChild(toolsButton);
|
|
242
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
243
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
244
|
+
var toolsTR, tools, toolsTD;
|
|
245
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
246
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
if (!messageRow.toolTR) {
|
|
249
|
+
_context9.next = 4;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
// already got a toolbar? Toogle
|
|
253
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
254
|
+
delete messageRow.toolTR;
|
|
255
|
+
return _context9.abrupt("return");
|
|
256
|
+
case 4:
|
|
257
|
+
toolsTR = dom.createElement('tr');
|
|
258
|
+
_context9.next = 7;
|
|
259
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
260
|
+
chatOptions: options
|
|
261
|
+
}), channelObject);
|
|
262
|
+
case 7:
|
|
263
|
+
tools = _context9.sent;
|
|
264
|
+
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
|
|
265
|
+
if (messageRow.nextSibling) {
|
|
266
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
267
|
+
} else {
|
|
268
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
269
|
+
}
|
|
270
|
+
messageRow.toolTR = toolsTR;
|
|
271
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
272
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
273
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
274
|
+
toolsTD.appendChild(tools);
|
|
275
|
+
case 15:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context9.stop();
|
|
278
|
+
}
|
|
279
|
+
}, _callee8);
|
|
280
|
+
}));
|
|
281
|
+
return function (_x20) {
|
|
282
|
+
return _ref4.apply(this, arguments);
|
|
283
|
+
};
|
|
284
|
+
}());
|
|
285
|
+
if (thread && options.showThread) {
|
|
286
|
+
debug.log(' message has thread ' + thread);
|
|
287
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
288
|
+
// right arrow .. @@ think of stg better
|
|
289
|
+
'see thread', function (_e) {
|
|
290
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
291
|
+
options.showThread(thread, options);
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
return _context10.abrupt("return", messageRow);
|
|
295
|
+
case 49:
|
|
296
|
+
case "end":
|
|
297
|
+
return _context10.stop();
|
|
298
|
+
}
|
|
299
|
+
}, _callee9);
|
|
300
|
+
}));
|
|
301
|
+
return _renderMessageRow.apply(this, arguments);
|
|
210
302
|
}
|
|
211
|
-
function switchToEditor(
|
|
212
|
-
|
|
213
|
-
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
214
|
-
messageTable.insertBefore(editRow, messageRow);
|
|
215
|
-
editRow.originalRow = messageRow;
|
|
216
|
-
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
303
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
304
|
+
return _switchToEditor.apply(this, arguments);
|
|
217
305
|
}
|
|
218
306
|
/* Control for a new message -- or editing an old message ***************
|
|
219
307
|
*
|
|
220
308
|
*/
|
|
309
|
+
function _switchToEditor() {
|
|
310
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
311
|
+
var messageTable, editRow;
|
|
312
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
313
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
314
|
+
case 0:
|
|
315
|
+
messageTable = messageRow.parentNode;
|
|
316
|
+
_context11.t0 = renderMessageEditor;
|
|
317
|
+
_context11.t1 = channelObject;
|
|
318
|
+
_context11.t2 = messageTable;
|
|
319
|
+
_context11.t3 = userContext;
|
|
320
|
+
_context11.t4 = channelObject.options;
|
|
321
|
+
_context11.next = 8;
|
|
322
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
323
|
+
case 8:
|
|
324
|
+
_context11.t5 = _context11.sent;
|
|
325
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
326
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
327
|
+
editRow.originalRow = messageRow;
|
|
328
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
329
|
+
case 13:
|
|
330
|
+
case "end":
|
|
331
|
+
return _context11.stop();
|
|
332
|
+
}
|
|
333
|
+
}, _callee10);
|
|
334
|
+
}));
|
|
335
|
+
return _switchToEditor.apply(this, arguments);
|
|
336
|
+
}
|
|
221
337
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
222
338
|
function revertEditing(messageEditor) {
|
|
223
339
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
224
340
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
225
341
|
}
|
|
226
|
-
function handleFieldInput(
|
|
342
|
+
function handleFieldInput(_x10) {
|
|
227
343
|
return _handleFieldInput.apply(this, arguments);
|
|
228
344
|
}
|
|
229
345
|
function _handleFieldInput() {
|
|
@@ -241,72 +357,86 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
241
357
|
}));
|
|
242
358
|
return _handleFieldInput.apply(this, arguments);
|
|
243
359
|
}
|
|
244
|
-
function sendMessage(
|
|
360
|
+
function sendMessage(_x11, _x12) {
|
|
245
361
|
return _sendMessage.apply(this, arguments);
|
|
246
362
|
} // sendMessage
|
|
247
363
|
// DRAG AND DROP
|
|
248
364
|
function _sendMessage() {
|
|
249
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
250
|
-
var sendComplete, message, statusArea;
|
|
251
|
-
return _regenerator["default"].wrap(function
|
|
252
|
-
while (1) switch (
|
|
365
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
366
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
367
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
368
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
253
369
|
case 0:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
370
|
+
_sendComplete = function _sendComplete3() {
|
|
371
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
372
|
+
var oldRow;
|
|
373
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
374
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
375
|
+
case 0:
|
|
376
|
+
_context7.next = 2;
|
|
377
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
378
|
+
case 2:
|
|
379
|
+
// not green
|
|
258
380
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
381
|
+
if (originalMessage) {
|
|
382
|
+
// editing another message
|
|
383
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
384
|
+
if (oldRow.parentNode) {
|
|
385
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
386
|
+
} else {
|
|
387
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
388
|
+
oldRow.style.backgroundColor = '#fee';
|
|
389
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
390
|
+
}
|
|
270
391
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
392
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
393
|
+
} else {
|
|
394
|
+
if (fromMainField) {
|
|
395
|
+
field.value = ''; // clear from out for reuse
|
|
396
|
+
field.setAttribute('style', messageBodyStyle);
|
|
397
|
+
field.disabled = false;
|
|
398
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
399
|
+
field.focus(); // Start typing next line immediately
|
|
400
|
+
field.select();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
404
|
+
case 3:
|
|
405
|
+
case "end":
|
|
406
|
+
return _context7.stop();
|
|
407
|
+
}
|
|
408
|
+
}, _callee6);
|
|
409
|
+
}));
|
|
410
|
+
return _sendComplete.apply(this, arguments);
|
|
283
411
|
};
|
|
284
|
-
|
|
285
|
-
|
|
412
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
413
|
+
return _sendComplete.apply(this, arguments);
|
|
414
|
+
}; // const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
286
415
|
if (fromMainField) {
|
|
287
416
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
288
417
|
field.disabled = true;
|
|
289
418
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
293
|
-
case
|
|
294
|
-
message =
|
|
295
|
-
|
|
419
|
+
_context8.prev = 3;
|
|
420
|
+
_context8.next = 6;
|
|
421
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
422
|
+
case 6:
|
|
423
|
+
message = _context8.sent;
|
|
424
|
+
_context8.next = 14;
|
|
296
425
|
break;
|
|
297
|
-
case
|
|
298
|
-
|
|
299
|
-
|
|
426
|
+
case 9:
|
|
427
|
+
_context8.prev = 9;
|
|
428
|
+
_context8.t0 = _context8["catch"](3);
|
|
300
429
|
statusArea = userContext.statusArea || messageEditor;
|
|
301
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
302
|
-
return
|
|
303
|
-
case 13:
|
|
304
|
-
sendComplete(message, text);
|
|
430
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
431
|
+
return _context8.abrupt("return");
|
|
305
432
|
case 14:
|
|
433
|
+
_context8.next = 16;
|
|
434
|
+
return sendComplete(message, text);
|
|
435
|
+
case 16:
|
|
306
436
|
case "end":
|
|
307
|
-
return
|
|
437
|
+
return _context8.stop();
|
|
308
438
|
}
|
|
309
|
-
},
|
|
439
|
+
}, _callee7, null, [[3, 9]]);
|
|
310
440
|
}));
|
|
311
441
|
return _sendMessage.apply(this, arguments);
|
|
312
442
|
}
|
|
@@ -325,7 +455,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
325
455
|
}
|
|
326
456
|
}, _callee);
|
|
327
457
|
}));
|
|
328
|
-
return function (
|
|
458
|
+
return function (_x13, _x14) {
|
|
329
459
|
return _ref.apply(this, arguments);
|
|
330
460
|
};
|
|
331
461
|
}());
|
|
@@ -369,7 +499,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
369
499
|
}
|
|
370
500
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
371
501
|
}));
|
|
372
|
-
return function droppedURIHandler(
|
|
502
|
+
return function droppedURIHandler(_x15) {
|
|
373
503
|
return _ref2.apply(this, arguments);
|
|
374
504
|
};
|
|
375
505
|
}();
|
|
@@ -380,7 +510,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
380
510
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
381
511
|
return imageDoc;
|
|
382
512
|
}
|
|
383
|
-
function tookPicture(
|
|
513
|
+
function tookPicture(_x16) {
|
|
384
514
|
return _tookPicture.apply(this, arguments);
|
|
385
515
|
} // Body of turnOnInput
|
|
386
516
|
function _tookPicture() {
|
|
@@ -457,7 +587,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
457
587
|
}
|
|
458
588
|
}, _callee3);
|
|
459
589
|
}));
|
|
460
|
-
return function (
|
|
590
|
+
return function (_x17) {
|
|
461
591
|
return _ref3.apply(this, arguments);
|
|
462
592
|
};
|
|
463
593
|
}(), false);
|
|
@@ -519,7 +649,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
519
649
|
turnOnInput();
|
|
520
650
|
Object.assign(context, userContext);
|
|
521
651
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
522
|
-
//
|
|
652
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
523
653
|
});
|
|
524
654
|
});
|
|
525
655
|
return messageEditor;
|