smartrte-react 0.3.2 → 0.3.4
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.
- package/CHANGELOG.md +12 -0
- package/dist/components/ClassicEditor.js +79 -41
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +22 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
- Make foreground and background colours deterministic across paragraphs, lists, and table-cell text selections.
|
|
6
|
+
- Preserve foreground colour when highlighting text and render authored colours correctly in dark mode.
|
|
7
|
+
- Show the effective foreground and background colours at the caret in the toolbar and picker.
|
|
8
|
+
- Keep the table-cell fill picker and context menu open during live colour dragging, including multi-cell selections.
|
|
9
|
+
|
|
10
|
+
## 0.3.3
|
|
11
|
+
|
|
12
|
+
- Keep the responsive More-actions menu inside narrow viewports and above the editor canvas.
|
|
13
|
+
- Make long mobile action menus independently scrollable with touch-friendly overscroll behavior.
|
|
14
|
+
|
|
3
15
|
## 0.3.2
|
|
4
16
|
|
|
5
17
|
- Preserve paragraph and heading blocks when creating, restyling, or removing lists.
|
|
@@ -121,6 +121,7 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
121
121
|
const [formulaInput, setFormulaInput] = useState("E=mc^2");
|
|
122
122
|
const [tableMenu, setTableMenu] = useState(null);
|
|
123
123
|
const selectionRef = useRef(null);
|
|
124
|
+
const tableFillTargetsRef = useRef(null);
|
|
124
125
|
const selectingRef = useRef(null);
|
|
125
126
|
const [imageMenu, setImageMenu] = useState(null);
|
|
126
127
|
const [linkMenu, setLinkMenu] = useState(null);
|
|
@@ -140,6 +141,8 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
140
141
|
const [currentFont, setCurrentFont] = useState("");
|
|
141
142
|
const [currentBlockType, setCurrentBlockType] = useState("p");
|
|
142
143
|
const [currentAlignment, setCurrentAlignment] = useState("left");
|
|
144
|
+
const [currentTextColor, setCurrentTextColor] = useState("#000000");
|
|
145
|
+
const [currentBackgroundColor, setCurrentBackgroundColor] = useState("#ffffff");
|
|
143
146
|
const [activeState, setActiveState] = useState({
|
|
144
147
|
bold: false,
|
|
145
148
|
italic: false,
|
|
@@ -312,6 +315,9 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
312
315
|
setCurrentBlockType(/^h[1-6]$/.test(tag || "") ? tag : "p");
|
|
313
316
|
}
|
|
314
317
|
setCurrentFontSize(resolveFontSizeForRange(range));
|
|
318
|
+
const colorTarget = getRangeStartElement(range) || editor;
|
|
319
|
+
setCurrentTextColor(cssColorToHex(window.getComputedStyle(colorTarget).color) || "#000000");
|
|
320
|
+
setCurrentBackgroundColor(getEffectiveBackgroundHex(colorTarget) || "#ffffff");
|
|
315
321
|
const alignmentTargets = getAlignmentTargets(range);
|
|
316
322
|
const alignments = new Set(alignmentTargets.map(readTextAlignment));
|
|
317
323
|
setCurrentAlignment(alignments.size > 1 ? "mixed" : Array.from(alignments)[0] || "left");
|
|
@@ -2457,9 +2463,6 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2457
2463
|
console.error('Error applying font family:', error);
|
|
2458
2464
|
}
|
|
2459
2465
|
};
|
|
2460
|
-
const applyTextColor = (color) => {
|
|
2461
|
-
exec("foreColor", color);
|
|
2462
|
-
};
|
|
2463
2466
|
const parseCssColor = (value) => {
|
|
2464
2467
|
const normalized = value.trim().toLowerCase();
|
|
2465
2468
|
if (!normalized || normalized === "transparent")
|
|
@@ -2508,13 +2511,20 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2508
2511
|
node = node.parentElement;
|
|
2509
2512
|
return node instanceof HTMLElement && editor.contains(node) ? node : null;
|
|
2510
2513
|
};
|
|
2511
|
-
const
|
|
2514
|
+
const getEffectiveBackgroundHex = (element) => {
|
|
2512
2515
|
const editor = editableRef.current;
|
|
2513
2516
|
let current = element;
|
|
2514
|
-
while (current
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
return
|
|
2517
|
+
while (current) {
|
|
2518
|
+
const inline = cssColorToHex(current.style.backgroundColor || current.style.background);
|
|
2519
|
+
if (inline)
|
|
2520
|
+
return inline;
|
|
2521
|
+
const computed = typeof window !== "undefined"
|
|
2522
|
+
? cssColorToHex(window.getComputedStyle(current).backgroundColor)
|
|
2523
|
+
: "";
|
|
2524
|
+
if (computed)
|
|
2525
|
+
return computed;
|
|
2526
|
+
if (current === editor)
|
|
2527
|
+
break;
|
|
2518
2528
|
current = current.parentElement;
|
|
2519
2529
|
}
|
|
2520
2530
|
return "";
|
|
@@ -2525,9 +2535,9 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2525
2535
|
const editor = editableRef.current;
|
|
2526
2536
|
if (!editor)
|
|
2527
2537
|
return colorPickerType === "text" ? "#000000" : "#ffffff";
|
|
2528
|
-
const element = getRangeStartElement(getSelectionRangeInEditor());
|
|
2538
|
+
const element = getRangeStartElement(getSelectionRangeInEditor() || savedRangeRef.current);
|
|
2529
2539
|
if (colorPickerType === "background") {
|
|
2530
|
-
return
|
|
2540
|
+
return getEffectiveBackgroundHex(element) || "#ffffff";
|
|
2531
2541
|
}
|
|
2532
2542
|
const target = element || editor;
|
|
2533
2543
|
return cssColorToHex(window.getComputedStyle(target).color) || "#000000";
|
|
@@ -2556,7 +2566,7 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2556
2566
|
}))
|
|
2557
2567
|
.sort((a, b) => b.ratio - a.ratio)[0]?.color || "";
|
|
2558
2568
|
};
|
|
2559
|
-
const
|
|
2569
|
+
const applyInlineColor = (type, color) => {
|
|
2560
2570
|
try {
|
|
2561
2571
|
const editor = editableRef.current;
|
|
2562
2572
|
if (!editor)
|
|
@@ -2564,13 +2574,14 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2564
2574
|
if (!restoreSavedSelection())
|
|
2565
2575
|
safeSelectRange(getSelectionRangeInEditor());
|
|
2566
2576
|
const range = getSelectionRangeInEditor();
|
|
2567
|
-
const readableColor = readableTextColorForBackground(color);
|
|
2568
2577
|
if (!range)
|
|
2569
2578
|
return;
|
|
2579
|
+
pushEditorHistory();
|
|
2570
2580
|
const applyToElement = (element) => {
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2581
|
+
if (type === "text")
|
|
2582
|
+
element.style.color = color;
|
|
2583
|
+
else
|
|
2584
|
+
element.style.backgroundColor = color;
|
|
2574
2585
|
};
|
|
2575
2586
|
if (range.collapsed) {
|
|
2576
2587
|
const span = document.createElement("span");
|
|
@@ -2585,34 +2596,46 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
2585
2596
|
handleInput();
|
|
2586
2597
|
return;
|
|
2587
2598
|
}
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2599
|
+
const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT);
|
|
2600
|
+
const selected = [];
|
|
2601
|
+
let current = walker.nextNode();
|
|
2602
|
+
while (current) {
|
|
2603
|
+
const node = current;
|
|
2604
|
+
if (node.data && range.intersectsNode(node)) {
|
|
2605
|
+
const start = node === range.startContainer ? range.startOffset : 0;
|
|
2606
|
+
const end = node === range.endContainer ? range.endOffset : node.data.length;
|
|
2607
|
+
if (end > start)
|
|
2608
|
+
selected.push({ node, start, end });
|
|
2595
2609
|
}
|
|
2610
|
+
current = walker.nextNode();
|
|
2611
|
+
}
|
|
2612
|
+
const styledRuns = [];
|
|
2613
|
+
[...selected].reverse().forEach(({ node, start, end }) => {
|
|
2614
|
+
const runRange = document.createRange();
|
|
2615
|
+
runRange.setStart(node, start);
|
|
2616
|
+
runRange.setEnd(node, end);
|
|
2617
|
+
const span = document.createElement("span");
|
|
2618
|
+
applyToElement(span);
|
|
2619
|
+
span.appendChild(runRange.extractContents());
|
|
2620
|
+
runRange.insertNode(span);
|
|
2621
|
+
styledRuns.unshift(span);
|
|
2596
2622
|
});
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2623
|
+
if (styledRuns.length) {
|
|
2624
|
+
const nextRange = document.createRange();
|
|
2625
|
+
nextRange.setStart(styledRuns[0], 0);
|
|
2626
|
+
nextRange.setEnd(styledRuns[styledRuns.length - 1], styledRuns[styledRuns.length - 1].childNodes.length);
|
|
2627
|
+
safeSelectRange(nextRange);
|
|
2628
|
+
savedRangeRef.current = nextRange.cloneRange();
|
|
2601
2629
|
}
|
|
2602
|
-
const span = document.createElement("span");
|
|
2603
|
-
applyToElement(span);
|
|
2604
|
-
const fragment = range.extractContents();
|
|
2605
|
-
span.appendChild(fragment);
|
|
2606
|
-
range.insertNode(span);
|
|
2607
|
-
range.selectNodeContents(span);
|
|
2608
|
-
safeSelectRange(range);
|
|
2609
|
-
savedRangeRef.current = range.cloneRange();
|
|
2610
2630
|
handleInput();
|
|
2631
|
+
requestAnimationFrame(updateActiveState);
|
|
2611
2632
|
}
|
|
2612
2633
|
catch {
|
|
2613
|
-
exec("hiliteColor", color);
|
|
2634
|
+
exec(type === "text" ? "foreColor" : "hiliteColor", color);
|
|
2614
2635
|
}
|
|
2615
2636
|
};
|
|
2637
|
+
const applyTextColor = (color) => applyInlineColor("text", color);
|
|
2638
|
+
const applyBackgroundColor = (color) => applyInlineColor("background", color);
|
|
2616
2639
|
const insertImage = () => {
|
|
2617
2640
|
if (!media)
|
|
2618
2641
|
return;
|
|
@@ -4514,13 +4537,17 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
4514
4537
|
}
|
|
4515
4538
|
handleInput();
|
|
4516
4539
|
};
|
|
4517
|
-
const applyBgToSelection = (hex, fallbackCell) => {
|
|
4540
|
+
const applyBgToSelection = (hex, fallbackCell, explicitCells) => {
|
|
4518
4541
|
const readableColor = readableTextColorForBackground(hex);
|
|
4519
4542
|
const applyFill = (cell) => {
|
|
4520
4543
|
cell.style.background = hex;
|
|
4521
4544
|
if (readableColor)
|
|
4522
4545
|
cell.style.color = readableColor;
|
|
4523
4546
|
};
|
|
4547
|
+
if (explicitCells?.length) {
|
|
4548
|
+
explicitCells.forEach(applyFill);
|
|
4549
|
+
return;
|
|
4550
|
+
}
|
|
4524
4551
|
const sel = shouldUseTableSelection(fallbackCell) ? selectionRef.current : null;
|
|
4525
4552
|
if (sel) {
|
|
4526
4553
|
const cells = getCellsInGridRect(sel.tbody, sel.sr, sel.sc, sel.er, sel.ec);
|
|
@@ -5288,7 +5315,7 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
5288
5315
|
background: "var(--srte-input-bg)",
|
|
5289
5316
|
color: "var(--srte-input-text)",
|
|
5290
5317
|
maxWidth: 100,
|
|
5291
|
-
}, children: [_jsx("option", { value: "", disabled: true, children: "Font" }), fonts.map((f) => (_jsx("option", { value: f.value, children: f.name }, f.value)))] })), _jsx("button", { type: "button", className: "srte-tool-button", "aria-label": "Text color", title: "Text Color", onClick: () => {
|
|
5318
|
+
}, children: [_jsx("option", { value: "", disabled: true, children: "Font" }), fonts.map((f) => (_jsx("option", { value: f.value, children: f.name }, f.value)))] })), _jsx("button", { type: "button", className: "srte-tool-button", "aria-label": "Text color", title: "Text Color", onMouseDown: preserveEditorSelection, onClick: () => {
|
|
5292
5319
|
setColorPickerType('text');
|
|
5293
5320
|
setShowColorPicker(true);
|
|
5294
5321
|
}, style: {
|
|
@@ -5300,7 +5327,7 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
5300
5327
|
background: "var(--srte-input-bg)",
|
|
5301
5328
|
color: "var(--srte-input-text)",
|
|
5302
5329
|
position: "relative",
|
|
5303
|
-
}, children: _jsx("span", { style: { fontWeight: 700, borderBottom:
|
|
5330
|
+
}, children: _jsx("span", { style: { fontWeight: 700, borderBottom: `3px solid ${currentTextColor}`, lineHeight: 1 }, children: "A" }) }), _jsx("button", { type: "button", className: "srte-tool-button", "aria-label": "Background color", title: "Background Color", onMouseDown: preserveEditorSelection, onClick: () => {
|
|
5304
5331
|
setColorPickerType('background');
|
|
5305
5332
|
setShowColorPicker(true);
|
|
5306
5333
|
}, style: {
|
|
@@ -5311,7 +5338,7 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
5311
5338
|
borderRadius: 6,
|
|
5312
5339
|
background: "var(--srte-input-bg)",
|
|
5313
5340
|
color: "var(--srte-input-text)",
|
|
5314
|
-
}, children: _jsx("span", { style: { fontWeight: 700, padding: "1px 4px", background:
|
|
5341
|
+
}, children: _jsx("span", { style: { fontWeight: 700, padding: "1px 4px", background: currentBackgroundColor, color: readableTextColorForBackground(currentBackgroundColor) || "currentColor", borderRadius: 3 }, children: "A" }) }), _jsxs("button", { type: "button", className: `srte-tool-button${activeState.subscript ? " srte-active" : ""}`, title: "Subscript", onMouseDown: preserveEditorSelection, onClick: () => toggleInlineScript("subscript"), "aria-pressed": activeState.subscript, style: activeButtonStyle(activeState.subscript), children: ["X", _jsx("sub", { children: "2" })] }), _jsxs("button", { type: "button", className: `srte-tool-button${activeState.superscript ? " srte-active" : ""}`, title: "Superscript", onMouseDown: preserveEditorSelection, onClick: () => toggleInlineScript("superscript"), "aria-pressed": activeState.superscript, style: activeButtonStyle(activeState.superscript), children: ["X", _jsx("sup", { children: "2" })] }), [
|
|
5315
5342
|
{
|
|
5316
5343
|
key: "check",
|
|
5317
5344
|
icon: "checklist",
|
|
@@ -6258,8 +6285,19 @@ export function ClassicEditor({ value, onChange, placeholder = "Type here…", m
|
|
|
6258
6285
|
alignItems: "center",
|
|
6259
6286
|
padding: "4px 6px",
|
|
6260
6287
|
fontSize: 12,
|
|
6261
|
-
}, children: [_jsx("span", { children: "Fill:" }), _jsx("input", { type: "color", value: tableMenuFillHex(tableMenu.cell),
|
|
6262
|
-
|
|
6288
|
+
}, children: [_jsx("span", { children: "Fill:" }), _jsx("input", { type: "color", value: tableMenuFillHex(tableMenu.cell), onPointerDown: () => {
|
|
6289
|
+
const selection = shouldUseTableSelection(tableMenu.cell) ? selectionRef.current : null;
|
|
6290
|
+
tableFillTargetsRef.current = selection
|
|
6291
|
+
? getCellsInGridRect(selection.tbody, selection.sr, selection.sc, selection.er, selection.ec)
|
|
6292
|
+
: [tableMenu.cell];
|
|
6293
|
+
pushEditorHistory();
|
|
6294
|
+
clearSelectionDecor();
|
|
6295
|
+
}, onClick: (e) => e.stopPropagation(), onInput: (e) => {
|
|
6296
|
+
applyBgToSelection(e.currentTarget.value, tableMenu.cell, tableFillTargetsRef.current);
|
|
6297
|
+
handleInput();
|
|
6298
|
+
}, onChange: (e) => {
|
|
6299
|
+
applyBgToSelection(e.currentTarget.value, tableMenu.cell, tableFillTargetsRef.current);
|
|
6300
|
+
handleInput();
|
|
6263
6301
|
}, style: {
|
|
6264
6302
|
width: 28,
|
|
6265
6303
|
height: 18,
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type SrteTheme = 'light' | 'dark';
|
|
2
|
-
export declare const SRTE_DEFAULT_CSS = "\n.srte-editor {\n --srte-background: var(--card, #ffffff);\n --srte-canvas: var(--background, #ffffff);\n --srte-foreground: var(--foreground, #0f172a);\n --srte-muted: var(--muted, #f1f5f9);\n --srte-muted-foreground: var(--muted-foreground, #64748b);\n --srte-ring: var(--ring, #0284c7);\n --srte-radius: var(--radius, 0.625rem);\n --srte-bg: var(--srte-canvas);\n --srte-text: var(--srte-foreground);\n --srte-text-muted: var(--srte-muted-foreground);\n --srte-border: var(--border, #e2e8f0);\n --srte-border-light: var(--srte-border);\n --srte-toolbar-bg: var(--srte-background);\n --srte-input-bg: var(--srte-background);\n --srte-input-text: var(--srte-foreground);\n --srte-input-border: var(--srte-border);\n --srte-modal-backdrop: rgba(0, 0, 0, 0.35);\n --srte-modal-backdrop-filter: blur(2px);\n --srte-modal-bg: #ffffff;\n --srte-modal-text: #000000;\n --srte-menu-bg: var(--srte-background);\n --srte-menu-text: var(--srte-foreground);\n --srte-menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);\n --srte-accent: #0284c7;\n --srte-accent-bg: rgba(2, 132, 199, 0.12);\n --srte-danger: #dc2626;\n --srte-primary: #2563eb;\n --srte-surface-subtle: #f3f4f6;\n --srte-on-primary: #ffffff;\n --srte-cancel-bg: #f3f4f6;\n --srte-code-bg: #f6f8fa;\n --srte-code-text: #24292f;\n}\n.srte-editor.srte-dark {\n --srte-background: var(--card, #1e293b);\n --srte-canvas: var(--background, #0f172a);\n --srte-foreground: var(--foreground, #f8fafc);\n --srte-muted: var(--muted, #334155);\n --srte-muted-foreground: var(--muted-foreground, #94a3b8);\n --srte-ring: var(--ring, #38bdf8);\n --srte-bg: var(--srte-canvas);\n --srte-text: var(--srte-foreground);\n --srte-text-muted: var(--srte-muted-foreground);\n --srte-border: var(--border, #334155);\n --srte-border-light: var(--srte-border);\n --srte-toolbar-bg: var(--srte-background);\n --srte-input-bg: var(--srte-background);\n --srte-input-text: var(--srte-foreground);\n --srte-input-border: var(--srte-border);\n --srte-modal-backdrop: rgba(0, 0, 0, 0.22);\n --srte-modal-backdrop-filter: blur(10px) saturate(0.9);\n --srte-modal-bg: #1e293b;\n --srte-modal-text: #e0e0e0;\n --srte-menu-bg: var(--srte-background);\n --srte-menu-text: var(--srte-foreground);\n --srte-menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);\n --srte-accent: #38bdf8;\n --srte-accent-bg: rgba(56, 189, 248, 0.16);\n --srte-danger: #ef4444;\n --srte-primary: #3b82f6;\n --srte-surface-subtle: #333333;\n --srte-on-primary: #ffffff;\n --srte-cancel-bg: #333333;\n --srte-code-bg: #111827;\n --srte-code-text: #e5e7eb;\n}\n.srte-editor {\n border-radius: var(--srte-radius);\n font-family: \"IBM Plex Sans\", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n container: srte-editor / inline-size;\n}\n.srte-toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px;\n width: 100%;\n min-height: 48px;\n padding: 8px;\n box-sizing: border-box;\n border-bottom: 1px solid var(--srte-border);\n background: var(--srte-background);\n color: var(--srte-foreground);\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.srte-toolbar-group {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n min-width: 0;\n}\n.srte-toolbar-group + .srte-toolbar-group::before {\n content: \"\";\n width: 1px;\n height: 20px;\n margin: 0 5px 0 3px;\n background: var(--srte-border);\n}\n.srte-tool-button,\n.srte-toolbar select {\n height: 32px;\n min-width: 32px;\n box-sizing: border-box;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--srte-foreground);\n font: 500 13px/1 \"IBM Plex Sans\", ui-sans-serif, system-ui, sans-serif;\n}\n.srte-tool-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n padding: 0 7px;\n cursor: pointer;\n}\n.srte-toolbar select {\n max-width: 132px;\n padding: 0 26px 0 9px;\n border-color: var(--srte-border);\n background: var(--srte-input-bg);\n cursor: pointer;\n}\n.srte-tool-button:hover,\n.srte-toolbar select:hover,\n.srte-toolbar-menu[open] > .srte-menu-trigger {\n background: var(--srte-muted);\n border-color: var(--srte-border);\n}\n.srte-tool-button.srte-active,\n.srte-tool-button[aria-pressed=\"true\"] {\n color: var(--srte-primary);\n background: var(--srte-accent-bg);\n border-color: color-mix(in srgb, var(--srte-primary) 35%, transparent);\n}\n.srte-tool-button:focus-visible,\n.srte-toolbar select:focus-visible,\n.srte-menu-item:focus-visible {\n outline: 2px solid var(--srte-ring);\n outline-offset: 1px;\n}\n.srte-tool-button:disabled,\n.srte-menu-item:disabled,\n.srte-toolbar select:disabled {\n cursor: not-allowed;\n opacity: .4;\n}\n.srte-toolbar-menu {\n position: relative;\n}\n.srte-toolbar-menu > summary {\n list-style: none;\n}\n.srte-toolbar-menu > summary::-webkit-details-marker {\n display: none;\n}\n.srte-menu {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 80;\n min-width: 210px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid var(--srte-border);\n border-radius: 12px;\n background: var(--srte-menu-bg);\n color: var(--srte-menu-text);\n box-shadow: var(--srte-menu-shadow);\n}\n.srte-menu-item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n height: 36px;\n padding: 0 8px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: 500 13px/1 \"IBM Plex Sans\", ui-sans-serif, system-ui, sans-serif;\n text-align: left;\n white-space: nowrap;\n}\n.srte-menu-item:hover {\n background: var(--srte-muted);\n}\n.srte-menu-check {\n margin-left: auto;\n color: var(--srte-primary);\n font-weight: 700;\n}\n.srte-menu-separator {\n height: 1px;\n margin: 4px;\n background: var(--srte-border);\n}\n.srte-mobile-more { display: none; }\n.srte-toolbar .srte-command-proxy { display: none; }\n.srte-split-control {\n display: inline-flex;\n}\n.srte-split-control > .srte-tool-button:first-child {\n border-radius: 8px 0 0 8px;\n}\n.srte-split-control > select {\n width: 27px;\n padding: 0;\n border-radius: 0 8px 8px 0;\n border-left: 0;\n appearance: none;\n -webkit-appearance: none;\n color: transparent;\n background-color: var(--srte-muted);\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: center;\n cursor: pointer;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li {\n display: grid;\n grid-template-columns: 1.1em minmax(0, 1fr);\n column-gap: .45em;\n align-items: start;\n padding-left: 0;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check] {\n display: inline-flex;\n grid-column: 1;\n grid-row: 1;\n align-items: center;\n justify-content: center;\n width: 1.1em;\n height: 1.6em;\n margin: 0;\n line-height: 1.6;\n vertical-align: top;\n position: relative;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check]::before {\n content: \"\";\n width: .9em;\n height: .9em;\n box-sizing: border-box;\n border: 1.5px solid var(--srte-muted-foreground);\n border-radius: 3px;\n background: var(--srte-canvas);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check][data-checked=\"true\"]::before {\n border-color: var(--srte-primary);\n background: var(--srte-primary);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--srte-on-primary) 25%, transparent);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check][data-checked=\"true\"]::after {\n content: \"\";\n position: absolute;\n width: .42em;\n height: .22em;\n border-left: 1.5px solid var(--srte-on-primary);\n border-bottom: 1.5px solid var(--srte-on-primary);\n transform: translateY(-.08em) rotate(-45deg);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > :is(p,h1,h2,h3,h4,h5,h6,blockquote,pre) {\n grid-column: 2;\n min-width: 0;\n margin-top: 0;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > :is(ul,ol) {\n grid-column: 2;\n}\n.srte-editor:focus-within {\n border-color: var(--srte-ring) !important;\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--srte-ring) 18%, transparent);\n}\n@media (max-width: 639px) {\n .srte-toolbar { gap: 3px; padding: 6px; }\n .srte-tool-button, .srte-toolbar select { height: 40px; min-width: 40px; }\n .srte-toolbar-group[data-srte-priority=\"3\"] { display: none; }\n .srte-toolbar-menu[data-srte-priority=\"2\"] { display: none; }\n .srte-mobile-more { display: block; }\n .srte-menu-item { height: 40px; }\n}\n@container srte-editor (max-width: 639px) {\n .srte-toolbar { gap: 3px; padding: 6px; }\n .srte-tool-button, .srte-toolbar select { height: 40px; min-width: 40px; }\n .srte-toolbar-group[data-srte-priority=\"3\"],\n .srte-toolbar-menu[data-srte-priority=\"2\"] { display: none; }\n .srte-mobile-more { display: block; }\n .srte-menu-item { height: 40px; }\n}\n.srte-editor [contenteditable] blockquote {\n border-left: 4px solid var(--srte-accent);\n margin: 0.75em 0;\n padding: 0.5em 1em;\n background: var(--srte-surface-subtle);\n color: var(--srte-text);\n}\n.srte-editor [contenteditable] p,\n.srte-editor [contenteditable] h1,\n.srte-editor [contenteditable] h2,\n.srte-editor [contenteditable] h3 {\n color: inherit;\n}\n.srte-editor [contenteditable] p {\n display: block;\n margin: 0 0 0.75em;\n font-size: 1em;\n font-weight: 400;\n line-height: 1.6;\n}\n.srte-editor [contenteditable] p[data-srte-caret-boundary=\"true\"] {\n min-height: 1.6em;\n}\n.srte-editor [contenteditable] h1,\n.srte-editor [contenteditable] h2,\n.srte-editor [contenteditable] h3 {\n display: block;\n margin: 0.75em 0 0.4em;\n font-weight: 700;\n line-height: 1.25;\n}\n.srte-editor [contenteditable] h1 {\n font-size: 2em;\n}\n.srte-editor [contenteditable] h2 {\n font-size: 1.5em;\n}\n.srte-editor [contenteditable] h3 {\n font-size: 1.25em;\n}\n.srte-editor [contenteditable] > :first-child {\n margin-top: 0;\n}\n.srte-editor [contenteditable] ul {\n list-style-type: disc;\n list-style-position: outside;\n margin: 0.75em 0;\n padding-left: 1.75em;\n}\n.srte-editor [contenteditable] ol {\n list-style-type: decimal;\n list-style-position: outside;\n margin: 0.75em 0;\n padding-left: 1.75em;\n}\n.srte-editor [contenteditable] li {\n display: list-item;\n margin: 0.25em 0;\n padding-left: 0.25em;\n}\n.srte-editor [contenteditable] li::marker {\n color: currentColor;\n}\n.srte-editor [contenteditable] table {\n width: 100%;\n margin: 0.75em 0;\n border-collapse: collapse;\n}\n.srte-editor [contenteditable] th,\n.srte-editor [contenteditable] td {\n padding: 8px;\n border: 1px solid var(--srte-border);\n vertical-align: top;\n}\n.srte-editor [contenteditable] th {\n background: var(--srte-surface-subtle);\n font-weight: 600;\n text-align: left;\n}\n.srte-editor [contenteditable] td > h1,\n.srte-editor [contenteditable] td > h2,\n.srte-editor [contenteditable] td > h3,\n.srte-editor [contenteditable] th > h1,\n.srte-editor [contenteditable] th > h2,\n.srte-editor [contenteditable] th > h3 {\n margin: 0 0 0.4em;\n overflow-wrap: anywhere;\n}\n.srte-editor [contenteditable] pre {\n display: block;\n margin: 0.75em 0;\n padding: 12px 14px;\n overflow-x: auto;\n border: 1px solid var(--srte-border);\n border-radius: 6px;\n background: var(--srte-code-bg);\n color: var(--srte-code-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace;\n font-size: 0.9em;\n line-height: 1.55;\n white-space: pre-wrap;\n}\n.srte-editor [contenteditable] pre code {\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n}\n.srte-editor [contenteditable] code:not(pre code) {\n padding: 0.1em 0.35em;\n border-radius: 3px;\n background: var(--srte-code-bg);\n color: var(--srte-code-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace;\n font-size: 0.9em;\n}\n.srte-editor [contenteditable] a,\n.srte-editor [contenteditable] a:visited {\n color: var(--srte-primary) !important;\n text-decoration: underline !important;\n text-decoration-thickness: 1px !important;\n text-underline-offset: 2px !important;\n cursor: pointer;\n}\n.srte-editor [contenteditable] a:hover {\n color: var(--srte-accent) !important;\n}\n.srte-editor [contenteditable] a:focus-visible {\n outline: 2px solid var(--srte-accent);\n outline-offset: 2px;\n}\n.srte-editor.srte-dark [contenteditable] [style*=\"color\"]:not(td):not(th):not(.srte-preserve-colors):not(.srte-preserve-colors *),\n.srte-editor.srte-dark [contenteditable] [style*=\"background\"]:not(td):not(th):not(.srte-preserve-colors):not(.srte-preserve-colors *) {\n color: var(--srte-text) !important;\n background: transparent !important;\n background-color: transparent !important;\n}\n.srte-editor [contenteditable] sub,\n.srte-editor [contenteditable] sup {\n line-height: 0;\n}\n";
|
|
2
|
+
export declare const SRTE_DEFAULT_CSS = "\n.srte-editor {\n --srte-background: var(--card, #ffffff);\n --srte-canvas: var(--background, #ffffff);\n --srte-foreground: var(--foreground, #0f172a);\n --srte-muted: var(--muted, #f1f5f9);\n --srte-muted-foreground: var(--muted-foreground, #64748b);\n --srte-ring: var(--ring, #0284c7);\n --srte-radius: var(--radius, 0.625rem);\n --srte-bg: var(--srte-canvas);\n --srte-text: var(--srte-foreground);\n --srte-text-muted: var(--srte-muted-foreground);\n --srte-border: var(--border, #e2e8f0);\n --srte-border-light: var(--srte-border);\n --srte-toolbar-bg: var(--srte-background);\n --srte-input-bg: var(--srte-background);\n --srte-input-text: var(--srte-foreground);\n --srte-input-border: var(--srte-border);\n --srte-modal-backdrop: rgba(0, 0, 0, 0.35);\n --srte-modal-backdrop-filter: blur(2px);\n --srte-modal-bg: #ffffff;\n --srte-modal-text: #000000;\n --srte-menu-bg: var(--srte-background);\n --srte-menu-text: var(--srte-foreground);\n --srte-menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);\n --srte-accent: #0284c7;\n --srte-accent-bg: rgba(2, 132, 199, 0.12);\n --srte-danger: #dc2626;\n --srte-primary: #2563eb;\n --srte-surface-subtle: #f3f4f6;\n --srte-on-primary: #ffffff;\n --srte-cancel-bg: #f3f4f6;\n --srte-code-bg: #f6f8fa;\n --srte-code-text: #24292f;\n}\n.srte-editor.srte-dark {\n --srte-background: var(--card, #1e293b);\n --srte-canvas: var(--background, #0f172a);\n --srte-foreground: var(--foreground, #f8fafc);\n --srte-muted: var(--muted, #334155);\n --srte-muted-foreground: var(--muted-foreground, #94a3b8);\n --srte-ring: var(--ring, #38bdf8);\n --srte-bg: var(--srte-canvas);\n --srte-text: var(--srte-foreground);\n --srte-text-muted: var(--srte-muted-foreground);\n --srte-border: var(--border, #334155);\n --srte-border-light: var(--srte-border);\n --srte-toolbar-bg: var(--srte-background);\n --srte-input-bg: var(--srte-background);\n --srte-input-text: var(--srte-foreground);\n --srte-input-border: var(--srte-border);\n --srte-modal-backdrop: rgba(0, 0, 0, 0.22);\n --srte-modal-backdrop-filter: blur(10px) saturate(0.9);\n --srte-modal-bg: #1e293b;\n --srte-modal-text: #e0e0e0;\n --srte-menu-bg: var(--srte-background);\n --srte-menu-text: var(--srte-foreground);\n --srte-menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);\n --srte-accent: #38bdf8;\n --srte-accent-bg: rgba(56, 189, 248, 0.16);\n --srte-danger: #ef4444;\n --srte-primary: #3b82f6;\n --srte-surface-subtle: #333333;\n --srte-on-primary: #ffffff;\n --srte-cancel-bg: #333333;\n --srte-code-bg: #111827;\n --srte-code-text: #e5e7eb;\n}\n.srte-editor {\n border-radius: var(--srte-radius);\n font-family: \"IBM Plex Sans\", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n container: srte-editor / inline-size;\n}\n.srte-toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px;\n width: 100%;\n min-height: 48px;\n padding: 8px;\n box-sizing: border-box;\n border-bottom: 1px solid var(--srte-border);\n background: var(--srte-background);\n color: var(--srte-foreground);\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.srte-toolbar-group {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n min-width: 0;\n}\n.srte-toolbar-group + .srte-toolbar-group::before {\n content: \"\";\n width: 1px;\n height: 20px;\n margin: 0 5px 0 3px;\n background: var(--srte-border);\n}\n.srte-tool-button,\n.srte-toolbar select {\n height: 32px;\n min-width: 32px;\n box-sizing: border-box;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--srte-foreground);\n font: 500 13px/1 \"IBM Plex Sans\", ui-sans-serif, system-ui, sans-serif;\n}\n.srte-tool-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n padding: 0 7px;\n cursor: pointer;\n}\n.srte-toolbar select {\n max-width: 132px;\n padding: 0 26px 0 9px;\n border-color: var(--srte-border);\n background: var(--srte-input-bg);\n cursor: pointer;\n}\n.srte-tool-button:hover,\n.srte-toolbar select:hover,\n.srte-toolbar-menu[open] > .srte-menu-trigger {\n background: var(--srte-muted);\n border-color: var(--srte-border);\n}\n.srte-tool-button.srte-active,\n.srte-tool-button[aria-pressed=\"true\"] {\n color: var(--srte-primary);\n background: var(--srte-accent-bg);\n border-color: color-mix(in srgb, var(--srte-primary) 35%, transparent);\n}\n.srte-tool-button:focus-visible,\n.srte-toolbar select:focus-visible,\n.srte-menu-item:focus-visible {\n outline: 2px solid var(--srte-ring);\n outline-offset: 1px;\n}\n.srte-tool-button:disabled,\n.srte-menu-item:disabled,\n.srte-toolbar select:disabled {\n cursor: not-allowed;\n opacity: .4;\n}\n.srte-toolbar-menu {\n position: relative;\n}\n.srte-toolbar-menu > summary {\n list-style: none;\n}\n.srte-toolbar-menu > summary::-webkit-details-marker {\n display: none;\n}\n.srte-menu {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 80;\n min-width: 210px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid var(--srte-border);\n border-radius: 12px;\n background: var(--srte-menu-bg);\n color: var(--srte-menu-text);\n box-shadow: var(--srte-menu-shadow);\n}\n.srte-menu-item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n height: 36px;\n padding: 0 8px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: 500 13px/1 \"IBM Plex Sans\", ui-sans-serif, system-ui, sans-serif;\n text-align: left;\n white-space: nowrap;\n}\n.srte-menu-item:hover {\n background: var(--srte-muted);\n}\n.srte-menu-check {\n margin-left: auto;\n color: var(--srte-primary);\n font-weight: 700;\n}\n.srte-menu-separator {\n height: 1px;\n margin: 4px;\n background: var(--srte-border);\n}\n.srte-mobile-more { display: none; }\n.srte-toolbar .srte-command-proxy { display: none; }\n.srte-split-control {\n display: inline-flex;\n}\n.srte-split-control > .srte-tool-button:first-child {\n border-radius: 8px 0 0 8px;\n}\n.srte-split-control > select {\n width: 27px;\n padding: 0;\n border-radius: 0 8px 8px 0;\n border-left: 0;\n appearance: none;\n -webkit-appearance: none;\n color: transparent;\n background-color: var(--srte-muted);\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: center;\n cursor: pointer;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li {\n display: grid;\n grid-template-columns: 1.1em minmax(0, 1fr);\n column-gap: .45em;\n align-items: start;\n padding-left: 0;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check] {\n display: inline-flex;\n grid-column: 1;\n grid-row: 1;\n align-items: center;\n justify-content: center;\n width: 1.1em;\n height: 1.6em;\n margin: 0;\n line-height: 1.6;\n vertical-align: top;\n position: relative;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check]::before {\n content: \"\";\n width: .9em;\n height: .9em;\n box-sizing: border-box;\n border: 1.5px solid var(--srte-muted-foreground);\n border-radius: 3px;\n background: var(--srte-canvas);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check][data-checked=\"true\"]::before {\n border-color: var(--srte-primary);\n background: var(--srte-primary);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--srte-on-primary) 25%, transparent);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > [data-srte-check][data-checked=\"true\"]::after {\n content: \"\";\n position: absolute;\n width: .42em;\n height: .22em;\n border-left: 1.5px solid var(--srte-on-primary);\n border-bottom: 1.5px solid var(--srte-on-primary);\n transform: translateY(-.08em) rotate(-45deg);\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > :is(p,h1,h2,h3,h4,h5,h6,blockquote,pre) {\n grid-column: 2;\n min-width: 0;\n margin-top: 0;\n}\n.srte-editor [contenteditable] ul[data-srte-checklist=\"true\"] > li > :is(ul,ol) {\n grid-column: 2;\n}\n.srte-editor:focus-within {\n border-color: var(--srte-ring) !important;\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--srte-ring) 18%, transparent);\n}\n@media (max-width: 639px) {\n .srte-toolbar { gap: 3px; padding: 6px; }\n .srte-tool-button, .srte-toolbar select { height: 40px; min-width: 40px; }\n .srte-toolbar-group[data-srte-priority=\"3\"] { display: none; }\n .srte-toolbar-menu[data-srte-priority=\"2\"] { display: none; }\n .srte-mobile-more { display: block; }\n .srte-mobile-more .srte-menu {\n left: auto;\n right: 0;\n width: min(280px, calc(100vw - 16px));\n min-width: 0;\n max-height: min(70dvh, 480px);\n overflow-x: hidden;\n overflow-y: auto;\n overscroll-behavior: contain;\n -webkit-overflow-scrolling: touch;\n }\n .srte-menu-item { height: 40px; }\n}\n@container srte-editor (max-width: 639px) {\n .srte-toolbar { gap: 3px; padding: 6px; }\n .srte-tool-button, .srte-toolbar select { height: 40px; min-width: 40px; }\n .srte-toolbar-group[data-srte-priority=\"3\"],\n .srte-toolbar-menu[data-srte-priority=\"2\"] { display: none; }\n .srte-mobile-more { display: block; }\n .srte-mobile-more .srte-menu {\n left: auto;\n right: 0;\n width: min(280px, calc(100vw - 16px));\n min-width: 0;\n max-height: min(70dvh, 480px);\n overflow-x: hidden;\n overflow-y: auto;\n overscroll-behavior: contain;\n -webkit-overflow-scrolling: touch;\n }\n .srte-menu-item { height: 40px; }\n}\n.srte-editor [contenteditable] blockquote {\n border-left: 4px solid var(--srte-accent);\n margin: 0.75em 0;\n padding: 0.5em 1em;\n background: var(--srte-surface-subtle);\n color: var(--srte-text);\n}\n.srte-editor [contenteditable] p,\n.srte-editor [contenteditable] h1,\n.srte-editor [contenteditable] h2,\n.srte-editor [contenteditable] h3 {\n color: inherit;\n}\n.srte-editor [contenteditable] p {\n display: block;\n margin: 0 0 0.75em;\n font-size: 1em;\n font-weight: 400;\n line-height: 1.6;\n}\n.srte-editor [contenteditable] p[data-srte-caret-boundary=\"true\"] {\n min-height: 1.6em;\n}\n.srte-editor [contenteditable] h1,\n.srte-editor [contenteditable] h2,\n.srte-editor [contenteditable] h3 {\n display: block;\n margin: 0.75em 0 0.4em;\n font-weight: 700;\n line-height: 1.25;\n}\n.srte-editor [contenteditable] h1 {\n font-size: 2em;\n}\n.srte-editor [contenteditable] h2 {\n font-size: 1.5em;\n}\n.srte-editor [contenteditable] h3 {\n font-size: 1.25em;\n}\n.srte-editor [contenteditable] > :first-child {\n margin-top: 0;\n}\n.srte-editor [contenteditable] ul {\n list-style-type: disc;\n list-style-position: outside;\n margin: 0.75em 0;\n padding-left: 1.75em;\n}\n.srte-editor [contenteditable] ol {\n list-style-type: decimal;\n list-style-position: outside;\n margin: 0.75em 0;\n padding-left: 1.75em;\n}\n.srte-editor [contenteditable] li {\n display: list-item;\n margin: 0.25em 0;\n padding-left: 0.25em;\n}\n.srte-editor [contenteditable] li::marker {\n color: currentColor;\n}\n.srte-editor [contenteditable] table {\n width: 100%;\n margin: 0.75em 0;\n border-collapse: collapse;\n}\n.srte-editor [contenteditable] th,\n.srte-editor [contenteditable] td {\n padding: 8px;\n border: 1px solid var(--srte-border);\n vertical-align: top;\n}\n.srte-editor [contenteditable] th {\n background: var(--srte-surface-subtle);\n font-weight: 600;\n text-align: left;\n}\n.srte-editor [contenteditable] td > h1,\n.srte-editor [contenteditable] td > h2,\n.srte-editor [contenteditable] td > h3,\n.srte-editor [contenteditable] th > h1,\n.srte-editor [contenteditable] th > h2,\n.srte-editor [contenteditable] th > h3 {\n margin: 0 0 0.4em;\n overflow-wrap: anywhere;\n}\n.srte-editor [contenteditable] pre {\n display: block;\n margin: 0.75em 0;\n padding: 12px 14px;\n overflow-x: auto;\n border: 1px solid var(--srte-border);\n border-radius: 6px;\n background: var(--srte-code-bg);\n color: var(--srte-code-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace;\n font-size: 0.9em;\n line-height: 1.55;\n white-space: pre-wrap;\n}\n.srte-editor [contenteditable] pre code {\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n}\n.srte-editor [contenteditable] code:not(pre code) {\n padding: 0.1em 0.35em;\n border-radius: 3px;\n background: var(--srte-code-bg);\n color: var(--srte-code-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace;\n font-size: 0.9em;\n}\n.srte-editor [contenteditable] a,\n.srte-editor [contenteditable] a:visited {\n color: var(--srte-primary) !important;\n text-decoration: underline !important;\n text-decoration-thickness: 1px !important;\n text-underline-offset: 2px !important;\n cursor: pointer;\n}\n.srte-editor [contenteditable] a:hover {\n color: var(--srte-accent) !important;\n}\n.srte-editor [contenteditable] a:focus-visible {\n outline: 2px solid var(--srte-accent);\n outline-offset: 2px;\n}\n.srte-editor [contenteditable] sub,\n.srte-editor [contenteditable] sup {\n line-height: 0;\n}\n";
|
|
3
3
|
export declare function ensureStyleSheet(): void;
|
package/dist/theme.js
CHANGED
|
@@ -285,6 +285,17 @@ export const SRTE_DEFAULT_CSS = `
|
|
|
285
285
|
.srte-toolbar-group[data-srte-priority="3"] { display: none; }
|
|
286
286
|
.srte-toolbar-menu[data-srte-priority="2"] { display: none; }
|
|
287
287
|
.srte-mobile-more { display: block; }
|
|
288
|
+
.srte-mobile-more .srte-menu {
|
|
289
|
+
left: auto;
|
|
290
|
+
right: 0;
|
|
291
|
+
width: min(280px, calc(100vw - 16px));
|
|
292
|
+
min-width: 0;
|
|
293
|
+
max-height: min(70dvh, 480px);
|
|
294
|
+
overflow-x: hidden;
|
|
295
|
+
overflow-y: auto;
|
|
296
|
+
overscroll-behavior: contain;
|
|
297
|
+
-webkit-overflow-scrolling: touch;
|
|
298
|
+
}
|
|
288
299
|
.srte-menu-item { height: 40px; }
|
|
289
300
|
}
|
|
290
301
|
@container srte-editor (max-width: 639px) {
|
|
@@ -293,6 +304,17 @@ export const SRTE_DEFAULT_CSS = `
|
|
|
293
304
|
.srte-toolbar-group[data-srte-priority="3"],
|
|
294
305
|
.srte-toolbar-menu[data-srte-priority="2"] { display: none; }
|
|
295
306
|
.srte-mobile-more { display: block; }
|
|
307
|
+
.srte-mobile-more .srte-menu {
|
|
308
|
+
left: auto;
|
|
309
|
+
right: 0;
|
|
310
|
+
width: min(280px, calc(100vw - 16px));
|
|
311
|
+
min-width: 0;
|
|
312
|
+
max-height: min(70dvh, 480px);
|
|
313
|
+
overflow-x: hidden;
|
|
314
|
+
overflow-y: auto;
|
|
315
|
+
overscroll-behavior: contain;
|
|
316
|
+
-webkit-overflow-scrolling: touch;
|
|
317
|
+
}
|
|
296
318
|
.srte-menu-item { height: 40px; }
|
|
297
319
|
}
|
|
298
320
|
.srte-editor [contenteditable] blockquote {
|
|
@@ -427,12 +449,6 @@ export const SRTE_DEFAULT_CSS = `
|
|
|
427
449
|
outline: 2px solid var(--srte-accent);
|
|
428
450
|
outline-offset: 2px;
|
|
429
451
|
}
|
|
430
|
-
.srte-editor.srte-dark [contenteditable] [style*="color"]:not(td):not(th):not(.srte-preserve-colors):not(.srte-preserve-colors *),
|
|
431
|
-
.srte-editor.srte-dark [contenteditable] [style*="background"]:not(td):not(th):not(.srte-preserve-colors):not(.srte-preserve-colors *) {
|
|
432
|
-
color: var(--srte-text) !important;
|
|
433
|
-
background: transparent !important;
|
|
434
|
-
background-color: transparent !important;
|
|
435
|
-
}
|
|
436
452
|
.srte-editor [contenteditable] sub,
|
|
437
453
|
.srte-editor [contenteditable] sup {
|
|
438
454
|
line-height: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartrte-react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "A powerful, feature-rich Rich Text Editor for React with support for tables, mathematical formulas (LaTeX/KaTeX), and media management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|