@windward/core 0.8.0 → 0.9.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 (34) hide show
  1. package/.eslintrc.js +5 -1
  2. package/.prettierrc +3 -2
  3. package/CHANGELOG.md +3 -0
  4. package/components/Content/Blocks/ClickableIcons.vue +3 -9
  5. package/components/Content/Blocks/GenerateAIQuestionButton.vue +85 -18
  6. package/components/Content/Blocks/Image.vue +7 -182
  7. package/components/Content/Blocks/Tab.vue +10 -0
  8. package/components/Navigation/Items/GlossaryNav.vue +25 -10
  9. package/components/Settings/ImageSettings.vue +12 -240
  10. package/components/Settings/TabSettings.vue +17 -1
  11. package/components/Settings/TextEditorSettings.vue +17 -15
  12. package/components/utils/ContentViewer.vue +0 -3
  13. package/components/utils/FillInBlank/FillInBlankInput.vue +29 -47
  14. package/components/utils/TinyMCEWrapper.vue +37 -79
  15. package/components/utils/glossary/CourseGlossary.vue +5 -3
  16. package/components/utils/glossary/GlossaryToolTip.vue +8 -1
  17. package/helpers/GlossaryHelper.ts +38 -18
  18. package/helpers/tinymce/WindwardPlugins.ts +166 -118
  19. package/i18n/en-US/components/content/blocks/generate_questions.ts +3 -2
  20. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  21. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  22. package/i18n/es-ES/components/content/blocks/generate_questions.ts +2 -1
  23. package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  24. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +3 -2
  25. package/i18n/sv-SE/components/content/blocks/generate_questions.ts +2 -1
  26. package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  27. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +2 -0
  28. package/package.json +2 -1
  29. package/pages/glossary.vue +1 -1
  30. package/stylelint.config.js +14 -0
  31. package/test/Components/Content/Blocks/OpenResponseCollate.spec.js +3 -3
  32. package/test/Components/Settings/TabSettings.spec.js +2 -2
  33. package/test/__mocks__/contentBlockMock.js +20 -0
  34. package/test/helpers/GlossaryHelper.spec.js +17 -0
@@ -1,6 +1,6 @@
1
1
  import { Scanner } from 'accessibility-scanner'
2
- import local from '../../i18n/index'
3
2
  import _ from 'lodash'
3
+ import local from '../../i18n/index'
4
4
 
5
5
  /**
6
6
  * Class representing the WindwardPlugins.
@@ -9,11 +9,9 @@ export class WindwardPlugins {
9
9
  editor: any
10
10
  formula: any
11
11
  fillInBlank: any
12
- private window: any;
13
-
12
+ private window: any
14
13
 
15
14
  constructor(editor: any) {
16
-
17
15
  this.editor = editor
18
16
  this.formula = undefined
19
17
  this.fillInBlank = undefined
@@ -21,16 +19,18 @@ export class WindwardPlugins {
21
19
  this.register()
22
20
  }
23
21
 
24
- public $t(key: string, replacements: string[]=[]): string {
25
- const lang = local.messages[navigator.languages[0]]; // Get the browser language
26
- let str = _.get(lang, key); // Get the message string using lodash's get function
22
+ public $t(key: string, replacements: string[] = []): string {
23
+ const lang = local.messages[_.get(navigator, 'languages[0]', 'en-US')] // Get the browser language
24
+ let str = _.get(lang, key) // Get the message string using lodash's get function
27
25
 
28
- str = str.replace(/{(\d+)}/g, (match, number) => replacements[number] ?? match);
26
+ str = str.replace(
27
+ /{(\d+)}/g,
28
+ (match: any, number: any) => replacements[number] ?? match
29
+ )
29
30
 
30
- return str;
31
+ return str
31
32
  }
32
33
 
33
-
34
34
  /**
35
35
  * registers an icon with the given icon name and SVG path.
36
36
  *
@@ -40,18 +40,24 @@ export class WindwardPlugins {
40
40
  * @return {void}
41
41
  */
42
42
  private registerIcon(iconName: string, svgPath: string) {
43
- this.editor.ui.registry.addIcon(
44
- iconName,
45
- svgPath
46
- )
43
+ this.editor.ui.registry.addIcon(iconName, svgPath)
47
44
  }
48
45
  /**
49
46
  * Adds icons to the editor's UI registry.
50
47
  */
51
48
  private addIcons() {
52
- this.registerIcon('mathIcon', '<svg x="0px" y="0px"width="20px" height="20px" viewBox="0 0 445.878 445.878" style="enable-background:new 0 0 445.878 445.878;"><path d="M426.024,86.447H209.705l-84.911,298.911c-2.568,7.967-9.854,13.482-18.22,13.771c-0.236,0-0.464,0.006-0.688,0.006 c-8.092,0-15.41-4.924-18.436-12.478l-34.714-86.782H19.851C8.884,299.876,0,290.986,0,280.022 c0-10.965,8.893-19.854,19.851-19.854H66.18c8.109,0,15.421,4.941,18.436,12.483l19.237,48.09l72.472-260.218 c2.639-8.213,10.279-13.781,18.903-13.781h230.798c10.97,0,19.854,8.89,19.854,19.851S436.988,86.447,426.024,86.447z M436.723,353.227l-78.259-87.904l74.576-82.783c1.318-1.454,1.638-3.547,0.857-5.341c-0.804-1.791-2.577-2.946-4.54-2.946h-47.18 c-1.442,0-2.802,0.629-3.759,1.72l-50.059,58.047l-49.674-58.029c-0.939-1.103-2.317-1.738-3.771-1.738h-49.334 c-1.956,0-3.729,1.149-4.521,2.929c-0.81,1.785 0.479,3.875,0.824,5.332l73.743,82.81l-77.641,87.923 c-1.297,1.465-1.605,3.552 0.813,5.325c0.813,1.785,2.586,2.92,4.528,2.92h48.9c1.472,0,2.867-0.65,3.807-1.785l51.819-62.181 l53.05,62.229c0.951,1.11,2.328,1.743,3.782,1.743h49.97c1.962,0,3.735-1.141,4.527-2.926 C438.354,356.779,438.035,354.692,436.723,353.227z"/></svg>');
53
- this.registerIcon('fibIcon', '<svg width="20px" height="20px" viewBox="0 0 24 24"><path d="M17,7H22V17H17V19A1,1 0 0,0 18,20H20V22H17.5C16.95,22 16,21.55 16,21C16,21.55 15.05,22 14.5,22H12V20H14A1,1 0 0,0 15,19V5A1,1 0 0,0 14,4H12V2H14.5C15.05,2 16,2.45 16,3C16,2.45 16.95,2 17.5,2H20V4H18A1,1 0 0,0 17,5V7M2,7H13V9H4V15H13V17H2V7M20,15V9H17V15H20Z" /></svg>');
54
- this.registerIcon('glossaryIcon', '<svg viewBox="0 0 24 24" width="20px" height="20px" ><path d="M3,15H1V3A2,2 0 0,1 3,1H19V3H3V15M12,23A1,1 0 0,1 11,22V19H7A2,2 0 0,1 5,17V7A2,2 0 0,1 7,5H21A2,2 0 0,1 23,7V17A2,2 0 0,1 21,19H16.9L13.2,22.71C13,22.89 12.76,23 12.5,23H12M9,9V11H19V9H9M9,13V15H17V13H9Z"></path></svg>');
49
+ this.registerIcon(
50
+ 'mathIcon',
51
+ '<svg x="0px" y="0px"width="20px" height="20px" viewBox="0 0 445.878 445.878" style="enable-background:new 0 0 445.878 445.878;"><path d="M426.024,86.447H209.705l-84.911,298.911c-2.568,7.967-9.854,13.482-18.22,13.771c-0.236,0-0.464,0.006-0.688,0.006 c-8.092,0-15.41-4.924-18.436-12.478l-34.714-86.782H19.851C8.884,299.876,0,290.986,0,280.022 c0-10.965,8.893-19.854,19.851-19.854H66.18c8.109,0,15.421,4.941,18.436,12.483l19.237,48.09l72.472-260.218 c2.639-8.213,10.279-13.781,18.903-13.781h230.798c10.97,0,19.854,8.89,19.854,19.851S436.988,86.447,426.024,86.447z M436.723,353.227l-78.259-87.904l74.576-82.783c1.318-1.454,1.638-3.547,0.857-5.341c-0.804-1.791-2.577-2.946-4.54-2.946h-47.18 c-1.442,0-2.802,0.629-3.759,1.72l-50.059,58.047l-49.674-58.029c-0.939-1.103-2.317-1.738-3.771-1.738h-49.334 c-1.956,0-3.729,1.149-4.521,2.929c-0.81,1.785 0.479,3.875,0.824,5.332l73.743,82.81l-77.641,87.923 c-1.297,1.465-1.605,3.552 0.813,5.325c0.813,1.785,2.586,2.92,4.528,2.92h48.9c1.472,0,2.867-0.65,3.807-1.785l51.819-62.181 l53.05,62.229c0.951,1.11,2.328,1.743,3.782,1.743h49.97c1.962,0,3.735-1.141,4.527-2.926 C438.354,356.779,438.035,354.692,436.723,353.227z"/></svg>'
52
+ )
53
+ this.registerIcon(
54
+ 'fibIcon',
55
+ '<svg width="20px" height="20px" viewBox="0 0 24 24"><path d="M17,7H22V17H17V19A1,1 0 0,0 18,20H20V22H17.5C16.95,22 16,21.55 16,21C16,21.55 15.05,22 14.5,22H12V20H14A1,1 0 0,0 15,19V5A1,1 0 0,0 14,4H12V2H14.5C15.05,2 16,2.45 16,3C16,2.45 16.95,2 17.5,2H20V4H18A1,1 0 0,0 17,5V7M2,7H13V9H4V15H13V17H2V7M20,15V9H17V15H20Z" /></svg>'
56
+ )
57
+ this.registerIcon(
58
+ 'glossaryIcon',
59
+ '<svg viewBox="0 0 24 24" width="20px" height="20px" ><path d="M3,15H1V3A2,2 0 0,1 3,1H19V3H3V15M12,23A1,1 0 0,1 11,22V19H7A2,2 0 0,1 5,17V7A2,2 0 0,1 7,5H21A2,2 0 0,1 23,7V17A2,2 0 0,1 21,19H16.9L13.2,22.71C13,22.89 12.76,23 12.5,23H12M9,9V11H19V9H9M9,13V15H17V13H9Z"></path></svg>'
60
+ )
55
61
  }
56
62
  /**
57
63
  * Opens the equation editor window in the TinyMCE editor.
@@ -61,8 +67,8 @@ export class WindwardPlugins {
61
67
  this.editor.addCommand('equation-window', (data: any) => {
62
68
  return this.editor.windowManager.openUrl({
63
69
  url: '/plugins/tinymce/math',
64
- width: .75*this.window.innerWidth,
65
- height: .9*this.window.innerHeight,
70
+ width: 0.75 * this.window.innerWidth,
71
+ height: 0.9 * this.window.innerHeight,
66
72
  title: 'Equation editor',
67
73
  buttons: [
68
74
  {
@@ -79,7 +85,7 @@ export class WindwardPlugins {
79
85
  if (data.currentTarget) {
80
86
  this.editor.selection.select(data.currentTarget)
81
87
  }
82
- this.editor.selection.setContent(
88
+ this.editor.selection.setContent(
83
89
  ` <span class='windward-math-content'>` +
84
90
  this.formula +
85
91
  `</span> `
@@ -95,7 +101,10 @@ export class WindwardPlugins {
95
101
  this.formula = message.content
96
102
  break
97
103
  case 'math-plugin-mounted':
98
- this.window.postMessage({ latex: data.latex ?? '' }, '*')
104
+ this.window.postMessage(
105
+ { latex: data.latex ?? '' },
106
+ '*'
107
+ )
99
108
  break
100
109
  }
101
110
  },
@@ -103,67 +112,77 @@ export class WindwardPlugins {
103
112
  })
104
113
  }
105
114
 
106
- /**
107
- * Adds custom buttons to the editor's user interface registry.
108
- */
109
- private addButtons() {
110
-
111
- this.addButtonToEditor(
112
- "mathButton",
113
- "mathIcon",
114
- this.$t('windward.core.components.utils.tiny_mce_wrapper.math'),
115
- () => {
116
- this.editor.execCommand("equation-window", true);
117
- }
118
- );
119
- this.addButtonToEditor(
120
- "glossaryButton",
121
- "glossaryIcon",
122
- this.$t('windward.core.components.utils.tiny_mce_wrapper.glossary'),
123
- () => {
124
- this.editor.formatter.apply("glossary");
125
- }
126
- );
127
- this.addButtonToEditor(
128
- "fibInsertButton",
129
- "fibIcon",
130
- this.$t('windward.core.components.utils.tiny_mce_wrapper.fill_blank'),
131
- () => {
132
- this.editor.execCommand("fib-window", true);
133
- }
134
- );
135
- this.addButtonToEditor(
136
- "fibFormatButton",
137
- "fibIcon",
138
- this.$t('windward.core.components.utils.tiny_mce_wrapper.fill_blank'),
139
- () => {
140
- this.editor.formatter.apply("fib");
141
- }
142
- );
115
+ /**
116
+ * Adds custom buttons to the editor's user interface registry.
117
+ */
118
+ private addButtons() {
119
+ this.addButtonToEditor(
120
+ 'mathButton',
121
+ 'mathIcon',
122
+ this.$t('windward.core.components.utils.tiny_mce_wrapper.math'),
123
+ () => {
124
+ this.editor.execCommand('equation-window', true)
125
+ }
126
+ )
127
+ this.addButtonToEditor(
128
+ 'glossaryButton',
129
+ 'glossaryIcon',
130
+ this.$t('windward.core.components.utils.tiny_mce_wrapper.glossary'),
131
+ () => {
132
+ this.editor.formatter.apply('glossary')
133
+ }
134
+ )
135
+ this.addButtonToEditor(
136
+ 'fibInsertButton',
137
+ 'fibIcon',
138
+ this.$t(
139
+ 'windward.core.components.utils.tiny_mce_wrapper.fill_blank'
140
+ ),
141
+ () => {
142
+ this.editor.execCommand('fib-window', true)
143
+ }
144
+ )
145
+ this.addButtonToEditor(
146
+ 'fibFormatButton',
147
+ 'fibIcon',
148
+ this.$t(
149
+ 'windward.core.components.utils.tiny_mce_wrapper.fill_blank'
150
+ ),
151
+ () => {
152
+ this.editor.formatter.apply('fib')
153
+ }
154
+ )
143
155
 
144
- this.addButtonToEditor(
145
- "a11yButton",
146
- "accessibility-check",
147
- this.$t('windward.core.components.utils.tiny_mce_wrapper.accessibility'),
148
- () => {
149
- this.setAccessibilityIssues(this.editor)
150
- }
151
- );
152
- }
156
+ this.addButtonToEditor(
157
+ 'a11yButton',
158
+ 'accessibility-check',
159
+ this.$t(
160
+ 'windward.core.components.utils.tiny_mce_wrapper.accessibility'
161
+ ),
162
+ () => {
163
+ this.setAccessibilityIssues(this.editor)
164
+ }
165
+ )
166
+ }
153
167
 
154
- /**
155
- * Add a button to the editor's UI registry
156
- * @param {string} name Name of the button
157
- * @param {string} icon Icon name of the button
158
- * @param {() => void} onAction Callback function for the action to be done when the button is clicked
159
- */
160
- private addButtonToEditor(name: string, icon: string, tooltip: string, onAction: () => void) {
161
- this.editor.ui.registry.addButton(name, {
162
- icon: icon,
163
- tooltip: tooltip,
164
- onAction: onAction
165
- });
166
- }
168
+ /**
169
+ * Add a button to the editor's UI registry
170
+ * @param {string} name Name of the button
171
+ * @param {string} icon Icon name of the button
172
+ * @param {() => void} onAction Callback function for the action to be done when the button is clicked
173
+ */
174
+ private addButtonToEditor(
175
+ name: string,
176
+ icon: string,
177
+ tooltip: string,
178
+ onAction: () => void
179
+ ) {
180
+ this.editor.ui.registry.addButton(name, {
181
+ icon: icon,
182
+ tooltip: tooltip,
183
+ onAction: onAction,
184
+ })
185
+ }
167
186
  /**
168
187
  * Adds a menu item to the editor's UI registry.
169
188
  *
@@ -173,14 +192,19 @@ export class WindwardPlugins {
173
192
  * @param icon - The command to be executed on item click.
174
193
  * @returns {void}
175
194
  */
176
- private addEditorMenuItem(itemKey: string, itemText: string, command: string, icon: string): void {
195
+ private addEditorMenuItem(
196
+ itemKey: string,
197
+ itemText: string,
198
+ command: string,
199
+ icon: string
200
+ ): void {
177
201
  this.editor.ui.registry.addMenuItem(itemKey, {
178
202
  text: itemText,
179
203
  icon: icon,
180
204
  onAction: () => {
181
205
  this.editor.execCommand(command, true)
182
206
  },
183
- });
207
+ })
184
208
  }
185
209
 
186
210
  /**
@@ -188,8 +212,13 @@ export class WindwardPlugins {
188
212
  * @returns {void}
189
213
  */
190
214
  private addMenuItems() {
191
- this.addEditorMenuItem('math', 'Math', 'equation-window','mathIcon');
192
- this.addEditorMenuItem('FIB', 'Fill in the blank', 'fib-window','fibIcon');
215
+ this.addEditorMenuItem('math', 'Math', 'equation-window', 'mathIcon')
216
+ this.addEditorMenuItem(
217
+ 'FIB',
218
+ 'Fill in the blank',
219
+ 'fib-window',
220
+ 'fibIcon'
221
+ )
193
222
  }
194
223
 
195
224
  /**
@@ -199,8 +228,7 @@ export class WindwardPlugins {
199
228
  * @returns {void}
200
229
  */
201
230
  private init() {
202
-
203
- this.editor.on('init',()=>{
231
+ this.editor.on('init', () => {
204
232
  this.setOnDoubleClickEquationContent(this.editor)
205
233
  this.setOnClickFillInBlank(this.editor)
206
234
  })
@@ -212,11 +240,10 @@ export class WindwardPlugins {
212
240
  *
213
241
  * @returns {void} This method does not return anything.
214
242
  */
215
- private setContent() {
216
- this.editor.on('SetContent', () => {
243
+ private setContent() {
244
+ this.editor.on('SetContent', () => {
217
245
  this.setOnDoubleClickEquationContent(this.editor)
218
246
  this.setOnClickFillInBlank(this.editor)
219
-
220
247
  })
221
248
  }
222
249
 
@@ -224,8 +251,8 @@ export class WindwardPlugins {
224
251
  * Adds event listeners for handling input events.
225
252
  * @return {void}
226
253
  */
227
- setInputEvents() {
228
- this.editor.on('input', () =>{
254
+ setInputEvents() {
255
+ this.editor.on('input', () => {
229
256
  this.setOnDoubleClickEquationContent(this.editor)
230
257
  this.setOnClickFillInBlank(this.editor)
231
258
  })
@@ -262,11 +289,13 @@ export class WindwardPlugins {
262
289
  * Opens a fill in the blank window in the TinyMCE editor.
263
290
  * @return {void}
264
291
  */
265
- fillInBlankWindow() {
266
- this.editor.addCommand('fib-window', (data: any) => {
292
+ fillInBlankWindow() {
293
+ this.editor.addCommand('fib-window', (data: any) => {
267
294
  return this.editor.windowManager.openUrl({
268
295
  url: '/plugins/tinymce/FIB',
269
- title: this.$t('windward.core.components.utils.tiny_mce_wrapper.fill_blank'),
296
+ title: this.$t(
297
+ 'windward.core.components.utils.tiny_mce_wrapper.fill_blank'
298
+ ),
270
299
  buttons: [
271
300
  {
272
301
  type: 'cancel',
@@ -284,10 +313,10 @@ export class WindwardPlugins {
284
313
  }
285
314
  this.editor.selection.setContent(
286
315
  `<span class='windward-fill-blank' data-feedback =` +
287
- this.fillInBlank.feedback +
288
- ` >` +
289
- this.fillInBlank.answer +
290
- `</span>`
316
+ this.fillInBlank.feedback +
317
+ ` >` +
318
+ this.fillInBlank.answer +
319
+ `</span>`
291
320
  )
292
321
 
293
322
  this.editor.windowManager.close()
@@ -304,7 +333,10 @@ export class WindwardPlugins {
304
333
  break
305
334
  case 'fib-plugin-mounted':
306
335
  this.window.parent.postMessage(
307
- { answer: data.answer, feedback: data.feedback },
336
+ {
337
+ answer: data.answer,
338
+ feedback: data.feedback,
339
+ },
308
340
  '*'
309
341
  )
310
342
  break
@@ -343,28 +375,45 @@ export class WindwardPlugins {
343
375
  }
344
376
  }
345
377
 
346
-
347
378
  setAccessibilityIssues(editor: any) {
348
- const tinymceDoc = editor.getDoc();
349
- tinymceDoc.querySelectorAll("p.a11y-error").forEach(el => el.remove());
350
- tinymceDoc.querySelectorAll(".a11y-error--highlight").forEach(el => el.classList.remove("a11y-error--highlight"));
351
- const scanner = Scanner.fromHtmlText(editor.getContent());
352
- const report = scanner.runScan();
379
+ const tinymceDoc = editor.getDoc()
380
+ tinymceDoc
381
+ .querySelectorAll('p.a11y-error')
382
+ .forEach((el: any) => el.remove())
383
+ tinymceDoc
384
+ .querySelectorAll('.a11y-error--highlight')
385
+ .forEach((el: any) => el.classList.remove('a11y-error--highlight'))
386
+ const scanner = Scanner.fromHtmlText(editor.getContent())
387
+ const report = scanner.runScan()
353
388
  report.forEach((lineItem: any) => {
354
- lineItem.issues.forEach((item) => {
355
- let elements = Array.prototype
356
- .slice.call(tinymceDoc.getElementsByTagName(item.tagName));
357
- elements = elements.filter((res) => res.outerHTML === item.outerHTML) //only get the element that are on report
358
- elements.forEach(element => {
359
- element.classList.add("a11y-error--highlight");
360
- element.outerHTML = element.outerHTML + "<p class=\"a11y-error\" ><em>" + this.$t("windward.core.components.utils.tiny_mce_wrapper." + lineItem.key) +" "+ this.$t("windward.core.components.utils.tiny_mce_wrapper.wcag_guidelines",[lineItem.success_criterion]) +".</em></p>";
361
-
362
- });
363
- });
364
- });
389
+ lineItem.issues.forEach((item: any) => {
390
+ let elements = Array.prototype.slice.call(
391
+ tinymceDoc.getElementsByTagName(item.tagName)
392
+ )
393
+ elements = elements.filter(
394
+ (res) => res.outerHTML === item.outerHTML
395
+ )
396
+ // only get the element that are on report
397
+ elements.forEach((element) => {
398
+ element.classList.add('a11y-error--highlight')
399
+ element.outerHTML =
400
+ element.outerHTML +
401
+ '<p class="a11y-error" ><em>' +
402
+ this.$t(
403
+ 'windward.core.components.utils.tiny_mce_wrapper.' +
404
+ lineItem.key
405
+ ) +
406
+ ' ' +
407
+ this.$t(
408
+ 'windward.core.components.utils.tiny_mce_wrapper.wcag_guidelines',
409
+ [lineItem.success_criterion]
410
+ ) +
411
+ '.</em></p>'
412
+ })
413
+ })
414
+ })
365
415
  }
366
416
 
367
-
368
417
  /**
369
418
  * Registers the application, initializing necessary components and setting up the user interface.
370
419
  *
@@ -381,4 +430,3 @@ export class WindwardPlugins {
381
430
  this.init()
382
431
  }
383
432
  }
384
-
@@ -1,4 +1,5 @@
1
1
  export default {
2
- error: "Could not generate question from provided content.",
3
- button_label: 'Generate Question'
2
+ error: 'Could not generate question from provided content.',
3
+ button_label: 'Generate Question',
4
+ selected_pages: 'Selected Page',
4
5
  }
@@ -10,4 +10,6 @@ export default {
10
10
  input_incorrect: "'{0}' is incorrect",
11
11
  reset: 'reset',
12
12
  try_again: 'Try Again',
13
+ user_input: 'Your answer: {0}',
14
+ correct_answer: 'Correct answer: {0}',
13
15
  }
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  accessibility: 'Accessibility',
3
+ aria_text: 'Press ALT + F10 or fn + option + F10 to get to the toolbar.',
3
4
  glossary: 'Glossary',
4
5
  term: 'Glossary Term',
5
6
  alternate_forms: 'Alternate Forms',
@@ -1,4 +1,5 @@
1
1
  export default {
2
2
  error: "No se pudo generar una pregunta a partir del contenido proporcionado.",
3
- button_label: 'Generar pregunta'
3
+ button_label: 'Generar pregunta',
4
+ selected_pages: 'Página seleccionada',
4
5
  }
@@ -10,4 +10,6 @@ export default {
10
10
  input_incorrect: "'{0}' es incorrecto",
11
11
  reset: 'restablecer',
12
12
  try_again: 'Intentar de nuevo',
13
+ user_input: 'Tu respuesta: {0}',
14
+ correct_answer: 'Respuesta correcta: {0}',
13
15
  }
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  accessibility: 'Accesibilidad',
3
+ aria_text:
4
+ 'Presione ALT + F10 o fn + opción + F10 para acceder a la barra de herramientas.',
3
5
  glossary: 'Glosario',
4
6
  term: 'Término del glosario',
5
7
  alternate_forms: 'Formas alternativas',
@@ -25,6 +27,5 @@ export default {
25
27
  wcag_guidelines: '(Directrices WCAG {0})',
26
28
  link_href_missing:
27
29
  'El Elemento HTML Anchor <a> debe contener un atributo href',
28
- link_text_missing:
29
- 'El Elemento HTML Anchor <a> debe contener texto. ',
30
+ link_text_missing: 'El Elemento HTML Anchor <a> debe contener texto. ',
30
31
  }
@@ -1,4 +1,5 @@
1
1
  export default {
2
2
  error: "Kunde inte generera en fråga från det tillhandahållna innehållet.",
3
- button_label: 'Generera fråga'
3
+ button_label: 'Generera fråga',
4
+ selected_pages: 'Vald sida',
4
5
  }
@@ -10,4 +10,6 @@ export default {
10
10
  input_incorrect: "'{0}' är felaktig",
11
11
  reset: 'återställ',
12
12
  try_again: 'Try Again',
13
+ user_input: 'Ditt svar: {0}',
14
+ correct_answer: 'Rätt svar: {0}',
13
15
  }
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  accessibility: 'Tillgänglighet',
3
+ aria_text:
4
+ 'Tryck på ALT + F10 eller fn + alternativ + F10 för att komma till verktygsfältet.',
3
5
  glossary: 'Ordlista',
4
6
  term: 'Ordlista Term',
5
7
  alternate_forms: 'Alternativa formulär',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -38,6 +38,7 @@
38
38
  "@babel/preset-env": "^7.16.11",
39
39
  "@mindedge/vue-api-query": "^1.14.0",
40
40
  "@nuxtjs/axios": "^5.13.6",
41
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
41
42
  "@types/lodash": "^4.14.180",
42
43
  "@vue/cli-plugin-babel": "^5.0.4",
43
44
  "@vue/cli-plugin-typescript": "^5.0.4",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-row justify="center" align="center">
3
- <v-col cols="10">
3
+ <v-col cols="12">
4
4
  <div class="d-flex mb-5">
5
5
  <h2 class="mr-auto flex-grow-1">
6
6
  {{ $t('windward.core.pages.glossary.title') }}
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
3
+ // add your custom config here
4
+ // https://stylelint.io/user-guide/configure
5
+ rules: {
6
+ 'at-rule-no-unknown': null,
7
+ 'selector-pseudo-element-no-unknown': [
8
+ true,
9
+ {
10
+ ignorePseudoElements: ['v-deep'],
11
+ },
12
+ ],
13
+ },
14
+ }
@@ -2,13 +2,13 @@ import { shallowMount } from '@vue/test-utils'
2
2
  import Vue from 'vue'
3
3
  import Vuetify from 'vuetify'
4
4
  import { defaultMocks } from '@/test/mocks'
5
- import Image from '@/components/Content/Blocks/Image.vue'
5
+ import OpenResponseCollate from '@/components/Content/Blocks/OpenResponseCollate.vue'
6
6
 
7
7
  Vue.use(Vuetify)
8
8
 
9
- describe('Image content block component', () => {
9
+ describe('OpenResponseCollate content block component', () => {
10
10
  test('is a Vue instance', () => {
11
- const wrapper = shallowMount(Image, {
11
+ const wrapper = shallowMount(OpenResponseCollate, {
12
12
  vuetify: new Vuetify(),
13
13
  mocks: defaultMocks,
14
14
  propsData: {
@@ -27,8 +27,8 @@ describe('TabSettings', () => {
27
27
  })
28
28
  wrapper.vm.onAddElement()
29
29
  expect(wrapper.vm.$data.block.metadata.config.items).toEqual([
30
- { tabHeader: '', expand: false, content: '' },
31
- { tabHeader: '', expand: false, content: '' },
30
+ { tabHeader: '', expand: false, content: '', imageAsset: null },
31
+ { tabHeader: '', expand: false, content: '', imageAsset: null },
32
32
  ])
33
33
  })
34
34
 
@@ -20,6 +20,26 @@ jest.mock(
20
20
  { virtual: true }
21
21
  )
22
22
 
23
+ jest.mock(
24
+ '~/components/Content/ImageAssetViewer.vue',
25
+ () => {
26
+ return jest.fn().mockImplementation(() => {
27
+ return { test: () => {} }
28
+ })
29
+ },
30
+ { virtual: true }
31
+ )
32
+
33
+ jest.mock(
34
+ '~/components/Content/Settings/ImageAssetSettings.vue',
35
+ () => {
36
+ return jest.fn().mockImplementation(() => {
37
+ return { test: () => {} }
38
+ })
39
+ },
40
+ { virtual: true }
41
+ )
42
+
23
43
  jest.mock(
24
44
  '~/components/Content/Blocks/BaseContentBlock',
25
45
  () => {
@@ -20,6 +20,8 @@ const glossaryWord4 =
20
20
  '<span class="glossary-word" aria-label="Glossary Term">architect</span>'
21
21
  const glossaryWord5 =
22
22
  '<span class="glossary-word" aria-label="Glossary Term">universe</span>'
23
+ const accentedGlossaryTerm =
24
+ '<span class="glossary-word" aria-label="Glossary Term">valores perif&eacute;ricos</span>'
23
25
  const glossaryWordSpaceBefore =
24
26
  '<span class="glossary-word" aria-label="Glossary Term"> Crisis change</span>'
25
27
  const glossaryWordSpaceAfter =
@@ -54,6 +56,13 @@ const glossary = [
54
56
  alternate_forms: ['crisis', 'change'],
55
57
  related_term: null,
56
58
  },
59
+ {
60
+ term: 'valores periféricos',
61
+ definition:
62
+ 'Valores que son importantes pero no esenciales para una organización.',
63
+ tags: 'valores periféricos',
64
+ alternate_forms: [],
65
+ },
57
66
  ]
58
67
  const glossaryRender =
59
68
  '<p>Voluptas est quis ut <strong>consequatur.</strong> ' +
@@ -147,6 +156,14 @@ describe('GlossaryHelper ', () => {
147
156
  )
148
157
  ).toEqual([term])
149
158
  })
159
+ test('can retrieve verified glossary terms from accented words encoded to htmlentitites', () => {
160
+ expect(
161
+ GlossaryHelper.getContentVerifiedGlossaryTerms(
162
+ accentedGlossaryTerm + contentHtml,
163
+ glossary
164
+ )
165
+ ).toEqual([new GlossaryTerm(glossary[4])])
166
+ })
150
167
  test('can retrieve un-verified glossary terms', () => {
151
168
  expect(
152
169
  GlossaryHelper.getContentUnVerifiedGlossaryTerms(