Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: improve mobile table usability

tianma-if52b3b2085945
diff --git a/apps/mobile/app.json b/apps/mobile/app.json
index 72bb98e4..f1f4b631 100644
--- a/apps/mobile/app.json
+++ b/apps/mobile/app.json
@@ -3,7 +3,7 @@
"name": "EdgeEver",
"slug": "edgeever",
"scheme": "edgeever",
- "version": "1.3.1",
+ "version": "1.3.2",
"runtimeVersion": {
"policy": "appVersion"
},
@@ -28,7 +28,7 @@
},
"android": {
"package": "org.edgeever.mobile",
- "versionCode": 29,
+ "versionCode": 30,
"adaptiveIcon": {
"backgroundColor": "#d1fae5",
"backgroundImage": "./assets/icon.png",
diff --git a/apps/mobile/src/components/LocalTiptapEditor.tsx b/apps/mobile/src/components/LocalTiptapEditor.tsx
index 0c2e9cad..44b61af5 100644
--- a/apps/mobile/src/components/LocalTiptapEditor.tsx
+++ b/apps/mobile/src/components/LocalTiptapEditor.tsx
@@ -19,6 +19,7 @@ import {
getMobileEditorImageScaleLabel,
getMobileEditorImageWidthPresetLabel,
getMobileEditorPlaceholder,
+ getMobileEditorTableMenuCopy,
getMobileEditorToolbarActionLabel,
getMobileEditorToolbarLabel,
isMobileEditorActionDisabledInTableHeader,
@@ -26,7 +27,7 @@ import {
type MobileEditorToolbarActionId,
} from "@edgeever/shared/mobile-editor";
import { useDOMImperativeHandle, type DOMImperativeFactory, type DOMProps } from "expo/dom";
-import { useCallback, useEffect, useMemo, useRef, type ReactNode, type Ref } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode, type Ref } from "react";
import {
createMobileImageUploadPlaceholderSource,
isMobileImageUploadPlaceholderSource,
@@ -67,6 +68,7 @@ const TRANSIENT_IMAGE_UPLOAD_META = "edgeeverImageUploadPlaceholder";
const ignoreSearchResult = async () => undefined;
export default function LocalTiptapEditor(props: LocalTiptapEditorProps) {
+ const [tableMenuOpen, setTableMenuOpen] = useState(false);
const startedAtRef = useRef(performance.now());
const changeTimerRef = useRef<number | null>(null);
const imageUploadInFlightRef = useRef(false);
@@ -260,6 +262,13 @@ export default function LocalTiptapEditor(props: LocalTiptapEditorProps) {
(activeEditor?.isActive("table") ? MOBILE_EDITOR_ACTIVE_FLAGS.table : 0) |
(activeEditor?.isActive("tableHeader") ? MOBILE_EDITOR_ACTIVE_FLAGS.tableHeader : 0),
});
+ const tableMenuCopy = getMobileEditorTableMenuCopy(props.locale);
+
+ useEffect(() => {
+ if (!(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table)) {
+ setTableMenuOpen(false);
+ }
+ }, [toolbarState]);
const insertImage = async () => {
if (!editor || imageUploadInFlightRef.current) {
@@ -319,12 +328,12 @@ export default function LocalTiptapEditor(props: LocalTiptapEditorProps) {
blockquote: <QuoteIcon />,
horizontalRule: <MinusIcon />,
insertTable: <TableGridIcon />,
- addTableRow: <TableActionGlyph label="R+" />,
- deleteTableRow: <TableActionGlyph label="R−" />,
- addTableColumn: <TableActionGlyph label="C+" />,
- deleteTableColumn: <TableActionGlyph label="C−" />,
- toggleTableHeader: <TableActionGlyph label="H" />,
- deleteTable: <TableActionGlyph label="×" />,
+ addTableRow: null,
+ deleteTableRow: null,
+ addTableColumn: null,
+ deleteTableColumn: null,
+ toggleTableHeader: null,
+ deleteTable: null,
};
const toolbarHandlers: Record<MobileEditorToolbarActionId, () => void> = {
image: () => void insertImage(),
@@ -346,23 +355,66 @@ export default function LocalTiptapEditor(props: LocalTiptapEditorProps) {
<style>{getEditorStyles(props.theme)}</style>
<div aria-label={getMobileEditorToolbarLabel(props.locale)} className="edgeever-editor-toolbar" role="toolbar">
{MOBILE_EDITOR_TOOLBAR_ACTIONS
- .filter((action) => toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table
- ? action.id !== "insertTable"
- : !action.requiresTable)
+ .filter((action) => !action.requiresTable
+ && (!(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table) || action.id !== "insertTable"))
.map((action) => (
- <ToolbarButton
- key={action.id}
- active={action.activeFlag > 0 && Boolean(toolbarState & action.activeFlag)}
- disabled={(action.requiresTable && !(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table))
- || (action.id === "insertTable" && Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table))
- || (isMobileEditorActionDisabledInTableHeader(action.id)
- && Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.tableHeader))}
- icon={toolbarIcons[action.id]}
- label={getMobileEditorToolbarActionLabel(action.id, props.locale)}
- onRun={toolbarHandlers[action.id]}
- />
+ <ToolbarButton
+ key={action.id}
+ active={action.activeFlag > 0 && Boolean(toolbarState & action.activeFlag)}
+ disabled={action.id === "insertTable" && Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table)}
+ icon={toolbarIcons[action.id]}
+ label={getMobileEditorToolbarActionLabel(action.id, props.locale)}
+ onRun={toolbarHandlers[action.id]}
+ />
))}
+ {Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table) && (
+ <button
+ aria-label={tableMenuCopy.title}
+ className="edgeever-table-menu-trigger"
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={() => setTableMenuOpen(true)}
+ type="button"
+ >
+ <TableGridIcon />
+ <span>{tableMenuCopy.title}</span>
+ </button>
+ )}
</div>
+ {Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.table) && tableMenuOpen && (
+ <div className="edgeever-table-menu-backdrop" role="presentation" onMouseDown={() => setTableMenuOpen(false)}>
+ <section
+ aria-label={tableMenuCopy.title}
+ aria-modal="true"
+ className="edgeever-table-menu-sheet"
+ role="dialog"
+ onMouseDown={(event) => event.stopPropagation()}
+ >
+ <div className="edgeever-table-menu-handle" aria-hidden="true" />
+ <div className="edgeever-table-menu-header">
+ <strong>{tableMenuCopy.title}</strong>
+ <button type="button" onClick={() => setTableMenuOpen(false)}>{tableMenuCopy.close}</button>
+ </div>
+ <div className="edgeever-table-menu-actions">
+ {MOBILE_EDITOR_TOOLBAR_ACTIONS.filter((action) => action.requiresTable).map((action) => (
+ <button
+ key={action.id}
+ className={action.id === "deleteTable" ? "is-destructive" : undefined}
+ disabled={isMobileEditorActionDisabledInTableHeader(action.id)
+ && Boolean(toolbarState & MOBILE_EDITOR_ACTIVE_FLAGS.tableHeader)}
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={() => {
+ setTableMenuOpen(false);
+ toolbarHandlers[action.id]();
+ }}
+ type="button"
+ >
+ {getMobileEditorToolbarActionLabel(action.id, props.locale)}
+ </button>
+ ))}
+ </div>
+ </section>
+ </div>
+ )}
<EditorContent editor={editor} />
</div>
);
@@ -469,10 +521,6 @@ const TableGridIcon = () => (
</EditorIcon>
);
-const TableActionGlyph = ({ label }: { label: string }) => (
- <span aria-hidden="true" className="edgeever-table-action-glyph">{label}</span>
-);
-
const mapImageSources = (doc: EditorDoc, mapSource: (source: string) => string): EditorDoc => {
const visit = (value: unknown): unknown => {
if (Array.isArray(value)) {
@@ -907,7 +955,18 @@ const getEditorStyles = (theme: "light" | "dark") => `
.edgeever-editor-toolbar button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 36px; min-height: 32px; padding: 0; border: 1px solid transparent; border-radius: 999px; background: transparent; color: ${theme === "dark" ? "#cbd5e1" : "#64748b"}; }
.edgeever-editor-toolbar button:active, .edgeever-editor-toolbar button.is-active { border-color: ${theme === "dark" ? "#166534" : "#bbf7d0"}; background: ${theme === "dark" ? "#14532d" : "#ecfdf5"}; color: ${theme === "dark" ? "#86efac" : "#047857"}; }
.edgeever-editor-toolbar button:disabled { opacity: 0.38; }
- .edgeever-table-action-glyph { font-size: 12px; font-weight: 800; letter-spacing: -0.03em; }
+ .edgeever-editor-toolbar .edgeever-table-menu-trigger { gap: 6px; width: auto; padding-inline: 10px; font-size: 13px; font-weight: 700; }
+ .edgeever-table-menu-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: ${theme === "dark" ? "rgba(2, 6, 23, 0.62)" : "rgba(15, 23, 42, 0.22)"}; }
+ .edgeever-table-menu-sheet { width: 100%; border-radius: 18px 18px 0 0; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); background: ${theme === "dark" ? "#1e293b" : "#fff"}; box-shadow: 0 -18px 45px rgba(15, 23, 42, 0.16); }
+ .edgeever-table-menu-handle { width: 38px; height: 4px; margin: 2px auto 8px; border-radius: 999px; background: #cbd5e1; }
+ .edgeever-table-menu-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid ${theme === "dark" ? "#334155" : "#f1f5f9"}; padding: 0 16px 10px; }
+ .edgeever-table-menu-header strong { color: ${theme === "dark" ? "#f8fafc" : "#0f172a"}; font-size: 16px; }
+ .edgeever-table-menu-header button { min-height: 32px; border: 0; border-radius: 999px; padding: 6px 10px; background: ${theme === "dark" ? "#334155" : "#f8fafc"}; color: ${theme === "dark" ? "#cbd5e1" : "#64748b"}; font: inherit; font-size: 14px; font-weight: 650; }
+ .edgeever-table-menu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
+ .edgeever-table-menu-actions button { min-height: 48px; border: 0; border-radius: 10px; padding: 8px; background: ${theme === "dark" ? "#334155" : "#f8fafc"}; color: ${theme === "dark" ? "#e2e8f0" : "#334155"}; font: inherit; font-size: 15px; font-weight: 650; }
+ .edgeever-table-menu-actions button:active { background: ${theme === "dark" ? "#14532d" : "#ecfdf5"}; color: ${theme === "dark" ? "#86efac" : "#047857"}; }
+ .edgeever-table-menu-actions button:disabled { color: #94a3b8; opacity: 0.55; }
+ .edgeever-table-menu-actions button.is-destructive { background: ${theme === "dark" ? "#4c0519" : "#fff1f2"}; color: ${theme === "dark" ? "#fda4af" : "#be123c"}; }
.tiptap { min-height: 100%; outline: none; }
.edgeever-editor-shell > div:last-child { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.edgeever-editor-content { min-height: 100%; padding: 18px 12px 32px; font-size: 17px; line-height: 1.7; word-break: break-word; caret-color: #0f766e; }
@@ -919,10 +978,10 @@ const getEditorStyles = (theme: "light" | "dark") => `
.edgeever-editor-content code { border-radius: 4px; padding: 2px 4px; background: ${theme === "dark" ? "#1e293b" : "#f1f5f9"}; }
.edgeever-editor-content pre code { padding: 0; background: transparent; }
.edgeever-editor-content img { display: block; max-width: 100%; height: auto; margin: 14px auto; border-radius: 10px; }
- .edgeever-editor-content .tableWrapper { width: fit-content; max-width: 100%; overflow-x: auto; margin-top: 20px; margin-right: auto; margin-bottom: 20px; margin-left: 0; border: 1px solid ${theme === "dark" ? "#334155" : "#d8d8d8"}; border-radius: 2px; background: ${theme === "dark" ? "#0f172a" : "#fff"}; overscroll-behavior-inline: contain; scrollbar-color: rgba(100, 116, 139, 0.28) transparent; }
- .edgeever-editor-content table { width: max-content; min-width: 42rem !important; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
- .edgeever-editor-content table col { width: 14rem !important; }
- .edgeever-editor-content th, .edgeever-editor-content td { position: relative; width: 14rem; min-width: 14rem; border: 0; border-right: 1px solid ${theme === "dark" ? "#334155" : "#dedede"}; border-bottom: 1px solid ${theme === "dark" ? "#334155" : "#dedede"}; padding: 7px 12px; text-align: left; vertical-align: top; overflow-wrap: anywhere; line-height: 1.4; transition: background-color 120ms ease; }
+ .edgeever-editor-content .tableWrapper { --mobile-table-column-width: clamp(5.5rem, calc((100vw - 3rem) / 3), 14rem); width: 100%; max-width: 100%; overflow-x: auto; margin-top: 20px; margin-right: auto; margin-bottom: 20px; margin-left: 0; border: 1px solid ${theme === "dark" ? "#334155" : "#d8d8d8"}; border-radius: 2px; background: ${theme === "dark" ? "#0f172a" : "#fff"}; overscroll-behavior-inline: contain; scrollbar-color: rgba(100, 116, 139, 0.28) transparent; }
+ .edgeever-editor-content table { width: max-content; min-width: 100% !important; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
+ .edgeever-editor-content table col { width: var(--mobile-table-column-width) !important; }
+ .edgeever-editor-content th, .edgeever-editor-content td { position: relative; width: var(--mobile-table-column-width); min-width: var(--mobile-table-column-width); border: 0; border-right: 1px solid ${theme === "dark" ? "#334155" : "#dedede"}; border-bottom: 1px solid ${theme === "dark" ? "#334155" : "#dedede"}; padding: 7px 12px; text-align: left; vertical-align: top; overflow-wrap: anywhere; line-height: 1.4; transition: background-color 120ms ease; }
.edgeever-editor-content th { background: ${theme === "dark" ? "#27303f" : "#f0f0f0"}; color: ${theme === "dark" ? "#f8fafc" : "#111827"}; font-size: 14px; font-weight: 700; }
.edgeever-editor-content th:last-child, .edgeever-editor-content td:last-child { border-right: 0; }
.edgeever-editor-content tr:last-child td { border-bottom: 0; }
diff --git a/apps/web/src/components/MobileStandaloneEditorParts.tsx b/apps/web/src/components/MobileStandaloneEditorParts.tsx
index 616c9bb0..8e8f8449 100644
--- a/apps/web/src/components/MobileStandaloneEditorParts.tsx
+++ b/apps/web/src/components/MobileStandaloneEditorParts.tsx
@@ -1,12 +1,13 @@
-import { Bold, Check, ChevronDown, ImagePlus, List, Minus, Quote } from "lucide-react";
+import { Bold, Check, ChevronDown, ImagePlus, List, Minus, Quote, Table2 } from "lucide-react";
import {
MOBILE_EDITOR_TOOLBAR_ACTIONS,
+ getMobileEditorTableMenuCopy,
getMobileEditorToolbarActionLabel,
isMobileEditorActionDisabledInTableHeader,
type MobileEditorTableActionId,
type MobileEditorToolbarActionId,
} from "@edgeever/shared/mobile-editor";
-import type { ReactNode } from "react";
+import { useEffect, useState, type ReactNode } from "react";
import type { NotebookMoveOption } from "@/lib/app-helpers";
import type { MobileEditorSaveState } from "@/lib/mobile-editor-standalone";
@@ -61,19 +62,21 @@ export const MobileEditorToolbar = ({
onSetHorizontalRule: () => void;
onTableAction: (action: MobileEditorTableActionId) => void;
}) => {
+ const [tableMenuOpen, setTableMenuOpen] = useState(false);
+ const tableMenuCopy = getMobileEditorTableMenuCopy("zh-CN");
const icons: Record<MobileEditorToolbarActionId, ReactNode> = {
image: <ImagePlus aria-hidden="true" size={18} strokeWidth={2} />,
bold: <Bold aria-hidden="true" size={17} strokeWidth={2.4} />,
bulletList: <List aria-hidden="true" size={18} strokeWidth={2.2} />,
blockquote: <Quote aria-hidden="true" size={17} strokeWidth={2.2} />,
horizontalRule: <Minus aria-hidden="true" size={18} strokeWidth={2.4} />,
- insertTable: <TableActionGlyph label="T" />,
- addTableRow: <TableActionGlyph label="R+" />,
- deleteTableRow: <TableActionGlyph label="R−" />,
- addTableColumn: <TableActionGlyph label="C+" />,
- deleteTableColumn: <TableActionGlyph label="C−" />,
- toggleTableHeader: <TableActionGlyph label="H" />,
- deleteTable: <TableActionGlyph label="×" />,
+ insertTable: <Table2 aria-hidden="true" size={18} strokeWidth={2} />,
+ addTableRow: null,
+ deleteTableRow: null,
+ addTableColumn: null,
+ deleteTableColumn: null,
+ toggleTableHeader: null,
+ deleteTable: null,
};
const handlers: Record<MobileEditorToolbarActionId, () => void> = {
image: onPickImage,
@@ -95,40 +98,92 @@ export const MobileEditorToolbar = ({
blockquote: blockquoteActive,
};
+ useEffect(() => {
+ if (!tableActive) {
+ setTableMenuOpen(false);
+ }
+ }, [tableActive]);
+
return (
- <div className="mobile-editor-tool-row">
- {MOBILE_EDITOR_TOOLBAR_ACTIONS
- .filter(({ id, requiresTable }) => tableActive ? id !== "insertTable" : !requiresTable)
- .map(({ id, requiresTable }) => {
- const label = getMobileEditorToolbarActionLabel(id, "zh-CN");
+ <>
+ <div className="mobile-editor-tool-row">
+ {MOBILE_EDITOR_TOOLBAR_ACTIONS
+ .filter(({ id, requiresTable }) => !requiresTable && (!tableActive || id !== "insertTable"))
+ .map(({ id }) => {
+ const label = getMobileEditorToolbarActionLabel(id, "zh-CN");
- return (
+ return (
+ <button
+ key={id}
+ className="mobile-editor-tool-button"
+ type="button"
+ aria-label={label}
+ title={label}
+ aria-pressed={activeStates[id]}
+ disabled={disabled || (id === "insertTable" && tableActive)}
+ onPointerDown={(event) => event.preventDefault()}
+ onClick={handlers[id]}
+ >
+ {icons[id]}
+ </button>
+ );
+ })}
+ {tableActive && (
<button
- key={id}
- className="mobile-editor-tool-button"
+ className="mobile-editor-tool-button mobile-editor-table-menu-trigger"
type="button"
- aria-label={label}
- title={label}
- aria-pressed={activeStates[id]}
- disabled={disabled
- || (requiresTable && !tableActive)
- || (id === "insertTable" && tableActive)
- || (isMobileEditorActionDisabledInTableHeader(id) && tableHeaderActive)}
+ aria-label={tableMenuCopy.title}
+ title={tableMenuCopy.title}
+ disabled={disabled}
onPointerDown={(event) => event.preventDefault()}
- onClick={handlers[id]}
+ onClick={() => setTableMenuOpen(true)}
>
- {icons[id]}
+ <Table2 aria-hidden="true" size={18} strokeWidth={2} />
+ <span>{tableMenuCopy.title}</span>
</button>
- );
- })}
- </div>
+ )}
+ </div>
+ {tableActive && tableMenuOpen && (
+ <div className="mobile-editor-sheet-backdrop" role="presentation" onClick={() => setTableMenuOpen(false)}>
+ <section
+ className="mobile-editor-table-sheet"
+ role="dialog"
+ aria-modal="true"
+ aria-label={tableMenuCopy.title}
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div className="mobile-editor-notebook-sheet-handle" aria-hidden="true" />
+ <div className="mobile-editor-notebook-sheet-header">
+ <h2>{tableMenuCopy.title}</h2>
+ <button type="button" onClick={() => setTableMenuOpen(false)}>{tableMenuCopy.close}</button>
+ </div>
+ <div className="mobile-editor-table-action-list">
+ {MOBILE_EDITOR_TOOLBAR_ACTIONS.filter(({ requiresTable }) => requiresTable).map(({ id }) => {
+ const label = getMobileEditorToolbarActionLabel(id, "zh-CN");
+ return (
+ <button
+ key={id}
+ className={id === "deleteTable" ? "is-destructive" : undefined}
+ type="button"
+ disabled={disabled || (isMobileEditorActionDisabledInTableHeader(id) && tableHeaderActive)}
+ onPointerDown={(event) => event.preventDefault()}
+ onClick={() => {
+ setTableMenuOpen(false);
+ handlers[id]();
+ }}
+ >
+ {label}
+ </button>
+ );
+ })}
+ </div>
+ </section>
+ </div>
+ )}
+ </>
);
};
-const TableActionGlyph = ({ label }: { label: string }) => (
- <span aria-hidden="true" className="mobile-editor-table-glyph">{label}</span>
-);
-
export const MobileEditorNotebookButton = ({
label,
disabled,
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 016eefed..9a7be2b1 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -610,6 +610,32 @@ textarea {
background: #f3f4f6;
}
+@media (max-width: 767px) {
+ .ProseMirror .tableWrapper,
+ .markdown-content .tableWrapper {
+ --mobile-table-column-width: clamp(5.5rem, calc((100vw - 3rem) / 3), 14rem);
+ width: 100%;
+ }
+
+ .ProseMirror table,
+ .markdown-content table {
+ min-width: 100% !important;
+ }
+
+ .ProseMirror table col,
+ .markdown-content table col {
+ width: var(--mobile-table-column-width) !important;
+ }
+
+ .ProseMirror th,
+ .ProseMirror td,
+ .markdown-content th,
+ .markdown-content td {
+ width: var(--mobile-table-column-width);
+ min-width: var(--mobile-table-column-width);
+ }
+}
+
.ProseMirror th p,
.ProseMirror td p,
.markdown-content th p,
diff --git a/apps/web/src/styles/mobile-markdown-editor.css b/apps/web/src/styles/mobile-markdown-editor.css
index 0ced2679..1221500b 100644
--- a/apps/web/src/styles/mobile-markdown-editor.css
+++ b/apps/web/src/styles/mobile-markdown-editor.css
@@ -237,10 +237,12 @@ input {
color: #334155;
}
-.mobile-editor-table-glyph {
- font-size: 12px;
- font-weight: 800;
- letter-spacing: -0.03em;
+.mobile-editor-table-menu-trigger {
+ gap: 6px;
+ width: auto;
+ padding-inline: 10px;
+ font-size: 13px;
+ font-weight: 700;
}
.mobile-editor-sheet-backdrop {
@@ -252,7 +254,8 @@ input {
background: rgb(15 23 42 / 0.22);
}
-.mobile-editor-notebook-sheet {
+.mobile-editor-notebook-sheet,
+.mobile-editor-table-sheet {
width: 100%;
max-height: 68dvh;
overflow: hidden;
@@ -275,7 +278,8 @@ input {
:root.dark .mobile-editor-header,
:root.dark .mobile-editor-title,
:root.dark .mobile-editor-tags,
-:root.dark .mobile-editor-notebook-sheet {
+:root.dark .mobile-editor-notebook-sheet,
+:root.dark .mobile-editor-table-sheet {
background: #1e293b;
color: #f8fafc;
}
@@ -388,6 +392,48 @@ input {
color: #047857;
}
+.mobile-editor-table-action-list {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 8px;
+ padding: 12px;
+}
+
+.mobile-editor-table-action-list button {
+ min-height: 48px;
+ border: 0;
+ border-radius: 10px;
+ background: #f8fafc;
+ color: #334155;
+ font-size: 15px;
+ font-weight: 650;
+}
+
+.mobile-editor-table-action-list button:active {
+ background: #ecfdf5;
+ color: #047857;
+}
+
+.mobile-editor-table-action-list button:disabled {
+ color: #94a3b8;
+ opacity: 0.55;
+}
+
+.mobile-editor-table-action-list button.is-destructive {
+ background: #fff1f2;
+ color: #be123c;
+}
+
+:root.dark .mobile-editor-table-action-list button {
+ background: #334155;
+ color: #e2e8f0;
+}
+
+:root.dark .mobile-editor-table-action-list button.is-destructive {
+ background: #4c0519;
+ color: #fda4af;
+}
+
.mobile-editor-notebook-option:active {
background: #f1f5f9;
}
@@ -455,7 +501,8 @@ input {
}
.edgeever-mobile-tiptap-content .tableWrapper {
- width: fit-content;
+ --mobile-table-column-width: clamp(5.5rem, calc((100vw - 3rem) / 3), 14rem);
+ width: 100%;
max-width: 100%;
overflow-x: auto;
margin-top: 1.25rem;
@@ -471,21 +518,21 @@ input {
.edgeever-mobile-tiptap-content table {
width: max-content;
- min-width: 42rem !important;
+ min-width: 100% !important;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
}
.edgeever-mobile-tiptap-content table col {
- width: 14rem !important;
+ width: var(--mobile-table-column-width) !important;
}
.edgeever-mobile-tiptap-content th,
.edgeever-mobile-tiptap-content td {
position: relative;
- width: 14rem;
- min-width: 14rem;
+ width: var(--mobile-table-column-width);
+ min-width: var(--mobile-table-column-width);
border: 0;
border-right: 1px solid #dedede;
border-bottom: 1px solid #dedede;
diff --git a/packages/shared/src/mobile-editor.test.mjs b/packages/shared/src/mobile-editor.test.mjs
index 2c0b7632..a37f4002 100644
--- a/packages/shared/src/mobile-editor.test.mjs
+++ b/packages/shared/src/mobile-editor.test.mjs
@@ -6,6 +6,7 @@ import {
getMobileEditorImageScaleLabel,
getMobileEditorImageWidthPresetLabel,
getMobileEditorPlaceholder,
+ getMobileEditorTableMenuCopy,
getMobileEditorToolbarActionLabel,
getMobileEditorToolbarLabel,
isMobileEditorActionDisabledInTableHeader,
@@ -39,6 +40,8 @@ describe("mobile editor contract", () => {
expect(getMobileEditorPlaceholder("zh-CN")).toBe("开始记录...");
expect(getMobileEditorPlaceholder("en-US")).toBe("Start writing...");
expect(getMobileEditorToolbarLabel("zh-CN")).toBe("编辑器工具栏");
+ expect(getMobileEditorTableMenuCopy("zh-CN")).toEqual({ title: "表格操作", close: "关闭" });
+ expect(getMobileEditorTableMenuCopy("en-US")).toEqual({ title: "Table actions", close: "Close" });
expect(getMobileEditorToolbarActionLabel("bulletList", "en-US")).toBe("Bullet list");
expect(getMobileEditorToolbarActionLabel("insertTable", "zh-CN")).toBe("插入表格");
expect(getMobileEditorImageScaleLabel("zh-CN")).toBe("图片显示尺寸");
diff --git a/packages/shared/src/mobile-editor.ts b/packages/shared/src/mobile-editor.ts
index 202f1c4e..e607d61b 100644
--- a/packages/shared/src/mobile-editor.ts
+++ b/packages/shared/src/mobile-editor.ts
@@ -54,6 +54,10 @@ const MOBILE_EDITOR_COPY = {
"zh-CN": {
placeholder: "开始记录...",
toolbar: "编辑器工具栏",
+ tableMenu: {
+ title: "表格操作",
+ close: "关闭",
+ },
actions: {
image: "上传图片",
bold: "加粗",
@@ -79,6 +83,10 @@ const MOBILE_EDITOR_COPY = {
"en-US": {
placeholder: "Start writing...",
toolbar: "Editor toolbar",
+ tableMenu: {
+ title: "Table actions",
+ close: "Close",
+ },
actions: {
image: "Upload image",
bold: "Bold",
@@ -109,6 +117,9 @@ export const getMobileEditorPlaceholder = (locale: MobileEditorLocale): string =
export const getMobileEditorToolbarLabel = (locale: MobileEditorLocale): string =>
MOBILE_EDITOR_COPY[locale].toolbar;
+export const getMobileEditorTableMenuCopy = (locale: MobileEditorLocale) =>
+ MOBILE_EDITOR_COPY[locale].tableMenu;
+
export const getMobileEditorToolbarActionLabel = (
action: MobileEditorToolbarActionId,
locale: MobileEditorLocale