1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
|
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
|
-
-
+
+
+
|
"then Ctrl-Enter toggles this setting."
].join(''),
boolValue: 'edit-ctrl-send'
},{
label: "Compact mode",
hint: [
"Toggle between a space-saving or more spacious writing area. ",
"When the input field has focus, is empty, and preview mode ",
"is NOT active then Shift-Enter toggles this setting."].join(''),
"When the input field has focus and is empty ",
"then Shift-Enter may (depending on the current view) toggle this setting."
].join(''),
boolValue: 'edit-compact-mode'
},{
label: "Use 'contenteditable' editing mode",
boolValue: 'edit-widget-x',
hint: [
"When enabled, chat input uses a so-called 'contenteditable' ",
"field. Though generally more comfortable and modern than ",
|
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
|
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
|
-
+
|
}
Chat.e.inputElementWrapper.classList[
s.value ? 'add' : 'remove'
]('compact');
Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
});
Chat.settings.addListener('edit-ctrl-send',function(s){
const label = "Submit message ("+(s.value ? "Ctrl-" : "")+"Enter)";
const label = (s.value ? "Ctrl-" : "")+"Enter submits message";
Chat.e.inputFields.forEach((e)=>{
const v = e.dataset.placeholder0 + " " +label;
if(e.isContentEditable) e.dataset.placeholder = v;
else D.attr(e,'placeholder',v);
});
Chat.e.btnSubmit.title = label;
});
|
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
|
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
"Shutting down chat poller due to server-side error. ",
"Reload this page to reactivate it.");
delete Chat.intervalTimer;
}
poll.running = false;
};
afterFetch.isFirstCall = true;
/**
FIXME: when polling fails because the remote server is
reachable but it's not accepting HTTP requests, we should back
off on polling for a while. e.g. if the remote web server process
is killed, the poll fails quickly and immediately retries,
hammering the remote server until the httpd is back up. That
happens often during development of this application.
XHR does not offer a direct way of distinguishing between
HTTP/connection errors, but we can hypothetically use the
xhrRequest.status value to do so, with status==0 being a
connection error. We do not currently have a clean way of passing
that info back to the fossil.fetch() client, so we'll need to
hammer on that API a bit to get this working.
*/
const poll = async function f(){
if(f.running) return;
f.running = true;
Chat._isBatchLoading = f.isFirstCall;
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.ajaxStart();
|