@webwriter/quiz 1.0.9 → 1.1.1

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.
Files changed (83) hide show
  1. package/dist/widgets/webwriter-choice-item.js +184 -36
  2. package/dist/widgets/webwriter-choice.js +213 -35
  3. package/dist/widgets/webwriter-cloze-gap.js +174 -29
  4. package/dist/widgets/webwriter-cloze.js +174 -29
  5. package/dist/widgets/webwriter-mark.js +174 -29
  6. package/dist/widgets/webwriter-order-item.js +188 -40
  7. package/dist/widgets/webwriter-order.js +204 -33
  8. package/dist/widgets/webwriter-pairing-item.js +174 -29
  9. package/dist/widgets/webwriter-pairing.js +174 -29
  10. package/dist/widgets/webwriter-quiz.js +176 -30
  11. package/dist/widgets/webwriter-speech.js +174 -29
  12. package/dist/widgets/webwriter-task-explainer.js +174 -29
  13. package/dist/widgets/webwriter-task-hint.js +174 -29
  14. package/dist/widgets/webwriter-task-prompt.js +174 -29
  15. package/dist/widgets/webwriter-task.js +176 -31
  16. package/dist/widgets/webwriter-text.js +200 -38
  17. package/localization/bg.xlf +15 -0
  18. package/localization/cs.xlf +15 -0
  19. package/localization/da.xlf +15 -0
  20. package/localization/de.xlf +20 -0
  21. package/localization/el.xlf +15 -0
  22. package/localization/es.xlf +15 -0
  23. package/localization/et.xlf +15 -0
  24. package/localization/fi.xlf +15 -0
  25. package/localization/fr.xlf +15 -0
  26. package/localization/generated/bg.ts +5 -0
  27. package/localization/generated/cs.ts +5 -0
  28. package/localization/generated/da.ts +5 -0
  29. package/localization/generated/de.ts +6 -1
  30. package/localization/generated/el.ts +5 -0
  31. package/localization/generated/es.ts +5 -0
  32. package/localization/generated/et.ts +5 -0
  33. package/localization/generated/fi.ts +5 -0
  34. package/localization/generated/fr.ts +5 -0
  35. package/localization/generated/hu.ts +5 -0
  36. package/localization/generated/id.ts +5 -0
  37. package/localization/generated/it.ts +5 -0
  38. package/localization/generated/ja.ts +5 -0
  39. package/localization/generated/ko.ts +5 -0
  40. package/localization/generated/lt.ts +5 -0
  41. package/localization/generated/lv.ts +5 -0
  42. package/localization/generated/nb.ts +5 -0
  43. package/localization/generated/nl.ts +5 -0
  44. package/localization/generated/pl.ts +5 -0
  45. package/localization/generated/pt-BR.ts +5 -0
  46. package/localization/generated/pt-PT.ts +5 -0
  47. package/localization/generated/ro.ts +5 -0
  48. package/localization/generated/ru.ts +5 -0
  49. package/localization/generated/sk.ts +5 -0
  50. package/localization/generated/sl.ts +5 -0
  51. package/localization/generated/sv.ts +5 -0
  52. package/localization/generated/tr.ts +5 -0
  53. package/localization/generated/uk.ts +5 -0
  54. package/localization/generated/zh-hans.ts +5 -0
  55. package/localization/hu.xlf +15 -0
  56. package/localization/id.xlf +15 -0
  57. package/localization/it.xlf +15 -0
  58. package/localization/ja.xlf +15 -0
  59. package/localization/ko.xlf +15 -0
  60. package/localization/lt.xlf +15 -0
  61. package/localization/lv.xlf +15 -0
  62. package/localization/nb.xlf +15 -0
  63. package/localization/nl.xlf +15 -0
  64. package/localization/pl.xlf +15 -0
  65. package/localization/pt-BR.xlf +15 -0
  66. package/localization/pt-PT.xlf +15 -0
  67. package/localization/ro.xlf +15 -0
  68. package/localization/ru.xlf +15 -0
  69. package/localization/sk.xlf +15 -0
  70. package/localization/sl.xlf +15 -0
  71. package/localization/sv.xlf +15 -0
  72. package/localization/tr.xlf +15 -0
  73. package/localization/uk.xlf +15 -0
  74. package/localization/zh-hans.xlf +15 -0
  75. package/package.json +8 -54
  76. package/src/snippets/blank.html +1 -0
  77. package/src/widgets/webwriter-choice-item.ts +4 -1
  78. package/src/widgets/webwriter-choice.ts +29 -4
  79. package/src/widgets/webwriter-order-item.ts +5 -2
  80. package/src/widgets/webwriter-order.ts +28 -1
  81. package/src/widgets/webwriter-quiz.ts +2 -1
  82. package/src/widgets/webwriter-task.ts +2 -2
  83. package/src/widgets/webwriter-text.ts +25 -5
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Prompt</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Prompt</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Справка</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Prompt</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Poziv</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Frågeställning</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>İstem</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>Швидко</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
@@ -49,6 +49,21 @@
49
49
  <source>Prompt</source>
50
50
  <target>提示</target>
51
51
  </trans-unit>
52
+ <trans-unit id="sb0aadaa04e658ad6">
53
+ <source>Choice</source>
54
+ </trans-unit>
55
+ <trans-unit id="s2ba5f4d8f3bd7c57">
56
+ <source>Order</source>
57
+ </trans-unit>
58
+ <trans-unit id="s2492f5fb1b05b45e">
59
+ <source>Text</source>
60
+ </trans-unit>
61
+ <trans-unit id="s49c940aecfef3ea0">
62
+ <source>Mark</source>
63
+ </trans-unit>
64
+ <trans-unit id="saa3efba1f0c816b7">
65
+ <source>Speech</source>
66
+ </trans-unit>
52
67
  </body>
53
68
  </file>
54
69
  </xliff>
package/package.json CHANGED
@@ -1,90 +1,39 @@
1
1
  {
2
2
  "name": "@webwriter/quiz",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "Add interactive tasks (multiple choice, order, free text, highlighting, or speech input). Make a quiz out of multiple tasks.",
5
5
  "keywords": [
6
6
  "webwriter-widget",
7
7
  "widget-practical",
8
8
  "widget-lang-en",
9
9
  "widget-lang-de",
10
- "widget-lang-af",
11
- "widget-lang-am",
12
- "widget-lang-ar",
13
- "widget-lang-az",
14
10
  "widget-lang-bg",
15
- "widget-lang-bn",
16
- "widget-lang-bs",
17
- "widget-lang-ca",
18
11
  "widget-lang-cs",
19
- "widget-lang-cy",
20
12
  "widget-lang-da",
21
13
  "widget-lang-el",
22
- "widget-lang-eo",
23
14
  "widget-lang-es",
24
15
  "widget-lang-et",
25
- "widget-lang-eu",
26
- "widget-lang-fa",
27
16
  "widget-lang-fi",
28
- "widget-lang-fil",
29
17
  "widget-lang-fr",
30
- "widget-lang-gl",
31
- "widget-lang-he",
32
- "widget-lang-hi",
33
- "widget-lang-hr",
34
18
  "widget-lang-hu",
35
- "widget-lang-hy",
36
19
  "widget-lang-id",
37
- "widget-lang-is",
38
20
  "widget-lang-it",
39
21
  "widget-lang-ja",
40
- "widget-lang-ka",
41
- "widget-lang-kk",
42
- "widget-lang-km",
43
- "widget-lang-kn",
44
22
  "widget-lang-ko",
45
23
  "widget-lang-lt",
46
24
  "widget-lang-lv",
47
- "widget-lang-mk",
48
- "widget-lang-ml",
49
- "widget-lang-mn",
50
- "widget-lang-mr",
51
- "widget-lang-ms",
52
25
  "widget-lang-nb",
53
- "widget-lang-ne",
54
26
  "widget-lang-nl",
55
- "widget-lang-nn",
56
27
  "widget-lang-pl",
57
28
  "widget-lang-pt",
58
29
  "widget-lang-ro",
59
30
  "widget-lang-ru",
60
- "widget-lang-si",
61
31
  "widget-lang-sk",
62
32
  "widget-lang-sl",
63
- "widget-lang-sq",
64
- "widget-lang-sr",
65
33
  "widget-lang-sv",
66
- "widget-lang-ta",
67
- "widget-lang-tg",
68
- "widget-lang-th",
69
34
  "widget-lang-tr",
70
- "widget-lang-ug",
71
35
  "widget-lang-uk",
72
- "widget-lang-uz",
73
- "widget-lang-vi",
74
- "widget-lang-xh",
75
- "widget-lang-yi",
76
36
  "widget-lang-zh",
77
- "iscedf2013-99",
78
- "iscedf2013-01",
79
- "iscedf2013-02",
80
- "iscedf2013-03",
81
- "iscedf2013-04",
82
- "iscedf2013-05",
83
- "iscedf2013-06",
84
- "iscedf2013-07",
85
- "iscedf2013-08",
86
- "iscedf2013-09",
87
- "iscedf2013-10",
88
37
  "isced2011-1",
89
38
  "isced2011-2",
90
39
  "isced2011-3",
@@ -128,6 +77,7 @@
128
77
  "source": "./src/widgets/webwriter-quiz.ts",
129
78
  "default": "./dist/widgets/webwriter-quiz.*"
130
79
  },
80
+ "./snippets/blank.html": "./src/snippets/blank.html",
131
81
  "./snippets/choice.html": "./src/snippets/choice.html",
132
82
  "./snippets/order.html": "./src/snippets/order.html",
133
83
  "./snippets/text.html": "./src/snippets/text.html",
@@ -202,6 +152,9 @@
202
152
  },
203
153
  "editingConfig": {
204
154
  ".": {
155
+ "label": {
156
+ "_": "Quiz"
157
+ },
205
158
  "description": {
206
159
  "de": "Fügen Sie interaktive Aufgaben hinzu (Multiple Choice, Reihenfolge, freier Text, Hervorhebung oder Spracheingabe). Erstellen Sie ein Quiz aus mehreren Aufgaben."
207
160
  }
@@ -275,7 +228,7 @@
275
228
  },
276
229
  "./widgets/webwriter-task": {
277
230
  "isolating": true,
278
- "content": "webwriter-task-prompt webwriter-task-hint? answer webwriter-task-explainer*",
231
+ "content": "webwriter-task-prompt webwriter-task-hint? answer",
279
232
  "uninsertable": true
280
233
  },
281
234
  "./widgets/webwriter-task-prompt": {
@@ -299,7 +252,8 @@
299
252
  "uninsertable": true
300
253
  },
301
254
  "./widgets/webwriter-quiz": {
302
- "content": "webwriter-task*"
255
+ "content": "webwriter-task*",
256
+ "uninsertable": true
303
257
  }
304
258
  }
305
259
  }
@@ -0,0 +1 @@
1
+ <p>EASTEREGG</p>
@@ -25,6 +25,9 @@ export class WebwriterChoiceItem extends LitElementWw {
25
25
 
26
26
  localize = LOCALIZE
27
27
 
28
+ @property({type: Boolean, attribute: false})
29
+ accessor showSolution = true
30
+
28
31
  @property({type: Boolean, attribute: false})
29
32
  accessor active = false
30
33
 
@@ -242,7 +245,7 @@ export class WebwriterChoiceItem extends LitElementWw {
242
245
 
243
246
  render() {
244
247
  return keyed(this.layout, html`
245
- ${this.valid !== undefined && (this.active || !this.active && this.valid)? html`<sl-icon class="solution user-only" ?data-valid=${this.valid} src=${this.valid? IconCheck: IconX}></sl-icon>`: null}
248
+ ${this.showSolution && this.valid !== undefined && (this.active || !this.active && this.valid)? html`<sl-icon class="solution user-only" ?data-valid=${this.valid} src=${this.valid? IconCheck: IconX}></sl-icon>`: null}
246
249
  <sl-checkbox class=${classMap({valid: this.valid, active: this.active})} exportparts="base, control, label" @click=${this.handleClick} @sl-change=${this.handleChange} ?checked=${this.isContentEditable? this.valid: this.active}>
247
250
  <slot part="slot" style=${styleMap({"--ww-placeholder": `"${msg("Option")}"`})}></slot>
248
251
  </sl-checkbox>
@@ -48,7 +48,6 @@ export class WebwriterChoice extends LitElementWw {
48
48
  })
49
49
  accessor mode: "truefalse" | "single" | "multiple" = "single"
50
50
 
51
-
52
51
  get layout(): "list" | "tiles" {
53
52
  return this.children?.item(0)?.getAttribute("layout") as any ?? "list"
54
53
  }
@@ -69,10 +68,16 @@ export class WebwriterChoice extends LitElementWw {
69
68
  @property({type: Boolean, attribute: true, reflect: true})
70
69
  @option({
71
70
  type: Boolean,
72
- label: {"en": "Random Choice Order"}
71
+ label: {"en": "Random Choice Order", "de": "Zufällige Reihenfolge"}
73
72
  })
74
73
  accessor randomOrder = false
75
74
 
75
+ @property({type: Boolean, attribute: true, reflect: true})
76
+ @option({
77
+ type: Boolean,
78
+ label: {"en": "show Solution", "de": "Lösung anzeigen"},
79
+ })
80
+ accessor showSolution = false
76
81
 
77
82
  get solution() {
78
83
  const validIDs = this.items.filter(item => item.valid).map(item => item.id)
@@ -85,15 +90,35 @@ export class WebwriterChoice extends LitElementWw {
85
90
 
86
91
 
87
92
  reportSolution() {
93
+
94
+ let itemActive: boolean = false
95
+ this.items.forEach(item => {itemActive = itemActive || item.active})
96
+ console.log(itemActive)
97
+ if(!itemActive){
98
+ this.items.forEach(item => {item.valid = undefined; item.active = false; item.style.pointerEvents = "auto"})
99
+ return
100
+ }
101
+ console.warn("h")
88
102
  if(!this.solution) {
89
103
  this.items.forEach(item => item.valid = true)
90
104
  return
91
105
  }
92
- this.items.forEach(item => item.valid = (this.solution ?? []).includes(item.id))
106
+ this.items.forEach(item => {
107
+ item.valid = (this.solution ?? []).includes(item.id)
108
+ console.log(this.solution, item.active, item.valid)
109
+ if(item.active != item.valid && !this.showSolution){
110
+ this.items.forEach(item => {
111
+ item.showSolution = false
112
+ })
113
+ }
114
+ item.style.pointerEvents = "none"
115
+ }
116
+ )
117
+
93
118
  }
94
119
 
95
120
  reset() {
96
- this.items.forEach(item => {item.valid = undefined; item.active = false})
121
+ this.items.forEach(item => {item.valid = undefined; item.active = false; item.showSolution = true; item.style.pointerEvents = "auto"})
97
122
  this.shuffleItems()
98
123
  }
99
124
 
@@ -33,6 +33,9 @@ export class WebwriterOrderItem extends LitElementWw {
33
33
  "sl-icon-button": SlIconButton
34
34
  }
35
35
 
36
+ @property({attribute: false, type: Boolean})
37
+ accessor showSolution = true
38
+
36
39
  @property({attribute: true, reflect: true, converter: {toAttribute: (v: boolean) => v? "true": "false", fromAttribute: (attr: string) => attr === "true"}})
37
40
  accessor draggable = true
38
41
 
@@ -420,7 +423,7 @@ export class WebwriterOrderItem extends LitElementWw {
420
423
  render() {
421
424
  const solution = this.validOrder !== undefined? html`<span class="solution" ?data-valid=${this.elementIndex === this.validOrder}>${this.validOrder + 1}</span>`: null
422
425
  return html`<ol part="base" start=${this.elementIndex + 1}>
423
- ${this.layout === "list"? solution: null}
426
+ ${this.layout === "list" && this.showSolution ? solution: null}
424
427
  <li id="main-li">
425
428
  <slot id="content" style=${styleMap({"--ww-placeholder": `"${msg("Option")}"`, "--offset": `${this.contentSlotEl?.offsetLeft + 1}px`})}></slot>
426
429
  </li>
@@ -431,7 +434,7 @@ export class WebwriterOrderItem extends LitElementWw {
431
434
  </ol>
432
435
  <ol id="count" start=${this.elementIndex + 1}>
433
436
  <li ?data-two-digit=${this.elementIndex + 1 >= 10}></li>
434
- ${this.layout === "tiles"? solution: null}
437
+ ${this.layout === "tiles" && this.showSolution? solution: null}
435
438
  </ol>
436
439
  <div id="handle"></div>`
437
440
  }
@@ -132,11 +132,17 @@ export class WebwriterOrder extends LitElementWw {
132
132
  }
133
133
 
134
134
  @property({type: Boolean, attribute: true, reflect: true}) //@ts-ignore
135
- @option({type: Boolean, label: {_: "Hide order buttons"}})
135
+ @option({type: Boolean, label: {"en": "Hide order buttons", "de": "Pfeile zum Verschieben verstecken"}})
136
136
  set hideOrderButtons(value: boolean) {
137
137
  this.items.forEach(item => item.hideOrderButtons = value)
138
138
  }
139
139
 
140
+ @property({type: Boolean, attribute: true, reflect: true})
141
+ @option({
142
+ type: Boolean,
143
+ label: {"en": "show Solution", "de": "Lösung anzeigen"},
144
+ })
145
+ accessor showSolution = true
140
146
 
141
147
  observer: MutationObserver
142
148
 
@@ -266,12 +272,33 @@ export class WebwriterOrder extends LitElementWw {
266
272
 
267
273
 
268
274
  reportSolution() {
275
+ console.log(this.solution, this.items)
269
276
  this.solution.forEach((id, i) => (this.querySelector(`#${id}`) as any).validOrder = i)
277
+ if(!this.showSolution){
278
+ this.items.forEach(item => {
279
+ console.log(item.validOrder, this.solution.indexOf(item.id))
280
+ if(this.items.indexOf(item) != this.solution.indexOf(item.id)){
281
+ this.items.forEach(i => {
282
+ i.showSolution = false
283
+ })
284
+ }
285
+ })
286
+ }
287
+ this.items.forEach(item=>{
288
+ item.style.pointerEvents="none"
289
+ })
270
290
  }
271
291
 
272
292
  reset() {
273
293
  this.solution = undefined
274
294
  this.shuffleItems()
295
+ this.items.forEach(item=>{
296
+ item.style.pointerEvents="auto"
297
+ })
298
+ }
299
+
300
+ protected firstUpdated(_changedProperties: PropertyValues): void {
301
+ this.showSolution = this.showSolution
275
302
  }
276
303
 
277
304
  render() {
@@ -214,7 +214,8 @@ export class WebwriterQuiz extends LitElementWw {
214
214
  }
215
215
 
216
216
  handleReset = () => {
217
- this.tasks.forEach(task => task.reset())
217
+ console.warn(this.tasks)
218
+ this.tasks.forEach(task => task.handleReset())
218
219
  this.requestUpdate()
219
220
  this.submitted = false
220
221
  }
@@ -522,9 +522,9 @@ export class WebwriterTask extends LitElementWw {
522
522
  <span>${this.ordinalExpr}</span>
523
523
  <slot name="prompt"></slot>
524
524
  <div id="task-buttons">
525
- <sl-icon-button class="author-only" id="feedback" src=${!this.explainers.length? IconPatchCheck: IconPatchCheckFill} @click=${() => this.toggleExplainers()}></sl-icon-button>
525
+ <sl-icon-button style="display: none" class="author-only" id="feedback" src=${!this.explainers.length? IconPatchCheck: IconPatchCheckFill} @click=${() => this.toggleExplainers()}></sl-icon-button>
526
526
  <sl-popup id="hint-popup" ?active=${this.hintOpen} placement="left" arrow auto-size shift @selectstart=${e => e.stopImmediatePropagation()}>
527
- <sl-icon-button class="author-only" slot="anchor" id="hint" src=${!this.hasHintContent && !this.hintOpen? IconPatchQuestion: IconPatchQuestionFill} @click=${() => this.toggleHint()}></sl-icon-button>
527
+ <sl-icon-button slot="anchor" id="hint" src=${!this.hasHintContent && !this.hintOpen? IconPatchQuestion: IconPatchQuestionFill} @click=${() => this.toggleHint()}></sl-icon-button>
528
528
  <div id="hint-content">
529
529
  <slot name="hint" @slotchange=${this.handleHintSlotChange}></slot>
530
530
  </div>
@@ -1,4 +1,4 @@
1
- import {html, css} from "lit"
1
+ import {html, css, PropertyValues} from "lit"
2
2
  import {LitElementWw, option} from "@webwriter/lit"
3
3
  import {customElement, property, query} from "lit/decorators.js"
4
4
  import {ifDefined} from "lit/directives/if-defined.js"
@@ -38,6 +38,26 @@ export class WebwriterText extends LitElementWw {
38
38
  @option()
39
39
  accessor placeholder: string
40
40
 
41
+ @property({type: Boolean, attribute: true, reflect: true})
42
+ @option({
43
+ type: Boolean,
44
+ label: {"en": "Ignore capitalization", "de": "Großschreibung ignorieren"},
45
+ })
46
+ accessor ignoreCase = false
47
+
48
+ @property({type: Boolean, attribute: true, reflect: true})
49
+ @option({
50
+ type: Boolean,
51
+ label: {"en": "show Solution", "de": "Lösung anzeigen"},
52
+ })
53
+ accessor showSolution = false
54
+
55
+ @property({type: String, attribute: true, reflect: true})
56
+ @option({
57
+ label: {"en": "Message for wrong solution", "de": "Nachricht bei falscher Lösung"},
58
+ })
59
+ accessor wrongMessage: string
60
+
41
61
  @property({type: String, attribute: true, reflect: true})
42
62
  accessor value: string
43
63
 
@@ -84,11 +104,11 @@ export class WebwriterText extends LitElementWw {
84
104
  }
85
105
 
86
106
  #solution[data-correct] {
87
- background: var(--sl-color-success-200);
107
+ background-color: var(--sl-color-success-200);
88
108
  }
89
109
 
90
110
  #solution:not([data-correct]) {
91
- background: var(--sl-color-danger-200);
111
+ background-color: var(--sl-color-danger-200);
92
112
  }
93
113
  `
94
114
 
@@ -125,12 +145,12 @@ export class WebwriterText extends LitElementWw {
125
145
  accessor solution: string
126
146
 
127
147
  render() {
128
- const correct = this.solution && this.value?.trim() === this.solution
148
+ const correct = !this.ignoreCase ? this.solution && this.value?.trim() === this.solution : this.solution && this.value?.trim().toLowerCase() === this.solution.toLowerCase()
129
149
  const textarea = html`<sl-textarea ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} resize="none" @sl-change=${this.handleChange}></sl-textarea>`
130
150
  const input = html`<sl-input ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} type=${this.type} @sl-change=${this.handleChange}></sl-input>`
131
151
  return html`
132
152
  ${this.type === "long-text"? textarea: input}
133
- ${this.solution && !this.isContentEditable && !correct? html`<div id="solution" ?data-correct=${correct}>${this.solution}</div>`: undefined}
153
+ ${this.solution && !this.isContentEditable && !correct? html`<div id="solution" ?data-correct=${correct}>${this.showSolution?this.solution:html`<i>${this.wrongMessage}</i>`}</div>`: undefined}
134
154
  `
135
155
  }
136
156
  }