mirror of
https://github.com/balzack/databag.git
synced 2025-04-19 16:15:16 +00:00
styling of thread message input
This commit is contained in:
parent
5249ffda99
commit
38a637e5cb
@ -161,6 +161,7 @@ export const styles = StyleSheet.create({
|
||||
width: '100%',
|
||||
fontSize: 14,
|
||||
padding: 0,
|
||||
maxHeight: 256,
|
||||
},
|
||||
controls: {
|
||||
display: 'flex',
|
||||
|
@ -289,7 +289,6 @@ export function Conversation({close, openDetails, wide}: {close: () => void; ope
|
||||
editable={!sending}
|
||||
textColor={state.textColorSet ? state.textColor : undefined}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
spellcheck={false}
|
||||
autoComplete="off"
|
||||
autoCapitalize="none"
|
||||
|
@ -199,6 +199,9 @@ export function Conversation({ openDetails }: { openDetails: () => void }) {
|
||||
<div className={classes.files}>{media}</div>
|
||||
<Textarea
|
||||
ref={input}
|
||||
autosize={true}
|
||||
maxRows={8}
|
||||
minRows={2}
|
||||
className={classes.message}
|
||||
placeholder={state.strings.newMessage}
|
||||
styles={{ input: { color: state.textColorSet ? state.textColor : undefined, fontSize: state.textSizeSet ? state.textSize : undefined } }}
|
||||
|
@ -124,6 +124,7 @@ export function Message({ topic, card, profile, host }: { topic: Topic; card: Ca
|
||||
useEffect(() => {
|
||||
const urlPattern = new RegExp('(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)')
|
||||
const hostPattern = new RegExp('^https?:\\/\\/', 'i')
|
||||
const dotPattern = new RegExp('^.*\\.\\..*$')
|
||||
|
||||
let plain = ''
|
||||
const clickable = []
|
||||
@ -132,7 +133,7 @@ export function Message({ topic, card, profile, host }: { topic: Topic; card: Ca
|
||||
if (parsed?.length > 0) {
|
||||
const words = parsed as string[]
|
||||
words.forEach((word, index) => {
|
||||
if (urlPattern.test(word)) {
|
||||
if (urlPattern.test(word) && !dotPattern.test(word)) {
|
||||
clickable.push(<span key={index}>{plain}</span>)
|
||||
plain = ''
|
||||
const url = hostPattern.test(word) ? word : `https://${word}`
|
||||
|
Loading…
x
Reference in New Issue
Block a user