@digabi/exam-engine-core 22.1.3-alpha.3 → 22.1.4-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/dist/__tests__/EditableGradingInstruction.test.js +3 -7
  2. package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -1
  3. package/dist/__tests__/editor/FormatButton.test.d.ts +2 -0
  4. package/dist/__tests__/editor/FormatButton.test.d.ts.map +1 -0
  5. package/dist/__tests__/editor/FormatButton.test.js +97 -0
  6. package/dist/__tests__/editor/FormatButton.test.js.map +1 -0
  7. package/dist/__tests__/editor/Formula.test.js +15 -8
  8. package/dist/__tests__/editor/Formula.test.js.map +1 -1
  9. package/dist/__tests__/editor/ImageUploadButton.test.d.ts +2 -0
  10. package/dist/__tests__/editor/ImageUploadButton.test.d.ts.map +1 -0
  11. package/dist/__tests__/editor/ImageUploadButton.test.js +69 -0
  12. package/dist/__tests__/editor/ImageUploadButton.test.js.map +1 -0
  13. package/dist/__tests__/editor/br.test.js +2 -6
  14. package/dist/__tests__/editor/br.test.js.map +1 -1
  15. package/dist/__tests__/editor/hr.test.js +2 -6
  16. package/dist/__tests__/editor/hr.test.js.map +1 -1
  17. package/dist/__tests__/editor/nbsp.test.js +3 -7
  18. package/dist/__tests__/editor/nbsp.test.js.map +1 -1
  19. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  20. package/dist/__tests__/utils/prosemirror.d.ts +0 -1
  21. package/dist/__tests__/utils/prosemirror.d.ts.map +1 -1
  22. package/dist/__tests__/utils/prosemirror.js +0 -8
  23. package/dist/__tests__/utils/prosemirror.js.map +1 -1
  24. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +2 -0
  25. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +1 -1
  26. package/dist/__tests__/utils/renderEditableGradingInstruction.js +8 -2
  27. package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +1 -1
  28. package/dist/__tests__/utils/util.d.ts +2 -0
  29. package/dist/__tests__/utils/util.d.ts.map +1 -0
  30. package/dist/__tests__/utils/util.js +10 -0
  31. package/dist/__tests__/utils/util.js.map +1 -0
  32. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  33. package/dist/components/context/ExamContext.d.ts.map +1 -1
  34. package/dist/components/context/GradingInstructionContext.d.ts +2 -2
  35. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
  36. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  37. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  38. package/dist/components/context/SectionContext.d.ts.map +1 -1
  39. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
  40. package/dist/components/grading-instructions/EditableGradingInstruction.js +37 -55
  41. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
  42. package/dist/components/grading-instructions/ExamGradingInstruction.d.ts.map +1 -1
  43. package/dist/components/grading-instructions/ExamGradingInstruction.js +7 -2
  44. package/dist/components/grading-instructions/ExamGradingInstruction.js.map +1 -1
  45. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
  46. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
  47. package/dist/components/grading-instructions/GradingInstructionProvider.js +2 -2
  48. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
  49. package/dist/components/grading-instructions/GradingInstructions.d.ts +1 -1
  50. package/dist/components/grading-instructions/GradingInstructions.js +2 -2
  51. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  52. package/dist/components/grading-instructions/editor/Formula.d.ts +1 -0
  53. package/dist/components/grading-instructions/editor/Formula.d.ts.map +1 -1
  54. package/dist/components/grading-instructions/editor/Formula.js +17 -4
  55. package/dist/components/grading-instructions/editor/Formula.js.map +1 -1
  56. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts +6 -0
  57. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts.map +1 -0
  58. package/dist/components/grading-instructions/editor/ImageUploadButton.js +73 -0
  59. package/dist/components/grading-instructions/editor/ImageUploadButton.js.map +1 -0
  60. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +4 -0
  61. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +1 -0
  62. package/dist/components/grading-instructions/editor/schemas/image-schema.js +47 -0
  63. package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +1 -0
  64. package/dist/main-bundle.js +1 -1
  65. package/dist/main-bundle.js.LICENSE.txt +1 -1
  66. package/dist/main.css +1 -1
  67. package/package.json +2 -2
  68. package/dist/components/Localization.d.ts +0 -5
  69. package/dist/components/Localization.d.ts.map +0 -1
  70. package/dist/components/Localization.js +0 -9
  71. package/dist/components/Localization.js.map +0 -1
  72. package/dist/components/grading-instructions/GradingInstruction.d.ts +0 -7
  73. package/dist/components/grading-instructions/GradingInstruction.d.ts.map +0 -1
  74. package/dist/components/grading-instructions/GradingInstruction.js +0 -9
  75. package/dist/components/grading-instructions/GradingInstruction.js.map +0 -1
  76. package/dist/components/grading-instructions/editor/CurrentElement.d.ts +0 -2
  77. package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +0 -1
  78. package/dist/components/grading-instructions/editor/CurrentElement.js +0 -8
  79. package/dist/components/grading-instructions/editor/CurrentElement.js.map +0 -1
  80. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +0 -5
  81. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +0 -1
  82. package/dist/components/grading-instructions/editor/CurrentLocalization.js +0 -17
  83. package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +0 -1
  84. package/dist/components/grading-instructions/editor/Localization.d.ts +0 -3
  85. package/dist/components/grading-instructions/editor/Localization.d.ts.map +0 -1
  86. package/dist/components/grading-instructions/editor/Localization.js +0 -36
  87. package/dist/components/grading-instructions/editor/Localization.js.map +0 -1
  88. package/dist/components/grading-instructions/editor/localizatio.d.ts +0 -3
  89. package/dist/components/grading-instructions/editor/localizatio.d.ts.map +0 -1
  90. package/dist/components/grading-instructions/editor/localizatio.js +0 -36
  91. package/dist/components/grading-instructions/editor/localizatio.js.map +0 -1
  92. package/dist/components/grading-instructions/editor/localizationSpan.d.ts +0 -3
  93. package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +0 -1
  94. package/dist/components/grading-instructions/editor/localizationSpan.js +0 -36
  95. package/dist/components/grading-instructions/editor/localizationSpan.js.map +0 -1
  96. package/dist/components/grading-instructions/editor/spanWithPath.d.ts +0 -3
  97. package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +0 -1
  98. package/dist/components/grading-instructions/editor/spanWithPath.js +0 -24
  99. package/dist/components/grading-instructions/editor/spanWithPath.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploadButton.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/ImageUploadButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,EAAE,MAAM,EAAe,UAAU,EAAE,MAAM,OAAO,CAAA;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,IAAK,YAIJ;AAJD,WAAK,YAAY;IACf,6CAA6B,CAAA;IAC7B,6CAA6B,CAAA;IAC7B,6CAA6B,CAAA;AAC/B,CAAC,EAJI,YAAY,KAAZ,YAAY,QAIhB;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAA+C;IAC1F,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAA;IACtD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACrD,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC3D,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,QAAQ,CAAC,OA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C,EAC1C,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,iBAC3B,qBAAqB,GACjC,CACD,CACJ,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { NodeSpec } from 'prosemirror-model';
2
+ export declare const imageInputSchema: (resolveAttachment: (filename: string) => string) => NodeSpec;
3
+ export declare const imageOutputSchema: NodeSpec;
4
+ //# sourceMappingURL=image-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-schema.d.ts","sourceRoot":"","sources":["../../../../../src/components/grading-instructions/editor/schemas/image-schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAK5C,eAAO,MAAM,gBAAgB,sBAAuB,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,KAAG,QA6BjF,CAAA;AAIF,eAAO,MAAM,iBAAiB,EAAE,QAY/B,CAAA"}
@@ -0,0 +1,47 @@
1
+ import * as _ from 'lodash-es';
2
+ import { schema as baseSchema } from 'prosemirror-schema-basic';
3
+ const existingImageNode = baseSchema.spec.nodes.get('image');
4
+ export const imageInputSchema = (resolveAttachment) => ({
5
+ ...existingImageNode,
6
+ attrs: {
7
+ ...existingImageNode === null || existingImageNode === void 0 ? void 0 : existingImageNode.attrs,
8
+ width: { default: null },
9
+ height: { default: null },
10
+ class: { default: null },
11
+ lang: { default: null }
12
+ },
13
+ parseDOM: [
14
+ {
15
+ tag: '[data-editor-id="e-image"], img',
16
+ getAttrs(element) {
17
+ const src = element.getAttribute('src');
18
+ if (!src || src.startsWith('data:')) {
19
+ return false;
20
+ }
21
+ const attrs = {
22
+ ...Object.fromEntries(Array.from(element.attributes).map(attr => [attr.name, attr.value])),
23
+ src: resolveAttachment(element.getAttribute('src') || '')
24
+ };
25
+ return attrs;
26
+ }
27
+ }
28
+ ],
29
+ toDOM(node) {
30
+ return ['img', node.attrs];
31
+ }
32
+ });
33
+ const pathToFilename = (path) => path.split('/').pop();
34
+ export const imageOutputSchema = {
35
+ toDOM(node) {
36
+ const attrs = _.pick(node.attrs, ['lang', 'class', 'src']);
37
+ const filteredAttrs = _.pickBy(attrs, _.isString);
38
+ const attributes = _.mapValues(filteredAttrs, (value, key) => {
39
+ if (key === 'src') {
40
+ return pathToFilename(value);
41
+ }
42
+ return value;
43
+ });
44
+ return ['e:image', attributes];
45
+ }
46
+ };
47
+ //# sourceMappingURL=image-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-schema.js","sourceRoot":"","sources":["../../../../../src/components/grading-instructions/editor/schemas/image-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAE9B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,iBAAiB,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAE5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,iBAA+C,EAAY,EAAE,CAAC,CAAC;IAC9F,GAAG,iBAAiB;IACpB,KAAK,EAAE;QACL,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,KAAK;QAC3B,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACxB,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACzB,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACxB,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KACxB;IACD,QAAQ,EAAE;QACR;YACE,GAAG,EAAE,iCAAiC;YACtC,QAAQ,CAAC,OAAO;gBACd,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;gBAEvC,IAAI,CAAC,GAAG,IAAI,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