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