mobile: fix editor

This commit is contained in:
ammarahm-ed
2023-08-03 18:24:25 +05:00
committed by Ammar Ahmed
parent c5db2e0ea9
commit 2bed812df1
9 changed files with 29 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ export type Settings = {
keyboardShown?: boolean; keyboardShown?: boolean;
doubleSpacedLines?: boolean; doubleSpacedLines?: boolean;
corsProxy: string; corsProxy: string;
fontSize: string; fontSize: number;
fontFamily: string; fontFamily: string;
dateFormat: string; dateFormat: string;
timeFormat: string; timeFormat: string;

View File

@@ -69,7 +69,7 @@ export type Settings = {
corsProxy: string; corsProxy: string;
disableRealtimeSync?: boolean; disableRealtimeSync?: boolean;
notificationSound?: Sound & { platform: PlatformOSType }; notificationSound?: Sound & { platform: PlatformOSType };
defaultFontSize: string; defaultFontSize: number;
defaultFontFamily: string; defaultFontFamily: string;
colorScheme: "dark" | "light"; colorScheme: "dark" | "light";
lighTheme: ThemeDefinition; lighTheme: ThemeDefinition;
@@ -149,7 +149,7 @@ export const defaultSettings: SettingStore["settings"] = {
reminderNotificationMode: "urgent", reminderNotificationMode: "urgent",
notificationSound: undefined, notificationSound: undefined,
defaultFontFamily: "sans-serif", defaultFontFamily: "sans-serif",
defaultFontSize: "16", defaultFontSize: 16,
colorScheme: "light", colorScheme: "light",
lighTheme: ThemeLight, lighTheme: ThemeLight,
darkTheme: ThemeDark darkTheme: ThemeDark

View File

@@ -32,7 +32,7 @@ const initialState = {
readonly: globalThis.readonly, readonly: globalThis.readonly,
doubleSpacedLines: true, doubleSpacedLines: true,
fontFamily: "sans-serif", fontFamily: "sans-serif",
fontSize: "16px", fontSize: 16,
timeFormat: "12-hour", timeFormat: "12-hour",
dateFormat: "DD-MM-YYYY" dateFormat: "DD-MM-YYYY"
}; };

View File

@@ -57,7 +57,6 @@ export const FontSize = Extension.create<FontSizeOptions>({
if (!attributes.fontSize) { if (!attributes.fontSize) {
return {}; return {};
} }
return { return {
style: `font-size: ${attributes.fontSize}` style: `font-size: ${attributes.fontSize}`
}; };

View File

@@ -37,7 +37,6 @@ function _Counter(props: CounterProps) {
alignItems: "stretch", alignItems: "stretch",
borderRadius: "default", borderRadius: "default",
overflow: "hidden", overflow: "hidden",
height: "100%",
cursor: "pointer", cursor: "pointer",
":hover": { ":hover": {
bg: "hover-secondary" bg: "hover-secondary"
@@ -51,7 +50,10 @@ function _Counter(props: CounterProps) {
title={`Decrease ${title}`} title={`Decrease ${title}`}
icon="minus" icon="minus"
variant={"small"} variant={"small"}
onClick={onDecrease} onClick={(e) => {
e.stopPropagation();
onDecrease();
}}
/> />
<Text <Text
@@ -71,7 +73,10 @@ function _Counter(props: CounterProps) {
title={`Increase ${title}`} title={`Increase ${title}`}
icon="plus" icon="plus"
variant={"small"} variant={"small"}
onClick={onIncrease} onClick={(e) => {
e.stopPropagation();
onIncrease();
}}
/> />
</Flex> </Flex>
); );

View File

@@ -52,6 +52,7 @@ export function MoreTools(props: MoreToolsProps) {
/> />
<PopupWrapper <PopupWrapper
isOpen={isOpen} isOpen={isOpen}
scope="editorToolbar"
group={group || "toolbarGroup"} group={group || "toolbarGroup"}
id={popupId} id={popupId}
onClosed={onClosed} onClosed={onClosed}

View File

@@ -39,8 +39,8 @@ export function ToolbarGroup(props: ToolbarGroupProps) {
<Flex <Flex
className="toolbar-group" className="toolbar-group"
sx={{ sx={{
gap: "small", gap: [0, 0, "small"],
p: "small", p: ["4px", "4px", "small"],
flexShrink: 0, flexShrink: 0,
...sx ...sx
}} }}

View File

@@ -238,7 +238,12 @@ export function ColorPicker(props: ColorPickerProps) {
{onClose && ( {onClose && (
<Button <Button
variant={"icon"} variant={"icon"}
sx={{ display: ["block", "none"], px: 2 }} sx={{
display: ["block", "none"],
px: 2,
width: "50px",
alignSelf: "center"
}}
onClick={onClose} onClick={onClose}
> >
<Icon path={Icons.close} size="big" /> <Icon path={Icons.close} size="big" />

View File

@@ -27,6 +27,7 @@ import {
} from "../"; } from "../";
import React, { ForwardedRef, PropsWithChildren, useMemo } from "react"; import React, { ForwardedRef, PropsWithChildren, useMemo } from "react";
import { Box, BoxProps } from "@theme-ui/components"; import { Box, BoxProps } from "@theme-ui/components";
import { useTheme } from "@emotion/react";
export type EmotionThemeProviderProps = { export type EmotionThemeProviderProps = {
scope?: keyof ThemeScopes; scope?: keyof ThemeScopes;
@@ -44,6 +45,7 @@ function _EmotionThemeProvider(
className, className,
...restProps ...restProps
} = props; } = props;
const emotionTheme = useTheme();
const theme = useThemeEngineStore((store) => store.theme); const theme = useThemeEngineStore((store) => store.theme);
const themeScope = useThemeColors(scope); const themeScope = useThemeColors(scope);
const { colors } = themeScope; const { colors } = themeScope;
@@ -58,7 +60,12 @@ function _EmotionThemeProvider(
); );
return ( return (
<ThemeProvider theme={themeProperties}> <ThemeProvider
theme={{
...(emotionTheme || themeProperties),
colors: themeProperties.colors
}}
>
<NNScopedThemeProvider value={scope}> <NNScopedThemeProvider value={scope}>
{injectCssVars ? ( {injectCssVars ? (
<Box <Box