Add text import export for toolbox modules

This commit is contained in:
Shinuwa 2026-08-09 15:26:10 +02:00
parent a9b5ca423a
commit 117b7b79e1
27 changed files with 1430 additions and 181 deletions

View file

@ -1,4 +1,4 @@
// Rôle : fournit l'outil timer avec chronomètre à étapes et comptes à rebours multiples.
// Rôle : fournit l'outil timer avec chronomètre, comptes à rebours et échange texte.
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { Icon } from "../../../components/Icon.jsx";
import { Tabs } from "../../../components/Tabs.jsx";
@ -19,6 +19,7 @@ import {
timePartsToDurationMs,
timePartsToString
} from "./timerUtils.js";
import { TextExchangeActions } from "./TextExchangeActions.jsx";
const TIMER_TABS = [
{ id: "stopwatch", label: "Chronomètre", icon: "stopwatch" },
@ -115,7 +116,7 @@ function getCountdownValidationError(type, draft, textContent) {
return "";
}
export function TimerModule({ toolboxId, moduleId, context }) {
export function TimerModule({ toolboxId, moduleId, context, editing }) {
const data = context.normalizeTimerData(context.getModuleData(toolboxId, moduleId, { activeTab: "stopwatch" }));
const textContent = context.moduleText?.timer || {};
const activeTab = data.activeTab;
@ -333,6 +334,11 @@ export function TimerModule({ toolboxId, moduleId, context }) {
return (
<div className="timer-module">
{editing && (
<div className="module-add-panel timer-exchange-panel">
<TextExchangeActions type="timer" data={data} context={context} textContent={textContent} onImport={(nextData) => save(nextData)} />
</div>
)}
<section className="timer-control-card">
<Tabs
className="timer-tabs"