Skip to content

Commit 1ba382e

Browse files
committed
tweak chat options
1 parent 576b19f commit 1ba382e

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/chat/infinite.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ export function insertMessageIntoTable (channelObject, messageTable, message, fr
9191
* index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
9292
*
9393
* Use to import store as param 2, now ignores it and uses the UI main store
94+
*
95+
* Options include:
96+
97+
- shiftEnterSendsMessage: Use shift/enter to send message, Enter to add newline, instead of the reverse.
98+
- authorDateOnLeft: Display the author's anme and date of the message in the left column instead of first above the content
99+
- selectedMessage: Display one message highlighted with the chat around it
100+
- solo: By itelf on a webpage, so user scroll anywhere in the web page scan scroll the chat.
101+
- newestFirst: Arrange the chat messages chronologically newest at the top insted of at the bottom
102+
- infinite: Use infinite scroll
103+
- showDeletedMessages: Show messages which have been delted as "deleted message". Otherwise hide them.
104+
- expandImagesInline: If a URI by itself in a message looks like an image URI, replace it with the image
105+
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
106+
94107
*/
95108
export async function infiniteMessageArea (dom, wasStore, chatChannel, options) {
96109
// ///////////////////////////////////////////////////////////////////////
@@ -329,7 +342,7 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
329342
/// ///////////////////////
330343
/*
331344
options = options || {}
332-
options.authorAboveContent = true
345+
options.authorDateOnLeft = true
333346
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
334347
const channelObject = new ChatChannel(chatChannel, options)
335348
const dateFolder = channelObject.dateFolder
@@ -615,7 +628,7 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
615628
// Body of main function
616629

617630
options = options || {}
618-
options.authorAboveContent = true
631+
options.authorDateOnLeft = false // @@ make a user optiosn
619632
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
620633

621634
const channelObject = new ChatChannel(chatChannel, options)

src/chat/message.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function renderMessageRow (channelObject, message, fresh, options, userCo
134134

135135
const td1 = dom.createElement('td')
136136
messageRow.appendChild(td1)
137-
if (options.authorAboveContent) {
137+
if (!options.authorDateOnLeft) {
138138
const img = dom.createElement('img')
139139
img.setAttribute(
140140
'style',
@@ -153,7 +153,7 @@ export function renderMessageRow (channelObject, message, fresh, options, userCo
153153
// Render the content ot the message itself
154154
const td2 = messageRow.appendChild(dom.createElement('td'))
155155

156-
if (options.authorAboveContent) {
156+
if (!options.authorDateOnLeft) {
157157
creatorAndDateHorizontal(
158158
td2,
159159
creator,
@@ -392,9 +392,9 @@ export function renderMessageEditor (channelObject, messageTable, userContext, o
392392
'keydown',
393393
async function (e) {
394394
// User preference?
395-
if (e.code === "Enter") {
395+
if (e.code === 'Enter') {
396396
// if (e.keyCode === 13) { // deprocated https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
397-
if (!e.shiftKey) {
397+
if ((!e.shiftKey && !options.shiftEnterSendsMessage) || (e.shiftKey && options.shiftEnterSendsMessage)) {
398398
// Shift-Enter just adds a new line
399399
// (note alt-enter doesn't add newline anyway on my setup - so have to use shift.
400400
await handleFieldInput(e)

src/logic.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { SolidLogic } from 'solid-logic'
77

88
async function thisFetch (url, requestInit) => {
99
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
10-
if (authSession.info.webId && !omitCreds) {
10+
if (authSession.info.webId && !omitCreds) { // see https://github.com/solid/solidos/issues/114
11+
// In fact ftech should respect crentials omit itself
1112
return authSession.fetch(url, requestInit)
1213
} else {
1314
return window.fetch(url, requestInit)

0 commit comments

Comments
 (0)