@windward/core 0.2.0 → 0.2.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 (50) hide show
  1. package/components/Content/Blocks/Accordion.vue +12 -7
  2. package/components/Content/Blocks/BlockQuote.vue +3 -1
  3. package/components/Content/Blocks/ClickableIcons.vue +29 -27
  4. package/components/Content/Blocks/Email.vue +3 -1
  5. package/components/Content/Blocks/Feedback.vue +3 -12
  6. package/components/Content/Blocks/Image.vue +1 -1
  7. package/components/Content/Blocks/Math.vue +3 -1
  8. package/components/Content/Blocks/ScenarioChoice.vue +3 -1
  9. package/components/Content/Blocks/Tab.vue +3 -1
  10. package/components/Content/Blocks/UserUpload.vue +3 -1
  11. package/components/Settings/AccordionSettings.vue +1 -3
  12. package/components/Settings/BlockQuoteSettings.vue +1 -1
  13. package/components/Settings/ClickableIconsSettings.vue +1 -1
  14. package/components/Settings/EmailSettings.vue +1 -1
  15. package/components/Settings/FeedbackSettings.vue +3 -1
  16. package/components/Settings/MathSettings.vue +1 -1
  17. package/components/Settings/ScenarioChoiceSettings.vue +3 -1
  18. package/components/Settings/TabSettings.vue +1 -1
  19. package/components/Settings/UserUploadSettings.vue +1 -1
  20. package/components/utils/ContentViewer.vue +2 -1
  21. package/components/utils/FillInBlank/FillInTheBlanksManager.vue +20 -24
  22. package/components/utils/MathExpressionEditor.vue +82 -85
  23. package/components/utils/MathLiveWrapper.vue +3 -1
  24. package/components/utils/TinyMCEWrapper.vue +62 -17
  25. package/components/utils/glossary/CourseGlossaryForm.vue +1 -0
  26. package/config/tinymce.config.ts +313 -0
  27. package/helpers/tinymce/plugin.ts +32 -25
  28. package/i18n/en-US/components/utils/math_expression_editor.ts +11 -0
  29. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  30. package/i18n/en-US/pages/index.ts +2 -0
  31. package/i18n/en-US/pages/plugins/error.ts +9 -0
  32. package/i18n/en-US/pages/plugins/index.ts +5 -0
  33. package/i18n/en-US/shared/settings.ts +1 -1
  34. package/i18n/es-ES/components/utils/math_expression_editor.ts +11 -0
  35. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  36. package/i18n/es-ES/pages/index.ts +2 -0
  37. package/i18n/es-ES/pages/plugins/error.ts +9 -0
  38. package/i18n/es-ES/pages/plugins/index.ts +5 -0
  39. package/i18n/sv-SE/components/utils/math_expression_editor.ts +11 -0
  40. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  41. package/i18n/sv-SE/pages/index.ts +2 -0
  42. package/i18n/sv-SE/pages/plugins/error.ts +8 -0
  43. package/i18n/sv-SE/pages/plugins/index.ts +5 -0
  44. package/package.json +1 -1
  45. package/pages/plugins/tinymce/_plugin.vue +79 -0
  46. package/plugin.js +10 -0
  47. package/test/Pages/Plugins/TinyMce.spec.js +23 -0
  48. package/test/__mocks__/componentsMock.js +0 -12
  49. package/test/mocks.js +1 -0
  50. package/config/tinymce.config.js +0 -136
@@ -5,13 +5,16 @@
5
5
  flat
6
6
  accordion
7
7
  focusable
8
- id="expansion-panel-setting"
8
+ class="expansion-panels-container"
9
9
  >
10
10
  <v-expansion-panel
11
11
  v-for="(item, itemIndex) in block.metadata.config.items"
12
12
  :key="itemIndex"
13
13
  >
14
- <v-expansion-panel-header class="header" color="primary">
14
+ <v-expansion-panel-header
15
+ class="expansion-panel-header"
16
+ color="primary"
17
+ >
15
18
  {{
16
19
  item.header === '' || item.header === null
17
20
  ? 'Item ' + (itemIndex + 1)
@@ -19,7 +22,7 @@
19
22
  }}
20
23
  </v-expansion-panel-header>
21
24
  <v-expansion-panel-content
22
- class="body"
25
+ class="expansion-panel-body"
23
26
  :key="expansionPanelKey"
24
27
  >
25
28
  <v-container>
@@ -77,7 +80,9 @@ export default {
77
80
  if (_.isEmpty(this.block.metadata.config.currentAccordion)) {
78
81
  this.block.metadata.config.currentAccordion = 0
79
82
  }
80
- this.block.body = 'accordion'
83
+ this.block.body = this.$t(
84
+ 'windward.core.shared.content_blocks.title.accordion'
85
+ )
81
86
  },
82
87
  data() {
83
88
  return {
@@ -125,14 +130,14 @@ export default {
125
130
  </script>
126
131
 
127
132
  <style lang="scss" scoped>
128
- .header {
133
+ .expansion-panel-header {
129
134
  color: white;
130
135
  margin-top: 1px;
131
136
  }
132
- .body {
137
+ .expansion-panel-body {
133
138
  background: var(--v-surface-base);
134
139
  }
135
- #expansion-panel-setting {
140
+ .expansion-panels-container {
136
141
  z-index: 0;
137
142
  }
138
143
  </style>
@@ -70,7 +70,9 @@ export default {
70
70
  source_type: '',
71
71
  }
72
72
  }
73
- this.block.body = 'block quote'
73
+ this.block.body = this.$t(
74
+ 'windward.core.components.content.blocks.block_quote.body'
75
+ )
74
76
  },
75
77
  data() {
76
78
  return {
@@ -71,6 +71,35 @@ export default {
71
71
  TextViewer,
72
72
  },
73
73
  extends: BaseContentBlock,
74
+ beforeMount() {
75
+ // Apply the default config
76
+ this.block.body = this.$t(
77
+ 'windward.core.shared.content_blocks.title.clickable_icons'
78
+ )
79
+ if (_.isEmpty(this.block.metadata.config.items)) {
80
+ this.block.metadata.config.items = []
81
+ }
82
+ if (_.isEmpty(this.block.metadata.config.title)) {
83
+ this.block.metadata.config.title = ''
84
+ }
85
+ if (_.isEmpty(this.block.metadata.config.description)) {
86
+ this.block.metadata.config.description = ''
87
+ }
88
+ if (_.isEmpty(this.block.metadata.config.display)) {
89
+ this.block.metadata.config.display = {
90
+ show_title: false,
91
+ show_background: false,
92
+ round_icon: false,
93
+ italic_icon: false,
94
+ autocolor: true,
95
+ }
96
+ }
97
+ if (this.block.metadata.config.items.length) {
98
+ for (const index in this.block.metadata.config.items) {
99
+ this.block.metadata.config.items[index].active = false
100
+ }
101
+ }
102
+ },
74
103
  data() {
75
104
  return {}
76
105
  },
@@ -146,33 +175,6 @@ export default {
146
175
  }
147
176
  },
148
177
  },
149
- beforeMount() {
150
- // Apply the default config
151
- this.block.body = 'clickable icons'
152
- if (_.isEmpty(this.block.metadata.config.items)) {
153
- this.block.metadata.config.items = []
154
- }
155
- if (_.isEmpty(this.block.metadata.config.title)) {
156
- this.block.metadata.config.title = ''
157
- }
158
- if (_.isEmpty(this.block.metadata.config.description)) {
159
- this.block.metadata.config.description = ''
160
- }
161
- if (_.isEmpty(this.block.metadata.config.display)) {
162
- this.block.metadata.config.display = {
163
- show_title: false,
164
- show_background: false,
165
- round_icon: false,
166
- italic_icon: false,
167
- autocolor: true,
168
- }
169
- }
170
- if (this.block.metadata.config.items.length) {
171
- for (const index in this.block.metadata.config.items) {
172
- this.block.metadata.config.items[index].active = false
173
- }
174
- }
175
- },
176
178
  methods: {
177
179
  isIcon(str) {
178
180
  return str && _.isString(str) && str.indexOf('mdi-') === 0
@@ -231,7 +231,9 @@ export default {
231
231
  if (_.isEmpty(this.block.metadata.config.activeEmail)) {
232
232
  this.block.metadata.config.activeEmail = 0
233
233
  }
234
- this.block.body = 'emails'
234
+ this.block.body = this.$t(
235
+ 'windward.core.components.content.blocks.email.title'
236
+ )
235
237
  },
236
238
  data() {
237
239
  return {
@@ -186,7 +186,9 @@ export default {
186
186
  if (_.isEmpty(this.block.metadata.config.definition)) {
187
187
  this.block.metadata.config.definition = {}
188
188
  }
189
- this.block.body = 'feedback'
189
+ this.block.body = this.$t(
190
+ 'windward.core.components.content.blocks.feedback.feedback'
191
+ )
190
192
  },
191
193
  data() {
192
194
  return {
@@ -318,14 +320,3 @@ export default {
318
320
  },
319
321
  }
320
322
  </script>
321
- <style scoped>
322
- .question {
323
- font-weight: bold;
324
- }
325
- .radio-group {
326
- width: 100% !important;
327
- }
328
- .likert-radio {
329
- margin-left: 55px;
330
- }
331
- </style>
@@ -78,7 +78,7 @@
78
78
 
79
79
  <script>
80
80
  import _ from 'lodash'
81
- import DialogBox from '~/components/DialogBox'
81
+ import DialogBox from '~/components/DialogBox.vue'
82
82
  import TextViewer from '~/components/Text/TextViewer'
83
83
  import Crypto from '~/helpers/Crypto'
84
84
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
@@ -33,7 +33,9 @@ export default {
33
33
  this.block = {}
34
34
  }
35
35
  if (_.isEmpty(this.block.body)) {
36
- this.block.body = 'Math Editor'
36
+ this.block.body = this.$t(
37
+ 'windward.core.shared.content_blocks.title.math'
38
+ )
37
39
  }
38
40
  if (_.isEmpty(this.block.metadata)) {
39
41
  this.block.metadata = {}
@@ -202,7 +202,9 @@ export default {
202
202
  },
203
203
  beforeMount() {
204
204
  // Apply the default config
205
- this.block.body = 'scenario choice'
205
+ this.block.body = this.$t(
206
+ 'windward.core.shared.content_blocks.title.scenario_choice'
207
+ )
206
208
  if (_.isEmpty(this.block.metadata.config.items)) {
207
209
  this.block.metadata.config.items = []
208
210
  }
@@ -49,7 +49,9 @@ export default {
49
49
  },
50
50
  extends: BaseContentBlock,
51
51
  beforeMount() {
52
- this.block.body = 'tab'
52
+ this.block.body = this.$t(
53
+ 'windward.core.shared.content_blocks.title.tab'
54
+ )
53
55
  if (_.isEmpty(this.block.metadata.config.items)) {
54
56
  const defaultObject = {
55
57
  tabHeader: '',
@@ -119,7 +119,9 @@ export default {
119
119
  this.block = {}
120
120
  }
121
121
  if (_.isEmpty(this.block.body)) {
122
- this.block.body = 'user uplaod'
122
+ this.block.body = this.$t(
123
+ 'windward.core.shared.content_blocks.title.user_upload'
124
+ )
123
125
  }
124
126
  if (_.isEmpty(this.block.metadata)) {
125
127
  this.block.metadata = {}
@@ -134,9 +134,7 @@ export default {
134
134
  if (_.isEmpty(this.block.metadata.config.currentAccordion)) {
135
135
  this.block.metadata.config.currentAccordion = 0
136
136
  }
137
- this.block.body = this.$t(
138
- 'windward.core.components.settings.accordion.accordion'
139
- )
137
+ this.block.body = this.$t('windward.core.shared.content_blocks.title.accordion')
140
138
  },
141
139
  data() {
142
140
  return {
@@ -117,7 +117,7 @@ export default {
117
117
  }
118
118
  }
119
119
  this.block.body = this.$t(
120
- 'windward.core.shared.settings.title.block_quote'
120
+ 'windward.core.components.content.blocks.block_quote.body'
121
121
  )
122
122
  },
123
123
  data() {
@@ -171,7 +171,7 @@ export default {
171
171
  this.block = {}
172
172
  }
173
173
  if (_.isEmpty(this.block.body)) {
174
- this.block.body = 'clickable icons'
174
+ this.block.body = this.$t('windward.core.shared.content_blocks.title.clickable_icons')
175
175
  }
176
176
  if (_.isEmpty(this.block.metadata)) {
177
177
  this.block.metadata = {}
@@ -161,7 +161,7 @@ export default {
161
161
  }
162
162
  this.block.metadata.config.emails.push(defaultObject)
163
163
  }
164
- this.block.body = 'emails'
164
+ this.block.body = this.$t('windward.core.components.content.blocks.email.title')
165
165
  },
166
166
  data() {
167
167
  return {
@@ -53,7 +53,9 @@ export default {
53
53
  if (_.isEmpty(this.block.metadata.config.definition)) {
54
54
  this.block.metadata.config.definition = {}
55
55
  }
56
- this.block.body = 'feedback'
56
+ this.block.body = this.$t(
57
+ 'windward.core.components.content.blocks.feedback.feedback'
58
+ )
57
59
  },
58
60
  data() {
59
61
  return {
@@ -36,7 +36,7 @@ export default {
36
36
  this.block = {}
37
37
  }
38
38
  if (_.isEmpty(this.block.body)) {
39
- this.block.body = 'Math Editor'
39
+ this.block.body = this.$t('windward.core.shared.content_blocks.title.math')
40
40
  }
41
41
  if (_.isEmpty(this.block.metadata)) {
42
42
  this.block.metadata = {}
@@ -231,7 +231,9 @@ export default {
231
231
  this.block = {}
232
232
  }
233
233
  if (_.isEmpty(this.block.body)) {
234
- this.block.body = 'scenario choice'
234
+ this.block.body = this.$t(
235
+ 'windward.core.shared.content_blocks.title.scenario_choice'
236
+ )
235
237
  }
236
238
  if (_.isEmpty(this.block.metadata)) {
237
239
  this.block.metadata = {}
@@ -85,7 +85,7 @@ export default {
85
85
  }
86
86
  if (_.isEmpty(this.block.body)) {
87
87
  this.block.body = this.$t(
88
- 'windward.core.components.settings.tab.tab'
88
+ 'windward.core.shared.content_blocks.title.tab'
89
89
  )
90
90
  }
91
91
  if (_.isEmpty(this.block.metadata)) {
@@ -62,7 +62,7 @@ export default {
62
62
  this.block = {}
63
63
  }
64
64
  if (_.isEmpty(this.block.body)) {
65
- this.block.body = 'user uplaod'
65
+ this.block.body = this.$t('windward.core.shared.content_blocks.title.user_upload')
66
66
  }
67
67
  if (_.isEmpty(this.block.metadata)) {
68
68
  this.block.metadata = {}
@@ -33,7 +33,8 @@ export default {
33
33
  content = _.cloneDeep(this.value)
34
34
  if (
35
35
  MathHelper.containsMathML(content) ||
36
- MathHelper.containsLatex(content)
36
+ MathHelper.containsLatex(content) ||
37
+ MathHelper.containSREnhancedLatex(content)
37
38
  ) {
38
39
  content = MathHelper.convertMathContentToHtml(content)
39
40
  }
@@ -1,30 +1,26 @@
1
1
  <template>
2
2
  <v-container>
3
3
  <v-row align="center" justify="center">
4
- <v-col>
5
- <v-row align="center" justify="center">
6
- <v-text-field
7
- class="col-10"
8
- :label="
9
- $t(
10
- 'windward.core.components.utils.fill_in_the_blank.fill_in_the_blank_manager.answer'
11
- )
12
- "
13
- v-model="answer"
14
- outlined
15
- @input="submit"
16
- ></v-text-field>
17
- </v-row>
18
-
19
- <br />
20
-
21
- <v-row align="center" justify="center">
22
- <TextEditor
23
- :key="key"
24
- v-model="feedback"
25
- @input="submit"
26
- ></TextEditor>
27
- </v-row>
4
+ <v-col cols="12">
5
+ <v-text-field
6
+ :label="
7
+ $t(
8
+ 'windward.core.components.utils.fill_in_the_blank.fill_in_the_blank_manager.answer'
9
+ )
10
+ "
11
+ v-model="answer"
12
+ outlined
13
+ @input="submit"
14
+ ></v-text-field>
15
+ </v-col>
16
+ </v-row>
17
+ <v-row>
18
+ <v-col cols="12">
19
+ <TextEditor
20
+ :key="key"
21
+ v-model="feedback"
22
+ @input="submit"
23
+ ></TextEditor>
28
24
  </v-col>
29
25
  </v-row>
30
26
  </v-container>
@@ -8,18 +8,7 @@
8
8
  )
9
9
  }}
10
10
  </v-card-title>
11
- <v-card-text>
12
- <math-live-wrapper
13
- ref="mathfield"
14
- v-model="formula"
15
- :id="mathElementId"
16
- :options="options"
17
- :value="value"
18
- @change="submit"
19
- ></math-live-wrapper>
20
- </v-card-text>
21
- </v-card>
22
- <v-card>
11
+
23
12
  <v-card-text>
24
13
  <v-tabs
25
14
  v-model="tab"
@@ -29,9 +18,7 @@
29
18
  show-arrows
30
19
  >
31
20
  <v-tabs-slider color="primary"></v-tabs-slider>
32
- <v-tab>
33
- {{ $t('shared.accessibility.accessibility') }}</v-tab
34
- >
21
+
35
22
  <v-tab
36
23
  v-for="(keyboard, index) in config.buttons.groups"
37
24
  :key="index"
@@ -41,80 +28,85 @@
41
28
  </v-tabs>
42
29
 
43
30
  <v-tabs-items v-model="tab">
44
- <v-tab-item>
45
- <v-card-text>
46
- <v-container>
47
- <v-row align="center">
48
- <v-checkbox
49
- v-model="spokenTextChanged"
50
- hide-details
51
- class="shrink mr-2 mt-0"
52
- ></v-checkbox>
53
- <v-textarea
54
- v-model="spokenText"
55
- :disabled="!spokenTextChanged"
56
- :label="
57
- $t(
58
- 'shared.accessibility.set_aria_label_text'
59
- )
60
- "
61
- class="col-md-12"
62
- @input="submit"
63
- ></v-textarea>
64
- </v-row>
65
- </v-container>
66
-
67
- <br />
68
- <v-btn
69
- primary
70
- color="success"
71
- @click="setSRText"
72
- :class="fontSize"
73
- >{{ $t('shared.accessibility.default_text') }}
74
- </v-btn>
75
- <v-btn
76
- :disabled="spokenTextChanged"
77
- color="primary"
78
- :class="fontSize"
79
- @click="readSRText"
80
- >{{
81
- $t(
82
- 'shared.accessibility.read_default_aria_label_text'
83
- )
84
- }}</v-btn
85
- >
86
- </v-card-text>
87
- </v-tab-item>
88
31
  <v-tab-item
89
32
  v-for="(keyboard, index) in config.buttons.groups"
90
33
  :key="index"
91
34
  >
92
- <v-card flat>
93
- <v-card-text>
94
- <v-container>
95
- <v-btn-toggle mandatory>
96
- <button
97
- v-for="(
98
- button, buttonIndex
99
- ) in keyboard.buttons"
100
- :key="buttonIndex"
101
- class="btn"
102
- @click="insert(button)"
103
- >
104
- <div
105
- v-html="
106
- convertLatexToMarkup(
107
- button.text
108
- )
109
- "
110
- ></div>
111
- </button>
112
- </v-btn-toggle>
113
- </v-container>
114
- </v-card-text>
115
- </v-card>
35
+ <v-container>
36
+ <div class="flex-wrap col-12">
37
+ <v-btn
38
+ :min-height="index < 4 ? 40 : 60"
39
+ v-for="(
40
+ button, buttonIndex
41
+ ) in keyboard.buttons"
42
+ :key="buttonIndex"
43
+ class="btn"
44
+ @click="insert(button)"
45
+ v-html="convertLatexToMarkup(button.text)"
46
+ >
47
+ </v-btn>
48
+ </div>
49
+ </v-container>
116
50
  </v-tab-item>
117
51
  </v-tabs-items>
52
+
53
+ <math-live-wrapper
54
+ ref="mathfield"
55
+ v-model="formula"
56
+ :id="mathElementId"
57
+ :options="options"
58
+ :value="value"
59
+ @change="submit"
60
+ ></math-live-wrapper>
61
+ <br />
62
+ <v-container>
63
+ <v-row align="center">
64
+ <v-switch
65
+ v-model="spokenTextChanged"
66
+ :label="
67
+ $t(
68
+ 'windward.core.components.utils.math_expression_editor.custom_screen_reader_text'
69
+ )
70
+ "
71
+ hide-details
72
+ class="shrink mr-2 mt-0"
73
+ ></v-switch>
74
+ <v-textarea
75
+ v-model="spokenText"
76
+ :disabled="!spokenTextChanged"
77
+ :label="
78
+ $t(
79
+ 'windward.core.components.utils.math_expression_editor.screen_reader_text'
80
+ )
81
+ "
82
+ class="col-md-12"
83
+ @input="submit"
84
+ ></v-textarea>
85
+ </v-row>
86
+ </v-container>
87
+
88
+ <br />
89
+ <v-row class="float-right">
90
+ <v-btn
91
+ primary
92
+ color="success"
93
+ @click="setSRText"
94
+ :class="fontSize"
95
+ >{{
96
+ $t(
97
+ 'windward.core.components.utils.math_expression_editor.default_screen_reader_text'
98
+ )
99
+ }}
100
+ </v-btn>
101
+ &nbsp;
102
+ <v-btn color="primary" :class="fontSize" @click="readSRText"
103
+ >{{
104
+ $t(
105
+ 'windward.core.components.utils.math_expression_editor.read_text_aloud'
106
+ )
107
+ }}
108
+ </v-btn>
109
+ </v-row>
118
110
  </v-card-text>
119
111
  </v-card>
120
112
  </div>
@@ -142,7 +134,7 @@ export default {
142
134
  options: {
143
135
  smartFence: true,
144
136
  smartMode: false,
145
- virtualKeyboardMode: 'manual',
137
+ virtualKeyboardMode: 'auto',
146
138
  keypressSound: 'none',
147
139
  plonkSound: 'none',
148
140
  readOnly: false,
@@ -268,7 +260,12 @@ export default {
268
260
  this.spokenText = this.convertLatexToSpeakableText(this.formula)
269
261
  },
270
262
  readSRText() {
271
- this.$refs.mathfield.executeCommand('speak')
263
+ if (!this.spokenText) {
264
+ this.$refs.mathfield.executeCommand('speak')
265
+ } else {
266
+ const utterance = new SpeechSynthesisUtterance(this.spokenText)
267
+ speechSynthesis.speak(utterance)
268
+ }
272
269
  },
273
270
  },
274
271
  }
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <math-field :id="id"><slot></slot></math-field>
2
+ <math-field :id="id" style="font-size: 1.5rem; display: block"
3
+ ><slot></slot
4
+ ></math-field>
3
5
  </template>
4
6
 
5
7
  <script>