feat(lesson-preparation): add readonly view, anchor node selector, and type guards

- Add lesson-plan-readonly-view for viewing published plans

- Add anchor-node-selector and textbook-segments for canvas anchor positioning

- Add i18n-errors and type-guards lib utilities

- Add lesson-plan-provider-setup for provider initialization

- Update actions, data-access (knowledge, versions, main), publish-service

- Update blocks (blackboard, exercise, homework, import, key-point, objective, reflection)

- Update editor, node-editor, node-edit-panel, pickers, and providers
This commit is contained in:
SpecialX
2026-06-24 12:02:42 +08:00
parent a48e7d0e27
commit 6bc113eaff
39 changed files with 2129 additions and 571 deletions

View File

@@ -12,8 +12,8 @@ import { Plus, Trash2 } from "lucide-react";
import type {
ExerciseBlockData,
ExerciseItem,
ExercisePurpose,
} from "../../types";
import { isExercisePurpose } from "../../lib/type-guards";
interface Props {
blockId: string;
@@ -59,9 +59,12 @@ export function ExerciseBlock({ blockId, data, classes, textbookId, chapterId }:
<select
id={`exercise-purpose-${blockId}`}
value={data.purpose}
onChange={(e) =>
update({ purpose: e.target.value as ExercisePurpose })
}
onChange={(e) => {
const value = e.target.value;
if (isExercisePurpose(value)) {
update({ purpose: value });
}
}}
className="border rounded px-2 py-1 text-sm"
>
<option value="class_practice">{t("exercise.purpose.class_practice")}</option>