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