mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
[Glitch] Allow drag&drop of link to quote in compose form
Port 4ab1d5d724 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -50,6 +50,7 @@ const AutosuggestTextarea = forwardRef(({
|
||||
onKeyUp,
|
||||
onKeyDown,
|
||||
onPaste,
|
||||
onDrop,
|
||||
onFocus,
|
||||
autoFocus = true,
|
||||
lang,
|
||||
@@ -153,6 +154,12 @@ const AutosuggestTextarea = forwardRef(({
|
||||
onPaste(e);
|
||||
}, [onPaste]);
|
||||
|
||||
const handleDrop = useCallback((e) => {
|
||||
if (onDrop) {
|
||||
onDrop(e);
|
||||
}
|
||||
}, [onDrop]);
|
||||
|
||||
// Show the suggestions again whenever they change and the textarea is focused
|
||||
useEffect(() => {
|
||||
if (suggestions.size > 0 && textareaRef.current === document.activeElement) {
|
||||
@@ -204,6 +211,7 @@ const AutosuggestTextarea = forwardRef(({
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
onPaste={handlePaste}
|
||||
onDrop={handleDrop}
|
||||
dir='auto'
|
||||
aria-autocomplete='list'
|
||||
aria-label={placeholder}
|
||||
@@ -235,6 +243,7 @@ AutosuggestTextarea.propTypes = {
|
||||
onKeyUp: PropTypes.func,
|
||||
onKeyDown: PropTypes.func,
|
||||
onPaste: PropTypes.func.isRequired,
|
||||
onDrop: PropTypes.func,
|
||||
onFocus:PropTypes.func,
|
||||
autoFocus: PropTypes.bool,
|
||||
lang: PropTypes.string,
|
||||
|
||||
Reference in New Issue
Block a user