set readonly on mobile devices

This commit is contained in:
Luck
2022-01-27 23:26:16 +00:00
parent 7d54be07d9
commit ed7f8e5bdd
5 changed files with 28 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { useState, useEffect } from 'react';
import { ThemeProvider, createGlobalStyle } from 'styled-components';
import { isMobile } from 'react-device-detect';
import ls from 'local-storage';
import EditorControls from './EditorControls';
@@ -13,7 +14,8 @@ export default function Editor({
setActualContent,
contentType,
}) {
const [language, setLanguage] = useState('plain');
const [language, setLanguage] = useState(isMobile);
const [readOnly, setReadOnly] = useState(true);
const [theme, setTheme] = usePreference(
'theme',
@@ -48,6 +50,8 @@ export default function Editor({
setForcedContent={setForcedContent}
language={language}
setLanguage={setLanguage}
readOnly={readOnly}
setReadOnly={setReadOnly}
theme={theme}
setTheme={setTheme}
zoom={zoom}
@@ -59,6 +63,7 @@ export default function Editor({
theme={themes[theme]}
language={language}
fontSize={fontSize}
readOnly={readOnly}
/>
</ThemeProvider>
</>