@selfcommunity/react-ui 0.10.1-alpha.4 → 0.10.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,6 +69,9 @@ function CommentObjectReply(inProps) {
|
|
|
69
69
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
70
70
|
// RETRIEVE OBJECTS
|
|
71
71
|
const [html, setHtml] = (0, react_1.useState)(text);
|
|
72
|
+
// HOOKS
|
|
73
|
+
const theme = (0, material_1.useTheme)();
|
|
74
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
72
75
|
// REFS
|
|
73
76
|
let editor = (0, react_1.useRef)();
|
|
74
77
|
/**
|
|
@@ -82,15 +85,10 @@ function CommentObjectReply(inProps) {
|
|
|
82
85
|
* Focus on editor
|
|
83
86
|
*/
|
|
84
87
|
const handleEditorFocus = () => {
|
|
85
|
-
if (editor.current) {
|
|
88
|
+
if (!isMobile && editor.current) {
|
|
86
89
|
editor.current.focus();
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
|
-
(0, react_1.useEffect)(() => {
|
|
90
|
-
const focusOnUserInteraction = () => handleEditorFocus();
|
|
91
|
-
document.addEventListener('touchstart', focusOnUserInteraction);
|
|
92
|
-
return () => document.removeEventListener('touchstart', focusOnUserInteraction);
|
|
93
|
-
}, []);
|
|
94
92
|
/**
|
|
95
93
|
* Handle Replay
|
|
96
94
|
*/
|
|
@@ -4,7 +4,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import Widget from '../Widget';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
|
-
import { Avatar, Stack } from '@mui/material';
|
|
7
|
+
import { Avatar, Stack, useMediaQuery, useTheme } from '@mui/material';
|
|
8
8
|
import { useSCUser } from '@selfcommunity/react-core';
|
|
9
9
|
import Editor from '../Editor';
|
|
10
10
|
import classNames from 'classnames';
|
|
@@ -67,6 +67,9 @@ export default function CommentObjectReply(inProps) {
|
|
|
67
67
|
const scUserContext = useSCUser();
|
|
68
68
|
// RETRIEVE OBJECTS
|
|
69
69
|
const [html, setHtml] = useState(text);
|
|
70
|
+
// HOOKS
|
|
71
|
+
const theme = useTheme();
|
|
72
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
70
73
|
// REFS
|
|
71
74
|
let editor = useRef();
|
|
72
75
|
/**
|
|
@@ -80,15 +83,10 @@ export default function CommentObjectReply(inProps) {
|
|
|
80
83
|
* Focus on editor
|
|
81
84
|
*/
|
|
82
85
|
const handleEditorFocus = () => {
|
|
83
|
-
if (editor.current) {
|
|
86
|
+
if (!isMobile && editor.current) {
|
|
84
87
|
editor.current.focus();
|
|
85
88
|
}
|
|
86
89
|
};
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
const focusOnUserInteraction = () => handleEditorFocus();
|
|
89
|
-
document.addEventListener('touchstart', focusOnUserInteraction);
|
|
90
|
-
return () => document.removeEventListener('touchstart', focusOnUserInteraction);
|
|
91
|
-
}, []);
|
|
92
90
|
/**
|
|
93
91
|
* Handle Replay
|
|
94
92
|
*/
|