Add text import export for toolbox modules
This commit is contained in:
parent
a9b5ca423a
commit
117b7b79e1
27 changed files with 1430 additions and 181 deletions
|
|
@ -1,7 +1,8 @@
|
|||
// Rôle : fournit l'outil tableau avec cellules libres et formules simples.
|
||||
// Rôle : fournit l'outil tableau avec cellules libres, formules simples et échange TSV.
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Icon } from "../../../components/Icon.jsx";
|
||||
import { useInlineEdit } from "../../../hooks/useInlineEdit.js";
|
||||
import { TextExchangeActions } from "./TextExchangeActions.jsx";
|
||||
import { cellAddress, columnIndexToName, evaluateTable, parseCellAddress } from "./tableFormulaEngine.js";
|
||||
|
||||
const DEFAULT_ROWS = 10;
|
||||
|
|
@ -101,7 +102,7 @@ function getFormulaRangeText(selection) {
|
|||
return addresses.length === 1 ? addresses[0] : `(${addresses.join("+")})`;
|
||||
}
|
||||
|
||||
export function TableModule({ toolboxId, moduleId, context }) {
|
||||
export function TableModule({ toolboxId, moduleId, context, editing }) {
|
||||
const data = context.normalizeTableData(context.getModuleData(toolboxId, moduleId, { rows: DEFAULT_ROWS, columns: DEFAULT_COLUMNS, cells: {} }));
|
||||
const textContent = context.moduleText?.table || {};
|
||||
const [editingCell, setEditingCell] = useState("");
|
||||
|
|
@ -414,6 +415,11 @@ export function TableModule({ toolboxId, moduleId, context }) {
|
|||
|
||||
return (
|
||||
<div className="table-module">
|
||||
{editing && (
|
||||
<div className="module-add-panel table-exchange-panel">
|
||||
<TextExchangeActions type="table" data={data} context={context} textContent={textContent} exportLabel="Exporter TSV" onImport={(nextData) => context.setModuleData(toolboxId, moduleId, nextData, "table")} />
|
||||
</div>
|
||||
)}
|
||||
<div className="notepad-toolbar table-toolbar" aria-label={textContent.toolbarLabel || "Actions du tableau"}>
|
||||
<div className="notepad-format-controls table-controls">
|
||||
<div className="notepad-toolbar-group" role="group" aria-label={textContent.rowActionsLabel || "Lignes"}>
|
||||
|
|
@ -469,10 +475,11 @@ export function TableModule({ toolboxId, moduleId, context }) {
|
|||
className="notepad-toolbar-button table-copy-button"
|
||||
type="button"
|
||||
onClick={copyTsv}
|
||||
aria-label={textContent.copyTitle || "Copier en TSV"}
|
||||
title={textContent.copyTitle || "Copier en TSV"}
|
||||
aria-label={textContent.copyTitle || "Copier les valeurs"}
|
||||
title={textContent.copyTitle || "Copier les valeurs"}
|
||||
>
|
||||
<Icon name="copy" />
|
||||
<span>{textContent.copyTitle || "Copier les valeurs"}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue