Preserve QExcell strikethrough formatting
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
Plus,
|
||||
Save,
|
||||
Sigma,
|
||||
Strikethrough,
|
||||
Trash2,
|
||||
Type,
|
||||
Underline
|
||||
@@ -114,6 +115,7 @@ function normalizedCellFormat(format: CellFormat): CellFormat | undefined {
|
||||
...(format.bold ? { bold: true } : {}),
|
||||
...(format.italics ? { italics: true } : {}),
|
||||
...(format.underline ? { underline: true } : {}),
|
||||
...(format.strike ? { strike: true } : {}),
|
||||
...(fontSize ? { fontSize } : {}),
|
||||
...(textColor ? { textColor } : {}),
|
||||
...(fillColor ? { fillColor } : {}),
|
||||
@@ -125,10 +127,11 @@ function normalizedCellFormat(format: CellFormat): CellFormat | undefined {
|
||||
}
|
||||
|
||||
function cellInputStyle(format?: CellFormat): CSSProperties {
|
||||
const textDecoration = [format?.underline ? "underline" : "", format?.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
||||
return {
|
||||
...(format?.bold ? { fontWeight: 700 } : {}),
|
||||
...(format?.italics ? { fontStyle: "italic" } : {}),
|
||||
...(format?.underline ? { textDecoration: "underline" } : {}),
|
||||
...(textDecoration ? { textDecoration } : {}),
|
||||
...(format?.fontSize ? { fontSize: `${format.fontSize}pt` } : {}),
|
||||
...(format?.textColor ? { color: `#${format.textColor}` } : {}),
|
||||
...(format?.fillColor ? { backgroundColor: `#${format.fillColor}` } : {}),
|
||||
@@ -249,7 +252,7 @@ export function QExcell({ workbook, onChange }: QExcellProps) {
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSelectedFormat(key: "bold" | "italics" | "underline") {
|
||||
function toggleSelectedFormat(key: "bold" | "italics" | "underline" | "strike") {
|
||||
updateCellFormat(selectedCell, { [key]: !selectedCellFormat[key] });
|
||||
}
|
||||
|
||||
@@ -490,6 +493,15 @@ export function QExcell({ workbook, onChange }: QExcellProps) {
|
||||
>
|
||||
<Underline size={16} />
|
||||
</button>
|
||||
<button
|
||||
className={`icon-button format-toggle ${selectedCellFormat.strike ? "is-active" : ""}`.trim()}
|
||||
type="button"
|
||||
onClick={() => toggleSelectedFormat("strike")}
|
||||
title="Зачеркнуть"
|
||||
aria-label="Зачеркнуть"
|
||||
>
|
||||
<Strikethrough size={16} />
|
||||
</button>
|
||||
{horizontalAlignOptions.map((option) => {
|
||||
const Icon = option.icon;
|
||||
const isActive = selectedCellFormat.horizontalAlign === option.value;
|
||||
|
||||
Reference in New Issue
Block a user