-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:Fancy-Mumble/FancyMumbleV2 into …
…develop
- Loading branch information
Showing
25 changed files
with
572 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Backdrop, Box, Container, Link, Popover, } from "@mui/material"; | ||
import { UsersState } from "../store/features/users/userSlice"; | ||
import "./styles/UserInfo.css"; | ||
import "./styles/common.css" | ||
import UserInfo from "./UserInfo"; | ||
import React, { useState } from "react"; | ||
import { openInBrowser } from "../helper/BrowserUtils"; | ||
|
||
interface LightBoxImageProps { | ||
src: string; | ||
} | ||
|
||
function LightBoxImage(props: LightBoxImageProps) { | ||
const [open, setOpen]: any = useState(false); | ||
|
||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<Box> | ||
<img src={props.src} onClick={() => setOpen(true)} style={{ maxWidth: '100%', maxHeight: '600px', cursor: 'pointer' }} /> | ||
<Backdrop | ||
sx={{ color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1, backdropFilter: 'blur(5px)', padding: '50px 10px 10px 10px' }} | ||
open={open} | ||
onClick={handleClose} | ||
> | ||
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', width: '100%' }}> | ||
<Box sx={{ flexShrink: 0, display: 'contents' }}> | ||
<img src={props.src} style={{ height: 'auto', width: 'auto', maxWidth: '100%', maxHeight: 'calc(100% - 2em)', objectFit: 'contain' }} /> | ||
</Box> | ||
<Box sx={{ flexShrink: 1, textAlign: 'center'}}> | ||
<Link href="#" color="inherit" underline="hover" onClick={() => openInBrowser(props.src)}>Open In Browser</Link> | ||
</Box> | ||
</Box> | ||
</Backdrop> | ||
</Box> | ||
); | ||
} | ||
|
||
export default LightBoxImage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import React, { useEffect, useRef, useState } from 'react'; | ||
import Quill, { TextChangeHandler } from 'quill'; | ||
import 'quill/dist/quill.snow.css'; | ||
|
||
interface QuillEditorProps { | ||
theme?: 'bubble' | 'snow' | string; | ||
placeholder?: string; | ||
readOnly?: boolean; | ||
bounds?: string; | ||
debug?: 'error' | 'warn' | 'log' | boolean; | ||
formats?: string[]; | ||
modules?: any; | ||
scrollingContainer?: string | HTMLElement | undefined; | ||
style?: React.CSSProperties; | ||
onKeyDown?: (this: HTMLDivElement, ev: KeyboardEvent) => any; | ||
onChange?: (content: string) => void; | ||
onPaste?: (this: HTMLDivElement, ev: ClipboardEvent) => any; | ||
multiline?: boolean; | ||
value?: string; | ||
} | ||
|
||
export const QuillEditor: React.FC<QuillEditorProps> = ({ | ||
theme = 'snow', | ||
placeholder = 'Compose an epic...', | ||
readOnly = false, | ||
bounds = 'document.body', | ||
debug = 'warn', | ||
formats = [], | ||
modules = {}, | ||
scrollingContainer = undefined, | ||
style = {}, | ||
onKeyDown, | ||
onChange, | ||
onPaste, | ||
multiline = false, | ||
value = '' | ||
}) => { | ||
const editorRef = useRef<HTMLDivElement | null>(null); | ||
const quillRef = useRef(); // This will hold the Quill instance | ||
const [toolbarVisible, setToolbarVisible] = useState(multiline); | ||
let quill: Quill | undefined = undefined; | ||
let textChangeListener: TextChangeHandler | undefined = undefined; | ||
|
||
// This runs once on component mount | ||
useEffect(() => { | ||
if (editorRef.current) { | ||
quill = new Quill(editorRef.current, { | ||
theme, | ||
placeholder, | ||
readOnly, | ||
bounds, | ||
debug, | ||
formats, | ||
modules, | ||
scrollingContainer | ||
}); | ||
|
||
// Set the initial value | ||
quill.root.innerHTML = value; | ||
|
||
// Add event listeners | ||
if (onKeyDown) | ||
quill.root.addEventListener('keydown', onKeyDown); | ||
if (onPaste) | ||
quill.root.addEventListener('paste', onPaste); | ||
|
||
if (onChange) { | ||
textChangeListener = () => { | ||
onChange(quill?.root.innerHTML || ''); | ||
} | ||
|
||
quill.on('text-change', textChangeListener); | ||
} | ||
|
||
|
||
// Check for multiline to show/hide toolbar | ||
if (multiline) { | ||
quill.on('text-change', () => { | ||
const text = quill?.getText(); | ||
const lineCount = (text?.match(/\n/g) || []).length; | ||
setToolbarVisible(lineCount > 1); | ||
}); | ||
} | ||
} | ||
|
||
// Clean up on component unmount | ||
return () => { | ||
if (quill) { | ||
if (onKeyDown) { | ||
quill.root.removeEventListener('keydown', onKeyDown); | ||
} | ||
|
||
if (textChangeListener) { | ||
quill?.off('text-change', textChangeListener); | ||
} | ||
|
||
if (onPaste) { | ||
quill.root.removeEventListener('paste', onPaste); | ||
} | ||
} | ||
}; | ||
}, []); // Empty array means this effect runs once on mount and clean up on unmount | ||
|
||
|
||
useEffect(() => { | ||
if (editorRef.current) { | ||
|
||
|
||
/*if (quillRef) { | ||
quillRef.current = quill; | ||
}*/ | ||
} | ||
}, [theme, placeholder, readOnly, bounds, debug, formats, modules, scrollingContainer, quillRef]); | ||
|
||
return <div className="quill-wrapper" style={style}> | ||
{toolbarVisible && <div id="toolbar">/* Add toolbar contents here */</div>} | ||
<div ref={editorRef} /> | ||
</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { invoke } from "@tauri-apps/api"; | ||
|
||
export function openInBrowser(url: string) { | ||
invoke('open_browser', { url: url }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.