@project-sunbird/sunbird-questionset-editor-web-component-react 0.1.0
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/dist/api/asset.d.ts +31 -0
- package/dist/api/categoryDefinition.d.ts +39 -0
- package/dist/api/channel.d.ts +13 -0
- package/dist/api/client.d.ts +10 -0
- package/dist/api/client.test.d.ts +1 -0
- package/dist/api/comments.d.ts +10 -0
- package/dist/api/content.d.ts +14 -0
- package/dist/api/framework.d.ts +4 -0
- package/dist/api/hierarchy.d.ts +13 -0
- package/dist/api/license.d.ts +2 -0
- package/dist/api/question.d.ts +13 -0
- package/dist/api/question.test.d.ts +1 -0
- package/dist/api/urls.d.ts +64 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/css/mathmodal.css +1 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/favicon.ico +0 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/index.html +1 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/js/mathmodal.js +8 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/katex.min.css +1 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/katex.min.js +1 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/mathquill.css +425 -0
- package/dist/assets/libs/mathEquation/plugin/mathModal/mathquill.js +4925 -0
- package/dist/ckeditor/ckeditor.js +6 -0
- package/dist/components/AssetBrowser/AssetBrowser.d.ts +17 -0
- package/dist/components/BehaviourForm/SetBehaviourForm.d.ts +8 -0
- package/dist/components/CKEditorField/CKEditorField.d.ts +11 -0
- package/dist/components/ContextualEditor/ContextualEditor.d.ts +13 -0
- package/dist/components/LibraryDock/LibraryDock.d.ts +8 -0
- package/dist/components/OutlineTree/OutlineTree.d.ts +7 -0
- package/dist/components/QuestionDetail/QuestionDetail.d.ts +13 -0
- package/dist/components/QuestionEditor/BooleanEditor/BooleanEditor.d.ts +7 -0
- package/dist/components/QuestionEditor/FtbEditor/FtbEditor.d.ts +8 -0
- package/dist/components/QuestionEditor/McqEditor/McqEditor.d.ts +7 -0
- package/dist/components/QuestionEditor/MtfEditor/MtfEditor.d.ts +7 -0
- package/dist/components/QuestionEditor/QuestionEditor.d.ts +8 -0
- package/dist/components/QuestionEditor/ReoEditor/ReoEditor.d.ts +7 -0
- package/dist/components/QuestionEditor/SaEditor/SaEditor.d.ts +7 -0
- package/dist/components/QuestionEditor/SeqEditor/SeqEditor.d.ts +7 -0
- package/dist/components/QuestionsetEditor/QuestionsetEditor.d.ts +6 -0
- package/dist/components/QumlPlayer/QumlPlayer.d.ts +13 -0
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +28 -0
- package/dist/components/SectionBehaviourForm/SectionBehaviourForm.d.ts +8 -0
- package/dist/components/SparkMetaForm/SparkMetaForm.d.ts +39 -0
- package/dist/components/SplitEditorShell/SplitEditorShell.d.ts +8 -0
- package/dist/components/Topbar/Topbar.d.ts +18 -0
- package/dist/components/modals/ConfirmDialog.d.ts +4 -0
- package/dist/components/modals/ProgressStatusModal.d.ts +7 -0
- package/dist/components/modals/PublishChecklist.d.ts +10 -0
- package/dist/components/modals/QualityParamsModal.d.ts +11 -0
- package/dist/components/modals/QuestionTypeSelectorModal.d.ts +4 -0
- package/dist/components/modals/TermAndConditionModal.d.ts +8 -0
- package/dist/components/modals/UnsavedChangesModal.d.ts +10 -0
- package/dist/components/shared/Badge.d.ts +20 -0
- package/dist/components/shared/Button.d.ts +25 -0
- package/dist/components/shared/ContentEditable.d.ts +14 -0
- package/dist/components/shared/Icon.d.ts +11 -0
- package/dist/components/shared/ImagePickerModal.d.ts +15 -0
- package/dist/components/shared/MathModal.d.ts +10 -0
- package/dist/components/shared/Modal.d.ts +29 -0
- package/dist/components/shared/SharedRichToolbar.d.ts +5 -0
- package/dist/components/shared/Spinner.d.ts +15 -0
- package/dist/components/shared/specialCharsData.d.ts +7 -0
- package/dist/dev-main.d.ts +1 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/useChannelData.d.ts +3 -0
- package/dist/hooks/useEditorInit.d.ts +12 -0
- package/dist/hooks/useFramework.d.ts +9 -0
- package/dist/hooks/useLabels.d.ts +4 -0
- package/dist/hooks/useLibrary.d.ts +18 -0
- package/dist/hooks/useQuestionRead.d.ts +16 -0
- package/dist/hooks/useSaveHierarchy.d.ts +6 -0
- package/dist/hooks/useSaveQuestion.d.ts +3 -0
- package/dist/hooks/useTelemetry.d.ts +9 -0
- package/dist/hooks/useToolbarActions.d.ts +5 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +16202 -0
- package/dist/locales/label.config.ar.json.d.ts +344 -0
- package/dist/locales/label.config.fr.json.d.ts +237 -0
- package/dist/locales/label.config.hi.json.d.ts +51 -0
- package/dist/locales/label.config.json.d.ts +379 -0
- package/dist/locales/label.config.pt.json.d.ts +237 -0
- package/dist/registry/defaultQuestionTypes.d.ts +1 -0
- package/dist/registry/index.d.ts +9 -0
- package/dist/registry/questionTypeRegistry.d.ts +38 -0
- package/dist/store/editor.store.d.ts +66 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/library.store.d.ts +32 -0
- package/dist/store/question.store.d.ts +103 -0
- package/dist/store/tree.store.d.ts +43 -0
- package/dist/store/tree.store.test.d.ts +1 -0
- package/dist/store/ui.store.d.ts +16 -0
- package/dist/style.css +1 -0
- package/dist/types/content.d.ts +23 -0
- package/dist/types/editor.d.ts +130 -0
- package/dist/types/framework.d.ts +40 -0
- package/dist/types/question.d.ts +118 -0
- package/dist/utils/assetUrl.d.ts +11 -0
- package/dist/utils/context.d.ts +10 -0
- package/dist/utils/context.test.d.ts +1 -0
- package/dist/utils/html.d.ts +12 -0
- package/dist/utils/i18n.test.d.ts +1 -0
- package/dist/utils/i18nField.d.ts +38 -0
- package/dist/utils/i18nSerialize.d.ts +16 -0
- package/dist/utils/labels.d.ts +8 -0
- package/dist/utils/nodeKind.d.ts +9 -0
- package/dist/utils/notify.d.ts +4 -0
- package/dist/utils/questionRead.d.ts +10 -0
- package/dist/utils/questionRead.test.d.ts +1 -0
- package/dist/utils/telemetry.d.ts +15 -0
- package/dist/web-component/register.d.ts +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ITermAssociation {
|
|
2
|
+
identifier: string;
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
category: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ITerm {
|
|
9
|
+
identifier: string;
|
|
10
|
+
code: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
index?: number;
|
|
14
|
+
category?: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
associations?: ITermAssociation[];
|
|
17
|
+
}
|
|
18
|
+
export interface ICategory {
|
|
19
|
+
identifier: string;
|
|
20
|
+
code: string;
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
terms?: ITerm[];
|
|
24
|
+
}
|
|
25
|
+
export interface IFramework {
|
|
26
|
+
identifier: string;
|
|
27
|
+
code: string;
|
|
28
|
+
name: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
categories?: ICategory[];
|
|
31
|
+
}
|
|
32
|
+
export interface IFrameworkDetails {
|
|
33
|
+
orgFramework?: IFramework;
|
|
34
|
+
targetFrameworks?: IFramework[];
|
|
35
|
+
channelFrameworks?: Array<{
|
|
36
|
+
identifier: string;
|
|
37
|
+
name: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export type QuestionType = 'mcq' | 'sa' | 'ftb' | 'mtf' | 'seq' | 'reo' | 'boolean';
|
|
2
|
+
export interface IOption {
|
|
3
|
+
id: string;
|
|
4
|
+
body: string;
|
|
5
|
+
isCorrect?: boolean;
|
|
6
|
+
value?: number;
|
|
7
|
+
hint?: string;
|
|
8
|
+
score?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface IMatchPair {
|
|
11
|
+
id: string;
|
|
12
|
+
left: string;
|
|
13
|
+
right: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IHint {
|
|
16
|
+
id: string;
|
|
17
|
+
body: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IMediaEntry {
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
src: string;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
assetId?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
thumbnail?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IQuestionBody {
|
|
29
|
+
text?: string;
|
|
30
|
+
media?: IMediaEntry[];
|
|
31
|
+
}
|
|
32
|
+
export interface IBranchingRule {
|
|
33
|
+
target: string;
|
|
34
|
+
preCondition?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface IQuestion {
|
|
37
|
+
identifier: string;
|
|
38
|
+
name: string;
|
|
39
|
+
objectType: 'Question';
|
|
40
|
+
primaryCategory: string;
|
|
41
|
+
questionType?: QuestionType;
|
|
42
|
+
mimeType: 'application/vnd.sunbird.question';
|
|
43
|
+
visibility?: 'Default' | 'Parent';
|
|
44
|
+
status?: 'Draft' | 'Review' | 'Live' | 'Retired';
|
|
45
|
+
channel?: string;
|
|
46
|
+
framework?: string;
|
|
47
|
+
body?: string;
|
|
48
|
+
editorState?: {
|
|
49
|
+
question?: string;
|
|
50
|
+
options?: IOption[];
|
|
51
|
+
answer?: string;
|
|
52
|
+
matchPairs?: IMatchPair[];
|
|
53
|
+
sequence?: string[];
|
|
54
|
+
/** REO: the correct sentence (old editor round-trips it verbatim). */
|
|
55
|
+
sentence?: string;
|
|
56
|
+
};
|
|
57
|
+
answer?: string;
|
|
58
|
+
options?: IOption[];
|
|
59
|
+
hints?: IHint[];
|
|
60
|
+
solutions?: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
type: string;
|
|
63
|
+
value: string;
|
|
64
|
+
}>;
|
|
65
|
+
media?: IQuestionBody['media'];
|
|
66
|
+
interactions?: Record<string, unknown>;
|
|
67
|
+
responseDeclaration?: Record<string, unknown>;
|
|
68
|
+
outcomeDeclaration?: Record<string, unknown>;
|
|
69
|
+
timeLimits?: {
|
|
70
|
+
maxTime?: number;
|
|
71
|
+
warningTime?: number;
|
|
72
|
+
};
|
|
73
|
+
maxScore?: number;
|
|
74
|
+
bloomsLevel?: string;
|
|
75
|
+
difficultyLevel?: 'easy' | 'medium' | 'hard';
|
|
76
|
+
purpose?: string;
|
|
77
|
+
expectedDuration?: number;
|
|
78
|
+
shuffle?: boolean;
|
|
79
|
+
showSolutions?: boolean;
|
|
80
|
+
showHints?: boolean;
|
|
81
|
+
branchingLogic?: Record<string, IBranchingRule>;
|
|
82
|
+
/** Multilingual text sources decoded from the read response (lang → text).
|
|
83
|
+
* Arrays are positional (same order as options/pairs/sequence). */
|
|
84
|
+
i18nSource?: {
|
|
85
|
+
question?: Record<string, string>;
|
|
86
|
+
answer?: Record<string, string>;
|
|
87
|
+
sentence?: Record<string, string>;
|
|
88
|
+
solution?: Record<string, string>;
|
|
89
|
+
hint?: Record<string, string>;
|
|
90
|
+
options?: Array<Record<string, string>>;
|
|
91
|
+
pairsLeft?: Array<Record<string, string>>;
|
|
92
|
+
pairsRight?: Array<Record<string, string>>;
|
|
93
|
+
sequence?: Array<Record<string, string>>;
|
|
94
|
+
};
|
|
95
|
+
qType?: string;
|
|
96
|
+
templateId?: string;
|
|
97
|
+
interactionTypes?: string[];
|
|
98
|
+
isPartialScore?: boolean;
|
|
99
|
+
evalUnordered?: boolean;
|
|
100
|
+
remarks?: unknown;
|
|
101
|
+
evidence?: unknown;
|
|
102
|
+
instructions?: Record<string, unknown>;
|
|
103
|
+
isReviewModificationAllowed?: boolean;
|
|
104
|
+
createdBy?: string;
|
|
105
|
+
lastUpdatedBy?: string;
|
|
106
|
+
createdOn?: string;
|
|
107
|
+
lastUpdatedOn?: string;
|
|
108
|
+
board?: string[];
|
|
109
|
+
medium?: string[];
|
|
110
|
+
gradeLevel?: string[];
|
|
111
|
+
subject?: string[];
|
|
112
|
+
topic?: string[];
|
|
113
|
+
keywords?: string[];
|
|
114
|
+
language?: string[];
|
|
115
|
+
license?: string;
|
|
116
|
+
copyright?: string;
|
|
117
|
+
attributions?: string[];
|
|
118
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrites a full blob-storage URL to the portal's /assets/public/ proxy path.
|
|
3
|
+
*
|
|
4
|
+
* The portal proxies blob storage through /assets/public/ for CORS/auth reasons.
|
|
5
|
+
* context.cloudStorageUrls holds the list of blob origin prefixes to rewrite.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* input: https://eddevda72f12a.blob.core.windows.net/ed-dev-public-xxx/img.png
|
|
9
|
+
* output: /assets/public/img.png
|
|
10
|
+
*/
|
|
11
|
+
export declare function rewriteAssetUrl(url: string, cloudStorageUrls?: string[]): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IContext, EditorMode } from '../types/editor';
|
|
2
|
+
|
|
3
|
+
export declare function getUserId(ctx?: IContext | null): string;
|
|
4
|
+
export declare function getContentId(ctx?: IContext | null): string;
|
|
5
|
+
/**
|
|
6
|
+
* Old editor's role rule (header.component handleActionButtons): content is
|
|
7
|
+
* editable in edit mode, or during org/sourcing review when the host allows
|
|
8
|
+
* reviewer modifications (context.enableReviewEdit).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isEditingAllowed(mode: EditorMode, ctx?: IContext | null): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML escaping/extraction helpers — user- and server-supplied strings must
|
|
3
|
+
* be encoded before interpolation into markup that reaches innerHTML.
|
|
4
|
+
*/
|
|
5
|
+
export declare function escapeHtml(v: string): string;
|
|
6
|
+
/** Alias for attribute contexts — same encoding covers both. */
|
|
7
|
+
export declare const escapeHtmlAttr: typeof escapeHtml;
|
|
8
|
+
/**
|
|
9
|
+
* Plain text of an HTML fragment with entities decoded ( → space, etc.)
|
|
10
|
+
* — a tag-strip regex leaves entities behind as literal text.
|
|
11
|
+
*/
|
|
12
|
+
export declare function htmlToText(html: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n content-field helpers — ported verbatim from the old editor's
|
|
3
|
+
* questionset-editor-library/src/lib/utils/i18nField.ts.
|
|
4
|
+
*
|
|
5
|
+
* An I18nValue is a plain string when only English is authored, otherwise a
|
|
6
|
+
* {lang: text} map (empty entries dropped) — normalizeI18n enforces that
|
|
7
|
+
* serialization rule so payloads match the old editor exactly.
|
|
8
|
+
*/
|
|
9
|
+
export type I18nMap = Record<string, string>;
|
|
10
|
+
export type I18nValue = string | I18nMap;
|
|
11
|
+
/** Old editor's ActiveLanguageService.LANGS. */
|
|
12
|
+
export declare const CONTENT_LANGS: readonly [{
|
|
13
|
+
readonly code: "en";
|
|
14
|
+
readonly label: "EN";
|
|
15
|
+
readonly dir: "ltr";
|
|
16
|
+
}, {
|
|
17
|
+
readonly code: "ar";
|
|
18
|
+
readonly label: "AR";
|
|
19
|
+
readonly dir: "rtl";
|
|
20
|
+
}, {
|
|
21
|
+
readonly code: "fr";
|
|
22
|
+
readonly label: "FR";
|
|
23
|
+
readonly dir: "ltr";
|
|
24
|
+
}, {
|
|
25
|
+
readonly code: "pt";
|
|
26
|
+
readonly label: "PT";
|
|
27
|
+
readonly dir: "ltr";
|
|
28
|
+
}];
|
|
29
|
+
export type ContentLang = (typeof CONTENT_LANGS)[number]['code'];
|
|
30
|
+
export declare function readI18n(field: I18nValue | undefined, lang: string): string;
|
|
31
|
+
/** For editor inputs: no fallback — '' if the lang slot doesn't exist yet. */
|
|
32
|
+
export declare function readI18nForEditor(field: I18nValue | undefined, lang: string): string;
|
|
33
|
+
export declare function writeI18n(current: I18nValue | undefined, lang: string, value: string): I18nValue;
|
|
34
|
+
/** Always return an I18nMap object — never collapses to a plain string. */
|
|
35
|
+
export declare function asI18nMap(field: I18nValue | undefined): I18nMap;
|
|
36
|
+
export declare function normalizeI18n(map: I18nMap): I18nValue;
|
|
37
|
+
/** Languages (other than en) that actually carry text in a map. */
|
|
38
|
+
export declare function filledLangs(map: I18nMap): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { II18nText } from '../store/question.store';
|
|
2
|
+
import { QuestionType, IOption, IMatchPair } from '../types/question';
|
|
3
|
+
|
|
4
|
+
interface Args {
|
|
5
|
+
type: QuestionType;
|
|
6
|
+
i18n: II18nText;
|
|
7
|
+
options: IOption[];
|
|
8
|
+
matchPairs: IMatchPair[];
|
|
9
|
+
hintUuid: string;
|
|
10
|
+
solutionId: string;
|
|
11
|
+
solutionType: string;
|
|
12
|
+
buildBodyHtml: (type: QuestionType, questionHtml: string) => string;
|
|
13
|
+
answerWrap: (text: string) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare function applyContentI18n(meta: Record<string, unknown>, a: Args): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type LabelConfig = Record<string, Record<string, unknown>>;
|
|
2
|
+
export declare function resolveUiLanguage(contextLang?: string): string;
|
|
3
|
+
/** Build the merged label config for a language (+ optional host overrides). */
|
|
4
|
+
export declare function setUiLanguage(lang: string, hostLabels?: Record<string, string>): LabelConfig;
|
|
5
|
+
/** Look up "section.key" with a fallback (old configService.labelConfig). */
|
|
6
|
+
export declare function label(path: string, fallback?: string): string;
|
|
7
|
+
/** Same lookup against an explicit config (for store-driven re-renders). */
|
|
8
|
+
export declare function labelFrom(config: LabelConfig, path: string, fallback?: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { INode } from '../types/editor';
|
|
2
|
+
|
|
3
|
+
export type NodeKind = 'root' | 'section' | 'question';
|
|
4
|
+
/**
|
|
5
|
+
* Determines node kind from data fields rather than relying on isFolder alone.
|
|
6
|
+
* Question nodes from the API often have isFolder:true (they have children:[]),
|
|
7
|
+
* so we check mimeType / objectType / questionType / isQuestion first.
|
|
8
|
+
*/
|
|
9
|
+
export declare function detectNodeKind(node: INode): NodeKind;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function notifySuccess(message: string): void;
|
|
2
|
+
export declare function notifyError(message: string): void;
|
|
3
|
+
/** Prefer the server's errmsg (surfaced by the api client) over a generic fallback. */
|
|
4
|
+
export declare function apiErrorMessage(e: unknown, fallback: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IQuestion, QuestionType, IOption } from '../types/question';
|
|
2
|
+
|
|
3
|
+
export declare function deriveQuestionType(raw: Record<string, unknown>): QuestionType | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Options come in two shapes:
|
|
6
|
+
* - old editor editorState: [{ answer: boolean, value: { body, value: idx } }]
|
|
7
|
+
* - new editor / store: [{ id, body, isCorrect }]
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeOptions(rawOptions: unknown, correctIdx: number | undefined): IOption[] | undefined;
|
|
10
|
+
export declare function normalizeQuestionRead(raw: Record<string, unknown>): IQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IContext } from '../types/editor';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
EkTelemetry?: Record<string, (data: Record<string, unknown>) => void>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare function initTelemetry(context: IContext, contentId: string): void;
|
|
9
|
+
export declare function setTelemetryPageId(id: string): void;
|
|
10
|
+
export declare function telemetryStart(): void;
|
|
11
|
+
export declare function telemetryEnd(): void;
|
|
12
|
+
export declare function telemetryImpression(pageid?: string): void;
|
|
13
|
+
export declare function telemetryInteract(id: string, pageid?: string): void;
|
|
14
|
+
export declare function telemetryError(err: string, errtype?: string): void;
|
|
15
|
+
export declare function flushTelemetry(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerQuestionsetEditor(): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@project-sunbird/sunbird-questionset-editor-web-component-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React-based QuML QuestionSet Editor — usable as a React component or as a <sb-questionset-editor> web component in any framework.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sunbird",
|
|
7
|
+
"quml",
|
|
8
|
+
"questionset",
|
|
9
|
+
"editor",
|
|
10
|
+
"web-component",
|
|
11
|
+
"react"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/Sunbird-inQuiry/editor.git",
|
|
17
|
+
"directory": "projects/questionset-editor-react"
|
|
18
|
+
},
|
|
19
|
+
"private": false,
|
|
20
|
+
"type": "module",
|
|
21
|
+
"module": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./dist/style.css": "./dist/style.css"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"sideEffects": [
|
|
34
|
+
"*.css"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"copy-player-assets": "node scripts/copy-player-assets.mjs",
|
|
41
|
+
"predev": "npm run copy-player-assets",
|
|
42
|
+
"dev": "vite",
|
|
43
|
+
"build": "tsc -b && vite build",
|
|
44
|
+
"preview": "vite preview",
|
|
45
|
+
"serve": "node server.js",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@dnd-kit/core": "^6.1.0",
|
|
50
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
51
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
52
|
+
"@project-sunbird/ckeditor-build-classic": "^4.1.3",
|
|
53
|
+
"@project-sunbird/sunbird-quml-player-web-component-react": "^0.1.0",
|
|
54
|
+
"@tanstack/react-query": "^5.51.0",
|
|
55
|
+
"@tiptap/extension-code-block": "^3.27.1",
|
|
56
|
+
"@tiptap/extension-image": "^3.27.1",
|
|
57
|
+
"@tiptap/extension-link": "^3.27.1",
|
|
58
|
+
"@tiptap/extension-mathematics": "^3.27.1",
|
|
59
|
+
"@tiptap/extension-placeholder": "^3.27.1",
|
|
60
|
+
"@tiptap/extension-subscript": "^3.27.1",
|
|
61
|
+
"@tiptap/extension-superscript": "^3.27.1",
|
|
62
|
+
"@tiptap/extension-table": "^3.27.1",
|
|
63
|
+
"@tiptap/extension-table-cell": "^3.27.1",
|
|
64
|
+
"@tiptap/extension-table-header": "^3.27.1",
|
|
65
|
+
"@tiptap/extension-table-row": "^3.27.1",
|
|
66
|
+
"@tiptap/extension-text-align": "^3.27.1",
|
|
67
|
+
"@tiptap/extension-underline": "^3.27.1",
|
|
68
|
+
"@tiptap/pm": "^3.27.1",
|
|
69
|
+
"@tiptap/react": "^3.27.1",
|
|
70
|
+
"@tiptap/starter-kit": "^3.27.1",
|
|
71
|
+
"axios": "^1.7.2",
|
|
72
|
+
"dompurify": "^3.4.11",
|
|
73
|
+
"katex": "^0.16.21",
|
|
74
|
+
"lucide-react": "^0.400.0",
|
|
75
|
+
"react-arborist": "^3.4.0",
|
|
76
|
+
"react-hook-form": "^7.52.0",
|
|
77
|
+
"react-hot-toast": "^2.4.1",
|
|
78
|
+
"react-to-webcomponent": "^1.1.0",
|
|
79
|
+
"zod": "^3.23.8",
|
|
80
|
+
"zustand": "^4.5.4"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
84
|
+
"@testing-library/react": "^16.0.0",
|
|
85
|
+
"@types/node": "^26.0.1",
|
|
86
|
+
"@types/react": "^18.3.3",
|
|
87
|
+
"@types/react-dom": "^18.3.0",
|
|
88
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
89
|
+
"sass": "^1.77.6",
|
|
90
|
+
"typescript": "^5.5.3",
|
|
91
|
+
"vite": "^5.3.4",
|
|
92
|
+
"vite-plugin-dts": "^3.9.1",
|
|
93
|
+
"vitest": "^2.0.3"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
97
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
98
|
+
}
|
|
99
|
+
}
|