solid-ui 2.4.15 → 2.4.16-2759465c
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/README.md +6 -11
- package/lib/acl/acl.d.ts.map +1 -1
- package/lib/acl/acl.js +2 -4
- 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 +5 -5
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/chat/bookmarks.js +23 -24
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +338 -0
- package/lib/chat/chatLogic.js.map +1 -0
- package/lib/chat/dateFolder.js +13 -13
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +287 -669
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +444 -74
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +163 -106
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +171 -41
- package/lib/chat/thread.js.map +1 -1
- package/lib/create/create.d.ts.map +1 -1
- package/lib/create/create.js +9 -9
- package/lib/create/create.js.map +1 -1
- package/lib/folders.js +2 -6
- package/lib/folders.js.map +1 -1
- package/lib/footer/index.js +4 -4
- package/lib/footer/index.js.map +1 -1
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +11 -8
- package/lib/header/index.js.map +1 -1
- package/lib/index.d.ts +3 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +27 -37
- package/lib/index.js.map +1 -1
- package/lib/login/login.d.ts +130 -0
- package/lib/login/login.d.ts.map +1 -0
- package/lib/login/login.js +1415 -0
- package/lib/login/login.js.map +1 -0
- package/lib/matrix/matrix.js +2 -2
- package/lib/matrix/matrix.js.map +1 -1
- package/lib/messageArea.js +9 -10
- package/lib/messageArea.js.map +1 -1
- package/lib/pad.js +2 -2
- package/lib/pad.js.map +1 -1
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +61 -33
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +8 -8
- package/lib/preferences.js.map +1 -1
- package/lib/{authn → signup}/config-default.js +0 -0
- package/lib/signup/config-default.js.map +1 -0
- package/lib/{authn → signup}/signup.js +0 -0
- package/lib/signup/signup.js.map +1 -0
- package/lib/table.js +2 -3
- package/lib/table.js.map +1 -1
- package/lib/tabs.js +3 -3
- package/lib/tabs.js.map +1 -1
- package/lib/utils/index.js +6 -6
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/label.js +4 -5
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.js +10 -10
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +7175 -22937
- package/lib/webpack-bundle.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +24 -17
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +2 -2
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js +2 -2
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +2 -2
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.d.ts.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +7 -10
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.d.ts +2 -1
- package/lib/widgets/forms/autocomplete/publicData.d.ts.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +16 -16
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms/basic.d.ts +1 -1
- package/lib/widgets/forms/basic.d.ts.map +1 -1
- package/lib/widgets/forms/basic.js +2 -2
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/comment.d.ts +1 -1
- package/lib/widgets/forms/comment.js +3 -3
- package/lib/widgets/forms/comment.js.map +1 -1
- package/lib/widgets/forms/fieldFunction.js +2 -2
- package/lib/widgets/forms/fieldFunction.js.map +1 -1
- package/lib/widgets/forms/formStyle.js +3 -3
- package/lib/widgets/forms/formStyle.js.map +1 -1
- package/lib/widgets/forms.js +11 -11
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/peoplePicker.js +2 -2
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/package.json +12 -3
- package/lib/authn/authSession.d.ts +0 -4
- package/lib/authn/authSession.d.ts.map +0 -1
- package/lib/authn/authSession.js +0 -25
- package/lib/authn/authSession.js.map +0 -1
- package/lib/authn/authn.d.ts +0 -193
- package/lib/authn/authn.d.ts.map +0 -1
- package/lib/authn/authn.js +0 -2238
- package/lib/authn/authn.js.map +0 -1
- package/lib/authn/config-default.js.map +0 -1
- package/lib/authn/index.d.ts +0 -35
- package/lib/authn/index.d.ts.map +0 -1
- package/lib/authn/index.js +0 -44
- package/lib/authn/index.js.map +0 -1
- package/lib/authn/signup.js.map +0 -1
- package/lib/authn/types.d.ts +0 -25
- package/lib/authn/types.d.ts.map +0 -1
- package/lib/authn/types.js +0 -6
- package/lib/authn/types.js.map +0 -1
- package/lib/logic.d.ts +0 -8
- package/lib/logic.d.ts.map +0 -1
- package/lib/logic.js +0 -79
- package/lib/logic.js.map +0 -1
package/lib/chat/message.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -8,24 +10,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
10
|
exports.creatorAndDate = creatorAndDate;
|
|
9
11
|
exports.creatorAndDateHorizontal = creatorAndDateHorizontal;
|
|
10
12
|
exports.elementForImageURI = elementForImageURI;
|
|
11
|
-
exports.
|
|
13
|
+
exports.renderMessageEditor = renderMessageEditor;
|
|
14
|
+
exports.renderMessageRow = renderMessageRow;
|
|
15
|
+
exports.switchToEditor = switchToEditor;
|
|
16
|
+
|
|
17
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
18
|
+
|
|
19
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
20
|
+
|
|
21
|
+
var _infinite = require("./infinite");
|
|
12
22
|
|
|
13
23
|
var _messageTools = require("./messageTools");
|
|
14
24
|
|
|
15
|
-
var
|
|
25
|
+
var _bookmarks = require("./bookmarks");
|
|
26
|
+
|
|
27
|
+
var _chatLogic = require("./chatLogic");
|
|
28
|
+
|
|
29
|
+
var debug = _interopRequireWildcard(require("../debug"));
|
|
16
30
|
|
|
17
31
|
var _iconBase = require("../iconBase");
|
|
18
32
|
|
|
19
|
-
var
|
|
33
|
+
var _solidLogic = require("solid-logic");
|
|
20
34
|
|
|
21
|
-
var
|
|
35
|
+
var _login = require("../login/login");
|
|
36
|
+
|
|
37
|
+
var _index = require("../media/index");
|
|
22
38
|
|
|
23
39
|
var ns = _interopRequireWildcard(require("../ns"));
|
|
24
40
|
|
|
25
41
|
var pad = _interopRequireWildcard(require("../pad"));
|
|
26
42
|
|
|
27
|
-
var rdf = _interopRequireWildcard(require("rdflib"));
|
|
28
|
-
|
|
29
43
|
var style = _interopRequireWildcard(require("../style"));
|
|
30
44
|
|
|
31
45
|
var utils = _interopRequireWildcard(require("../utils"));
|
|
@@ -36,31 +50,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
36
50
|
|
|
37
51
|
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; }
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
* Contains the [[renderMessage]] function,
|
|
41
|
-
* along with [[elementForImageURI]],
|
|
42
|
-
* [[creatorAndDate]], and [[creatorAndDateHorizontal]]
|
|
43
|
-
* @packageDocumentation
|
|
44
|
-
*/
|
|
53
|
+
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; } } }; }
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
authn: _index.authn,
|
|
50
|
-
icons: _iconBase.icons,
|
|
51
|
-
ns: ns,
|
|
52
|
-
media: _index2.media,
|
|
53
|
-
pad: pad,
|
|
54
|
-
rdf: rdf,
|
|
55
|
-
store: _logic.store,
|
|
56
|
-
style: style,
|
|
57
|
-
utils: utils,
|
|
58
|
-
widgets: widgets
|
|
59
|
-
};
|
|
60
|
-
var dom = UI.dom || window.document; // const kb = UI.store
|
|
55
|
+
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); }
|
|
56
|
+
|
|
57
|
+
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; }
|
|
61
58
|
|
|
62
|
-
var
|
|
63
|
-
var
|
|
59
|
+
var dom = window.document;
|
|
60
|
+
var messageBodyStyle = style.messageBodyStyle;
|
|
61
|
+
var label = utils.label;
|
|
64
62
|
/**
|
|
65
63
|
* HTML component for an image
|
|
66
64
|
*/
|
|
@@ -73,14 +71,14 @@ function elementForImageURI(imageUri, options) {
|
|
|
73
71
|
height = ('' + options.inlineImageHeightEms).trim();
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); //
|
|
74
|
+
img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); // widgets.makeDropTarget(img, handleURIsDroppedOnMugshot, droppedFileHandler)
|
|
77
75
|
|
|
78
76
|
if (imageUri) img.setAttribute('src', imageUri);
|
|
79
77
|
var anchor = dom.createElement('a');
|
|
80
78
|
anchor.setAttribute('href', imageUri);
|
|
81
79
|
anchor.setAttribute('target', 'images');
|
|
82
80
|
anchor.appendChild(img);
|
|
83
|
-
|
|
81
|
+
widgets.makeDraggable(img, $rdf.sym(imageUri));
|
|
84
82
|
return anchor;
|
|
85
83
|
}
|
|
86
84
|
|
|
@@ -90,7 +88,7 @@ var anchor = function anchor(text, term) {
|
|
|
90
88
|
|
|
91
89
|
if (term && term.uri) {
|
|
92
90
|
a.setAttribute('href', term.uri);
|
|
93
|
-
a.addEventListener('click',
|
|
91
|
+
a.addEventListener('click', widgets.openHrefInOutlineMode, true);
|
|
94
92
|
a.setAttribute('style', 'color: #3B5998; text-decoration: none; '); // font-weight: bold
|
|
95
93
|
}
|
|
96
94
|
|
|
@@ -99,7 +97,8 @@ var anchor = function anchor(text, term) {
|
|
|
99
97
|
};
|
|
100
98
|
|
|
101
99
|
function nick(person) {
|
|
102
|
-
var s =
|
|
100
|
+
var s = _solidLogic.store.any(person, ns.foaf('nick'));
|
|
101
|
+
|
|
103
102
|
if (s) return '' + s.value;
|
|
104
103
|
return '' + label(person);
|
|
105
104
|
}
|
|
@@ -113,7 +112,7 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
113
112
|
var nickAnchor = td1.appendChild(anchor(nick(creator), creator));
|
|
114
113
|
|
|
115
114
|
if (creator.uri) {
|
|
116
|
-
|
|
115
|
+
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
117
116
|
nickAnchor.textContent = nick(creator);
|
|
118
117
|
});
|
|
119
118
|
}
|
|
@@ -131,7 +130,7 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
131
130
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
132
131
|
|
|
133
132
|
if (creator.uri) {
|
|
134
|
-
|
|
133
|
+
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
135
134
|
nickAnchor.textContent = nick(creator);
|
|
136
135
|
});
|
|
137
136
|
}
|
|
@@ -142,65 +141,54 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
142
141
|
td1.appendChild(dom.createElement('br'));
|
|
143
142
|
}
|
|
144
143
|
/**
|
|
145
|
-
* Renders a chat message
|
|
144
|
+
* Renders a chat message, read-only mode
|
|
146
145
|
*/
|
|
147
146
|
|
|
148
147
|
|
|
149
|
-
function
|
|
148
|
+
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
150
149
|
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
151
|
-
var creator = bindings['?creator'];
|
|
152
|
-
var message = bindings['?msg'];
|
|
153
|
-
var date = bindings['?date'];
|
|
154
|
-
var content = bindings['?content'];
|
|
155
|
-
var dateString = date.value;
|
|
156
|
-
var messageRow = dom.createElement('tr');
|
|
157
|
-
messageRow.AJAR_date = dateString;
|
|
158
|
-
messageRow.AJAR_subject = message;
|
|
159
150
|
|
|
160
|
-
|
|
161
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
162
|
-
options.selectedElement = messageRow;
|
|
163
|
-
messageTable.selectedElement = messageRow;
|
|
164
|
-
}
|
|
151
|
+
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
165
152
|
|
|
166
|
-
var
|
|
153
|
+
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
167
154
|
|
|
168
|
-
|
|
169
|
-
if (!ele) {
|
|
170
|
-
// empty
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
155
|
+
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
173
156
|
|
|
174
|
-
|
|
157
|
+
var content = _solidLogic.store.any(latestVersion, ns.sioc('content'));
|
|
175
158
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
done = true;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
159
|
+
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
160
|
+
var edited = !message.sameTerm(originalMessage);
|
|
182
161
|
|
|
183
|
-
|
|
184
|
-
messageTable.appendChild(messageRow);
|
|
185
|
-
}
|
|
162
|
+
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
186
163
|
|
|
164
|
+
|
|
165
|
+
var messageRow = dom.createElement('tr');
|
|
166
|
+
messageRow.AJAR_date = sortDate.value;
|
|
167
|
+
messageRow.AJAR_subject = message;
|
|
187
168
|
var td1 = dom.createElement('td');
|
|
188
169
|
messageRow.appendChild(td1);
|
|
189
170
|
|
|
190
|
-
if (options.
|
|
171
|
+
if (!options.authorDateOnLeft) {
|
|
191
172
|
var img = dom.createElement('img');
|
|
192
173
|
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
193
|
-
|
|
174
|
+
widgets.setImage(img, creator);
|
|
194
175
|
td1.appendChild(img);
|
|
195
176
|
} else {
|
|
196
|
-
creatorAndDate(td1, creator,
|
|
177
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var bothDates = widgets.shortDate(sortDate.value);
|
|
181
|
+
|
|
182
|
+
if (edited) {
|
|
183
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
197
184
|
} // Render the content ot the message itself
|
|
198
185
|
|
|
199
186
|
|
|
200
187
|
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
201
188
|
|
|
202
|
-
if (options.
|
|
203
|
-
creatorAndDateHorizontal(td2, creator,
|
|
189
|
+
if (!options.authorDateOnLeft) {
|
|
190
|
+
creatorAndDateHorizontal(td2, creator, bothDates, // widgets.shortDate(dateString)
|
|
191
|
+
message);
|
|
204
192
|
}
|
|
205
193
|
|
|
206
194
|
var text = content.value.trim();
|
|
@@ -230,7 +218,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
|
|
|
230
218
|
}
|
|
231
219
|
|
|
232
220
|
if (para) {
|
|
233
|
-
var bgcolor = colorizeByAuthor ?
|
|
221
|
+
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
234
222
|
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
235
223
|
}
|
|
236
224
|
|
|
@@ -249,7 +237,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
|
|
|
249
237
|
|
|
250
238
|
var td3 = dom.createElement('td');
|
|
251
239
|
messageRow.appendChild(td3);
|
|
252
|
-
var toolsButton =
|
|
240
|
+
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
253
241
|
td3.appendChild(toolsButton);
|
|
254
242
|
toolsButton.addEventListener('click', function (_event) {
|
|
255
243
|
if (messageRow.toolTR) {
|
|
@@ -260,7 +248,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
|
|
|
260
248
|
}
|
|
261
249
|
|
|
262
250
|
var toolsTR = dom.createElement('tr');
|
|
263
|
-
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext);
|
|
251
|
+
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
264
252
|
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
253
|
|
|
266
254
|
if (messageRow.nextSibling) {
|
|
@@ -279,4 +267,386 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
|
|
|
279
267
|
});
|
|
280
268
|
return messageRow;
|
|
281
269
|
}
|
|
270
|
+
|
|
271
|
+
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
272
|
+
var messageTable = messageRow.parentNode;
|
|
273
|
+
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
274
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
275
|
+
editRow.originalRow = messageRow;
|
|
276
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
277
|
+
}
|
|
278
|
+
/* Control for a new message -- or editing an old message ***************
|
|
279
|
+
*
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
284
|
+
function revertEditing(messageEditor) {
|
|
285
|
+
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
286
|
+
|
|
287
|
+
messageEditor.parentNode.removeChild(messageEditor);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function handleFieldInput(_x) {
|
|
291
|
+
return _handleFieldInput.apply(this, arguments);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function _handleFieldInput() {
|
|
295
|
+
_handleFieldInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_event) {
|
|
296
|
+
return _regenerator["default"].wrap(function _callee5$(_context6) {
|
|
297
|
+
while (1) {
|
|
298
|
+
switch (_context6.prev = _context6.next) {
|
|
299
|
+
case 0:
|
|
300
|
+
_context6.next = 2;
|
|
301
|
+
return sendMessage(field.value, true);
|
|
302
|
+
|
|
303
|
+
case 2:
|
|
304
|
+
case "end":
|
|
305
|
+
return _context6.stop();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}, _callee5);
|
|
309
|
+
}));
|
|
310
|
+
return _handleFieldInput.apply(this, arguments);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function sendMessage(_x2, _x3) {
|
|
314
|
+
return _sendMessage.apply(this, arguments);
|
|
315
|
+
} // sendMessage
|
|
316
|
+
// DRAG AND DROP
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
function _sendMessage() {
|
|
320
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text, fromMainField) {
|
|
321
|
+
var sendComplete, message, statusArea;
|
|
322
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
323
|
+
while (1) {
|
|
324
|
+
switch (_context7.prev = _context7.next) {
|
|
325
|
+
case 0:
|
|
326
|
+
sendComplete = function _sendComplete(message, _text2) {
|
|
327
|
+
// const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
|
|
328
|
+
// const content = $rdf.literal(text2)
|
|
329
|
+
(0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
|
|
330
|
+
|
|
331
|
+
if (originalMessage) {
|
|
332
|
+
// editing another message
|
|
333
|
+
var oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
334
|
+
|
|
335
|
+
if (oldRow.parentNode) {
|
|
336
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
337
|
+
} else {
|
|
338
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
339
|
+
oldRow.style.backgroundColor = '#fee';
|
|
340
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
344
|
+
} else {
|
|
345
|
+
if (fromMainField) {
|
|
346
|
+
field.value = ''; // clear from out for reuse
|
|
347
|
+
|
|
348
|
+
field.setAttribute('style', messageBodyStyle);
|
|
349
|
+
field.disabled = false;
|
|
350
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
351
|
+
|
|
352
|
+
field.focus(); // Start typing next line immediately
|
|
353
|
+
|
|
354
|
+
field.select();
|
|
355
|
+
}
|
|
356
|
+
} // await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
357
|
+
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
361
|
+
if (fromMainField) {
|
|
362
|
+
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
363
|
+
|
|
364
|
+
field.disabled = true;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
_context7.prev = 2;
|
|
368
|
+
_context7.next = 5;
|
|
369
|
+
return channelObject.updateMessage(text, originalMessage);
|
|
370
|
+
|
|
371
|
+
case 5:
|
|
372
|
+
message = _context7.sent;
|
|
373
|
+
_context7.next = 13;
|
|
374
|
+
break;
|
|
375
|
+
|
|
376
|
+
case 8:
|
|
377
|
+
_context7.prev = 8;
|
|
378
|
+
_context7.t0 = _context7["catch"](2);
|
|
379
|
+
statusArea = userContext.statusArea || messageEditor;
|
|
380
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context7.t0));
|
|
381
|
+
return _context7.abrupt("return");
|
|
382
|
+
|
|
383
|
+
case 13:
|
|
384
|
+
sendComplete(message, text);
|
|
385
|
+
|
|
386
|
+
case 14:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context7.stop();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}, _callee6, null, [[2, 8]]);
|
|
392
|
+
}));
|
|
393
|
+
return _sendMessage.apply(this, arguments);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function droppedFileHandler(files) {
|
|
397
|
+
var base = messageTable.chatDocument.dir().uri;
|
|
398
|
+
widgets.uploadFiles(_solidLogic.store.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
|
|
399
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(theFile, destURI) {
|
|
400
|
+
return _regenerator["default"].wrap(function _callee$(_context2) {
|
|
401
|
+
while (1) {
|
|
402
|
+
switch (_context2.prev = _context2.next) {
|
|
403
|
+
case 0:
|
|
404
|
+
_context2.next = 2;
|
|
405
|
+
return sendMessage(destURI);
|
|
406
|
+
|
|
407
|
+
case 2:
|
|
408
|
+
case "end":
|
|
409
|
+
return _context2.stop();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}, _callee);
|
|
413
|
+
}));
|
|
414
|
+
|
|
415
|
+
return function (_x4, _x5) {
|
|
416
|
+
return _ref.apply(this, arguments);
|
|
417
|
+
};
|
|
418
|
+
}());
|
|
419
|
+
} // When a set of URIs are dropped on the field
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
var droppedURIHandler = /*#__PURE__*/function () {
|
|
423
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(uris) {
|
|
424
|
+
var _iterator, _step, uri;
|
|
425
|
+
|
|
426
|
+
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
427
|
+
while (1) {
|
|
428
|
+
switch (_context3.prev = _context3.next) {
|
|
429
|
+
case 0:
|
|
430
|
+
_iterator = _createForOfIteratorHelper(uris);
|
|
431
|
+
_context3.prev = 1;
|
|
432
|
+
|
|
433
|
+
_iterator.s();
|
|
434
|
+
|
|
435
|
+
case 3:
|
|
436
|
+
if ((_step = _iterator.n()).done) {
|
|
437
|
+
_context3.next = 9;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
uri = _step.value;
|
|
442
|
+
_context3.next = 7;
|
|
443
|
+
return sendMessage(uri);
|
|
444
|
+
|
|
445
|
+
case 7:
|
|
446
|
+
_context3.next = 3;
|
|
447
|
+
break;
|
|
448
|
+
|
|
449
|
+
case 9:
|
|
450
|
+
_context3.next = 14;
|
|
451
|
+
break;
|
|
452
|
+
|
|
453
|
+
case 11:
|
|
454
|
+
_context3.prev = 11;
|
|
455
|
+
_context3.t0 = _context3["catch"](1);
|
|
456
|
+
|
|
457
|
+
_iterator.e(_context3.t0);
|
|
458
|
+
|
|
459
|
+
case 14:
|
|
460
|
+
_context3.prev = 14;
|
|
461
|
+
|
|
462
|
+
_iterator.f();
|
|
463
|
+
|
|
464
|
+
return _context3.finish(14);
|
|
465
|
+
|
|
466
|
+
case 17:
|
|
467
|
+
case "end":
|
|
468
|
+
return _context3.stop();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
472
|
+
}));
|
|
473
|
+
|
|
474
|
+
return function droppedURIHandler(_x6) {
|
|
475
|
+
return _ref2.apply(this, arguments);
|
|
476
|
+
};
|
|
477
|
+
}(); // When we are actually logged on
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
function turnOnInput() {
|
|
481
|
+
function getImageDoc() {
|
|
482
|
+
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
483
|
+
return imageDoc;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function tookPicture(_x7) {
|
|
487
|
+
return _tookPicture.apply(this, arguments);
|
|
488
|
+
} // Body of turnOnInput
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
function _tookPicture() {
|
|
492
|
+
_tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(imageDoc) {
|
|
493
|
+
return _regenerator["default"].wrap(function _callee4$(_context5) {
|
|
494
|
+
while (1) {
|
|
495
|
+
switch (_context5.prev = _context5.next) {
|
|
496
|
+
case 0:
|
|
497
|
+
if (!imageDoc) {
|
|
498
|
+
_context5.next = 3;
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
_context5.next = 3;
|
|
503
|
+
return sendMessage(imageDoc.uri);
|
|
504
|
+
|
|
505
|
+
case 3:
|
|
506
|
+
case "end":
|
|
507
|
+
return _context5.stop();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}, _callee4);
|
|
511
|
+
}));
|
|
512
|
+
return _tookPicture.apply(this, arguments);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
var menuButton;
|
|
516
|
+
|
|
517
|
+
if (options.menuHandler) {
|
|
518
|
+
var _menuButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', 'More');
|
|
519
|
+
|
|
520
|
+
_menuButton.setAttribute('style', style.buttonStyle + 'float: right;'); // menuButton.addEventListener('click', _event => sendMessage(), false) (done in turnoninput)
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
rhs.appendChild(_menuButton);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if (options.menuHandler && menuButton) {
|
|
527
|
+
var _me = _solidLogic.authn.currentUser();
|
|
528
|
+
|
|
529
|
+
var menuOptions = {
|
|
530
|
+
me: _me,
|
|
531
|
+
dom: dom,
|
|
532
|
+
div: null,
|
|
533
|
+
// @@ was: div
|
|
534
|
+
newBase: messageTable.chatDocument.dir().uri
|
|
535
|
+
};
|
|
536
|
+
menuButton.addEventListener('click', function (event) {
|
|
537
|
+
options.menuHandler(event, channelObject.chatChannel, menuOptions);
|
|
538
|
+
}, false);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
var me = _solidLogic.authn.currentUser(); // If already logged on
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
creatorAndDate(lhs, me, '', null);
|
|
545
|
+
field = dom.createElement('textarea');
|
|
546
|
+
middle.innerHTML = '';
|
|
547
|
+
middle.appendChild(field);
|
|
548
|
+
field.rows = 3;
|
|
549
|
+
|
|
550
|
+
if (originalMessage) {
|
|
551
|
+
field.value = _solidLogic.store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc());
|
|
552
|
+
} // field.cols = 40
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
|
|
556
|
+
|
|
557
|
+
field.addEventListener('keydown', /*#__PURE__*/function () {
|
|
558
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
|
|
559
|
+
return _regenerator["default"].wrap(function _callee3$(_context4) {
|
|
560
|
+
while (1) {
|
|
561
|
+
switch (_context4.prev = _context4.next) {
|
|
562
|
+
case 0:
|
|
563
|
+
if (!(e.code === 'Enter')) {
|
|
564
|
+
_context4.next = 4;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (!(!e.shiftKey && !options.shiftEnterSendsMessage || e.shiftKey && options.shiftEnterSendsMessage)) {
|
|
569
|
+
_context4.next = 4;
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
_context4.next = 4;
|
|
574
|
+
return handleFieldInput(e);
|
|
575
|
+
|
|
576
|
+
case 4:
|
|
577
|
+
case "end":
|
|
578
|
+
return _context4.stop();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}, _callee3);
|
|
582
|
+
}));
|
|
583
|
+
|
|
584
|
+
return function (_x8) {
|
|
585
|
+
return _ref3.apply(this, arguments);
|
|
586
|
+
};
|
|
587
|
+
}(), false);
|
|
588
|
+
widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
|
|
589
|
+
rhs.innerHTML = '';
|
|
590
|
+
sendButton = widgets.button(dom, sendIcon, 'Send');
|
|
591
|
+
sendButton.style["float"] = 'right';
|
|
592
|
+
sendButton.addEventListener('click', function (_event) {
|
|
593
|
+
return handleFieldInput();
|
|
594
|
+
}, false);
|
|
595
|
+
rhs.appendChild(sendButton);
|
|
596
|
+
|
|
597
|
+
if (originalMessage) {
|
|
598
|
+
// Are we editing another message?
|
|
599
|
+
var cancelButton = rhs.appendChild(widgets.cancelButton(dom));
|
|
600
|
+
cancelButton.style["float"] = 'left'; // cancelButton.firstChild.style.opacity = '0.3' // moved to buttons
|
|
601
|
+
|
|
602
|
+
cancelButton.addEventListener('click', function (_event) {
|
|
603
|
+
return revertEditing(messageEditor);
|
|
604
|
+
}, false);
|
|
605
|
+
rhs.appendChild(cancelButton);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
var chatDocument = channelObject.dateFolder.leafDocumentFromDate(new Date());
|
|
609
|
+
var imageDoc;
|
|
610
|
+
middle.appendChild(_index.media.cameraButton(dom, _solidLogic.store, getImageDoc, tookPicture));
|
|
611
|
+
pad.recordParticipation(channelObject.channel, channelObject.channel.doc()); // participation =
|
|
612
|
+
} // turn on inpuut
|
|
613
|
+
// Body of renderMessageEditor
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
var sortDate, sendIcon;
|
|
617
|
+
|
|
618
|
+
if (originalMessage) {
|
|
619
|
+
sortDate = _solidLogic.store.anyValue(originalMessage, ns.dct('created'), null, originalMessage.doc()); // text = store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc())
|
|
620
|
+
|
|
621
|
+
sendIcon = _iconBase.icons.iconBase + 'noun_1180158.svg'; // Green check
|
|
622
|
+
// cancelIcon = icons.iconBase + 'noun_1180156.svg' // Black cross
|
|
623
|
+
} else {
|
|
624
|
+
sendIcon = _iconBase.icons.iconBase + 'noun_383448.svg';
|
|
625
|
+
sortDate = '9999-01-01T00:00:00Z'; // ISO format for field sort
|
|
626
|
+
// text = ''
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
var messageEditor = dom.createElement('tr');
|
|
630
|
+
var lhs = dom.createElement('td');
|
|
631
|
+
var middle = dom.createElement('td');
|
|
632
|
+
var rhs = dom.createElement('td');
|
|
633
|
+
messageEditor.appendChild(lhs);
|
|
634
|
+
messageEditor.appendChild(middle);
|
|
635
|
+
messageEditor.appendChild(rhs);
|
|
636
|
+
messageEditor.AJAR_date = sortDate; // messageEditor.appendChild(dom.createElement('br'))
|
|
637
|
+
|
|
638
|
+
var field, sendButton;
|
|
639
|
+
var context = {
|
|
640
|
+
div: middle,
|
|
641
|
+
dom: dom
|
|
642
|
+
};
|
|
643
|
+
(0, _login.ensureLoggedIn)(context).then(function (context) {
|
|
644
|
+
// me = context.me
|
|
645
|
+
turnOnInput();
|
|
646
|
+
Object.assign(context, userContext);
|
|
647
|
+
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {// console.log('Bookmark file: ' + context.bookmarkDocument)
|
|
648
|
+
});
|
|
649
|
+
});
|
|
650
|
+
return messageEditor;
|
|
651
|
+
} // renderMessageEditor
|
|
282
652
|
//# sourceMappingURL=message.js.map
|