@windward/core 0.4.0 → 0.4.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 (36) hide show
  1. package/components/Content/Blocks/BlockQuote.vue +2 -2
  2. package/components/Content/Blocks/ClickableIcons.vue +1 -1
  3. package/components/Content/Blocks/Email.vue +10 -6
  4. package/components/Content/Blocks/Feedback.vue +12 -5
  5. package/components/Content/Blocks/OpenResponse.vue +7 -3
  6. package/components/Content/Blocks/OpenResponseCollate.vue +1 -1
  7. package/components/Content/Blocks/ScenarioChoice.vue +2 -2
  8. package/components/Content/Blocks/UserUpload/DisplayUserFilesTable.vue +2 -0
  9. package/components/Content/Blocks/UserUpload.vue +1 -0
  10. package/components/Content/Blocks/Video.vue +2 -2
  11. package/components/Navigation/Items/AskTheExpert.vue +1 -0
  12. package/components/Settings/AccordionSettings.vue +2 -0
  13. package/components/Settings/ClickableIconsSettings.vue +5 -1
  14. package/components/Settings/EmailSettings.vue +6 -1
  15. package/components/Settings/FeedbackSettings.vue +1 -0
  16. package/components/Settings/MathSettings.vue +1 -1
  17. package/components/Settings/ScenarioChoiceSettings.vue +1 -0
  18. package/components/Settings/TabSettings.vue +7 -1
  19. package/components/Settings/TextEditorSettings.vue +3 -2
  20. package/components/Settings/UserUploadSettings.vue +1 -1
  21. package/components/Settings/VideoSettings.vue +2 -0
  22. package/components/utils/FillInBlank/FillInBlankInput.vue +3 -0
  23. package/components/utils/MathExpressionEditor.vue +30 -9
  24. package/components/utils/MathLiveWrapper.vue +47 -25
  25. package/components/utils/TinyMCEWrapper.vue +102 -18
  26. package/components/utils/glossary/CourseGlossary.vue +2 -0
  27. package/config/tinymce.config.ts +17 -13
  28. package/helpers/MathHelper.ts +59 -0
  29. package/helpers/tinymce/WindwardPlugins.ts +335 -0
  30. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  31. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  32. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  33. package/package.json +3 -2
  34. package/test/helpers/MathHelper.spec.js +14 -1
  35. package/tsconfig.json +4 -1
  36. package/helpers/tinymce/plugin.ts +0 -210
@@ -7,9 +7,9 @@
7
7
  "
8
8
  >
9
9
  <v-col cols="12" class="pb-0">
10
- <h3 v-if="block.metadata.config.title">
10
+ <h2 v-if="block.metadata.config.title">
11
11
  {{ block.metadata.config.title }}
12
- </h3>
12
+ </h2>
13
13
  <p v-if="block.metadata.config.instructions" class="pb-0 mb-0">
14
14
  {{ block.metadata.config.instructions }}
15
15
  </p>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-container>
4
- <h3>{{ block.metadata.config.title }}</h3>
4
+ <h2>{{ block.metadata.config.title }}</h2>
5
5
 
6
6
  <h4>{{ block.metadata.config.description }}</h4>
7
7
 
@@ -7,9 +7,9 @@
7
7
  "
8
8
  >
9
9
  <v-col cols="12" class="pa-0">
10
- <h3 v-if="block.metadata.config.title">
10
+ <h2 v-if="block.metadata.config.title">
11
11
  {{ block.metadata.config.title }}
12
- </h3>
12
+ </h2>
13
13
  <p v-if="block.metadata.config.instructions" class="pb-0 mb-0">
14
14
  {{ block.metadata.config.instructions }}
15
15
  </p>
@@ -170,7 +170,7 @@
170
170
  >
171
171
  <v-row class="pt-4">
172
172
  <v-col cols="10" class="pa-0">
173
- <v-btn color="primary" text>
173
+ <v-btn elevation="0" color="primary" text>
174
174
  <v-icon>mdi-reply</v-icon>
175
175
  {{
176
176
  $t(
@@ -178,7 +178,7 @@
178
178
  )
179
179
  }}</v-btn
180
180
  >
181
- <v-btn color="primary" text>
181
+ <v-btn elevation="0" color="primary" text>
182
182
  <v-icon>mdi-reply-all</v-icon>
183
183
  {{
184
184
  $t(
@@ -186,7 +186,7 @@
186
186
  )
187
187
  }}</v-btn
188
188
  >
189
- <v-btn color="primary" text>
189
+ <v-btn elevation="0" color="primary" text>
190
190
  <v-icon>mdi-share</v-icon>
191
191
  {{
192
192
  $t(
@@ -196,7 +196,11 @@
196
196
  >
197
197
  </v-col>
198
198
  <v-col cols="2" class="pa-0 d-flex justify-end">
199
- <v-btn color="primary" outlined>
199
+ <v-btn
200
+ elevation="0"
201
+ color="primary"
202
+ outlined
203
+ >
200
204
  {{
201
205
  $t(
202
206
  'windward.core.components.content.blocks.email.reset'
@@ -2,7 +2,7 @@
2
2
  <v-container>
3
3
  <v-container v-if="!doesFeedbackExist">
4
4
  <v-row>
5
- <h3>
5
+ <h2>
6
6
  {{
7
7
  block.metadata.config.definition.name
8
8
  ? block.metadata.config.definition.name
@@ -10,7 +10,7 @@
10
10
  'windward.core.components.content.blocks.feedback.feedback'
11
11
  )
12
12
  }}
13
- </h3>
13
+ </h2>
14
14
  </v-row>
15
15
  <v-row class="pt-2">
16
16
  <p>
@@ -92,15 +92,22 @@
92
92
  <v-btn
93
93
  color="primary"
94
94
  outlined
95
+ elevation="0"
95
96
  class="text-center mt-4 mr-2"
96
97
  @click="onReset()"
97
98
  >{{
98
99
  $t('windward.core.components.content.blocks.feedback.reset')
99
100
  }}</v-btn
100
101
  >
101
- <v-btn color="success" class="text-center mt-4" @click="validate">{{
102
- $t('windward.core.components.content.blocks.feedback.save')
103
- }}</v-btn>
102
+ <v-btn
103
+ elevation="0"
104
+ color="success"
105
+ class="text-center mt-4"
106
+ @click="validate"
107
+ >{{
108
+ $t('windward.core.components.content.blocks.feedback.save')
109
+ }}</v-btn
110
+ >
104
111
  </v-row>
105
112
  <v-form
106
113
  ref="form"
@@ -11,6 +11,7 @@
11
11
  <p class="pa-3 text-center blue-grey lighten-5">
12
12
  <v-btn
13
13
  color="primary"
14
+ elevation="0"
14
15
  :disabled="!canSubmit"
15
16
  @click="onSubmit"
16
17
  >
@@ -47,9 +48,12 @@
47
48
  </v-alert>
48
49
  </div>
49
50
  <p class="pa-3 text-center blue-grey lighten-5">
50
- <v-btn color="primary" @click="submitted = false">{{
51
- $t('shared.forms.edit')
52
- }}</v-btn>
51
+ <v-btn
52
+ elevation="0"
53
+ color="primary"
54
+ @click="submitted = false"
55
+ >{{ $t('shared.forms.edit') }}</v-btn
56
+ >
53
57
  </p>
54
58
  </div>
55
59
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <div v-if="block.metadata.config.linked.length">
4
- <v-btn color="primary" outlined block @click="onCollate">
4
+ <v-btn elevation="0" color="primary" outlined block @click="onCollate">
5
5
  <v-icon class="mr-3">mdi-file-word</v-icon>
6
6
  {{
7
7
  $t(
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-container>
4
- <h3>{{ block.metadata.config.title }}</h3>
4
+ <h2>{{ block.metadata.config.title }}</h2>
5
5
  <h4>{{ block.metadata.config.description }}</h4>
6
6
  <p>
7
7
  {{
@@ -14,7 +14,7 @@
14
14
  v-if="choiceIndex !== null && block.metadata.config.show_reset"
15
15
  class="text-right"
16
16
  >
17
- <v-btn color="primary" outlined @click="onClickReset">
17
+ <v-btn elevation="0" color="primary" outlined @click="onClickReset">
18
18
  {{
19
19
  $t(
20
20
  'windward.core.components.content.blocks.scenario_choice.try_again'
@@ -42,6 +42,7 @@
42
42
  <td>
43
43
  <v-btn
44
44
  link
45
+ elevation="0"
45
46
  @click="
46
47
  Download.url(
47
48
  file.asset.public_url,
@@ -58,6 +59,7 @@
58
59
  <td>
59
60
  <v-btn
60
61
  link
62
+ elevation="0"
61
63
  color="error"
62
64
  @click="onConfirmDelete(file)"
63
65
  >
@@ -61,6 +61,7 @@
61
61
  <v-btn
62
62
  :disabled="!canUpload || loading"
63
63
  color="primary"
64
+ elevation="0"
64
65
  class="text-center"
65
66
  @click="handleUpload"
66
67
  >
@@ -21,9 +21,9 @@
21
21
  type="image, image, list-item-avatar"
22
22
  class="reload-skeleton"
23
23
  ></v-skeleton-loader>
24
- <h3 v-if="block.metadata.config.title" class="pl-4">
24
+ <h2 v-if="block.metadata.config.title" class="pl-4">
25
25
  {{ block.metadata.config.title }}
26
- </h3>
26
+ </h2>
27
27
  <VuetifyPlayer
28
28
  v-if="hasSource"
29
29
  :language="$i18n && $i18n.locale ? $i18n.locale : 'en-US'"
@@ -92,6 +92,7 @@
92
92
  >
93
93
  <v-btn
94
94
  class="primary"
95
+ elevation="0"
95
96
  :disabled="valid"
96
97
  @click="onSubmit"
97
98
  >{{
@@ -40,6 +40,7 @@
40
40
  ></v-text-field>
41
41
  <v-btn
42
42
  text
43
+ elevation="0"
43
44
  :disabled="render"
44
45
  @click="
45
46
  onToggleExpand(
@@ -134,6 +135,7 @@
134
135
  <v-row justify="center" class="my-4">
135
136
  <v-btn
136
137
  color="primary"
138
+ elevation="0"
137
139
  :disabled="render"
138
140
  @click="onAddElement"
139
141
  ><v-icon>mdi-plus</v-icon
@@ -201,7 +201,11 @@
201
201
  </SortableExpansionPanel>
202
202
  </v-col>
203
203
  <v-row justify="center" class="my-4">
204
- <v-btn color="primary" :disabled="render" @click="onAddElement"
204
+ <v-btn
205
+ color="primary"
206
+ elevation="0"
207
+ :disabled="render"
208
+ @click="onAddElement"
205
209
  ><v-icon>mdi-plus</v-icon
206
210
  >{{ $t('shared.forms.add') }}</v-btn
207
211
  >
@@ -85,6 +85,7 @@
85
85
  index
86
86
  )
87
87
  "
88
+ elevation="0"
88
89
  text
89
90
  :disabled="render"
90
91
  >
@@ -125,7 +126,11 @@
125
126
  </v-container>
126
127
  <v-container class="pa-0">
127
128
  <v-row justify="center" class="my-4">
128
- <v-btn color="primary" :disabled="render" @click="onAddElement"
129
+ <v-btn
130
+ color="primary"
131
+ elevation="0"
132
+ :disabled="render"
133
+ @click="onAddElement"
129
134
  ><v-icon>mdi-plus</v-icon
130
135
  >{{
131
136
  $t('windward.core.components.settings.email.add')
@@ -10,6 +10,7 @@
10
10
  <v-btn
11
11
  class="preset-btn text-sm-body-2 text-none"
12
12
  color="primary"
13
+ elevation="0"
13
14
  outlined
14
15
  v-bind="attrs"
15
16
  v-on="on"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <br />
4
- <v-btn :disabled="render" @click="onToggleExpand" text class="mb-2">
4
+ <v-btn elevation="0" :disabled="render" @click="onToggleExpand" text class="mb-2">
5
5
  <v-icon v-if="!block.metadata.config.expand" color="primary"
6
6
  >mdi-arrow-expand-all</v-icon
7
7
  >
@@ -115,6 +115,7 @@
115
115
  <v-row justify="center" class="my-4">
116
116
  <v-btn
117
117
  color="primary"
118
+ elevation="0"
118
119
  :disabled="
119
120
  render || block.metadata.config.items.length > 26
120
121
  "
@@ -34,6 +34,7 @@
34
34
  <v-btn
35
35
  @click="onToggleExpand(index)"
36
36
  text
37
+ elevation="0"
37
38
  class="mb-3"
38
39
  :disabled="render"
39
40
  >
@@ -61,7 +62,12 @@
61
62
  </template>
62
63
  </SortableExpansionPanel>
63
64
  <v-row justify="center" class="my-4">
64
- <v-btn color="primary" :disabled="render" @click="onAddElement">
65
+ <v-btn
66
+ color="primary"
67
+ elevation="0"
68
+ :disabled="render"
69
+ @click="onAddElement"
70
+ >
65
71
  <v-icon>mdi-plus</v-icon>
66
72
  {{ $t('windward.core.components.settings.tab.add_tab') }}
67
73
  </v-btn>
@@ -5,7 +5,7 @@
5
5
  <v-btn-toggle v-model="settingSelector" multiple borderless>
6
6
  <v-tooltip top>
7
7
  <template #activator="{ on, attrs }">
8
- <v-btn v-bind="attrs" v-on="on" text :disabled="render">
8
+ <v-btn elevation="0" v-bind="attrs" v-on="on" text :disabled="render">
9
9
  <v-icon>mdi-comment-text-multiple</v-icon>
10
10
  {{
11
11
  $t(
@@ -25,7 +25,7 @@
25
25
 
26
26
  <v-tooltip top>
27
27
  <template #activator="{ on, attrs }">
28
- <v-btn v-bind="attrs" v-on="on" text :disabled="render">
28
+ <v-btn elevation="0" v-bind="attrs" v-on="on" text :disabled="render">
29
29
  <v-icon> mdi-text-long</v-icon>
30
30
  {{
31
31
  $t(
@@ -48,6 +48,7 @@
48
48
  <v-btn
49
49
  v-bind="attrs"
50
50
  v-on="on"
51
+ elevation="0"
51
52
  text
52
53
  :disabled="render"
53
54
  @click="
@@ -22,7 +22,7 @@
22
22
  "
23
23
  :disabled="render"
24
24
  ></v-select>
25
- <v-btn text class="mt-4" :disabled="render" @click="onToggleExpand()">
25
+ <v-btn elevation="0" text class="mt-4" :disabled="render" @click="onToggleExpand()">
26
26
  <v-icon v-if="!block.metadata.config.expand" color="primary"
27
27
  >mdi-arrow-expand-all</v-icon
28
28
  >
@@ -273,6 +273,7 @@
273
273
  v-bind="attrs"
274
274
  v-on="on"
275
275
  text
276
+ elevation="0"
276
277
  color="error"
277
278
  :disabled="
278
279
  render ||
@@ -302,6 +303,7 @@
302
303
  <v-btn
303
304
  v-bind="attrs"
304
305
  v-on="on"
306
+ elevation="0"
305
307
  color="primary"
306
308
  text
307
309
  :disabled="render"
@@ -34,6 +34,7 @@
34
34
  ><v-btn
35
35
  ref="action_button_1"
36
36
  color="primary"
37
+ elevation="0"
37
38
  outlined
38
39
  @click="show = false"
39
40
  >
@@ -50,6 +51,7 @@
50
51
  <v-btn
51
52
  color="primary"
52
53
  outlined
54
+ elevation="0"
53
55
  @click="displayAnswer"
54
56
  v-if="!answerIsCorrect"
55
57
  >
@@ -92,6 +94,7 @@
92
94
  <v-btn
93
95
  v-if="userInput && userInput.length > 0"
94
96
  @click="toggleToolTip"
97
+ elevation="0"
95
98
  color="primary"
96
99
  outlined
97
100
  :aria-label="
@@ -51,7 +51,7 @@
51
51
  </v-container>
52
52
  </v-tab-item>
53
53
  </v-tabs-items>
54
-
54
+ <br />
55
55
  <math-live-wrapper
56
56
  ref="mathfield"
57
57
  v-model="formula"
@@ -92,6 +92,7 @@
92
92
  <v-btn
93
93
  primary
94
94
  color="success"
95
+ elevation="0"
95
96
  @click="setSRText"
96
97
  :class="fontSize"
97
98
  >{{
@@ -101,7 +102,7 @@
101
102
  }}
102
103
  </v-btn>
103
104
  &nbsp;
104
- <v-btn color="primary" :class="fontSize" @click="readSRText"
105
+ <v-btn color="primary" elevation="0" :class="fontSize" @click="readSRText"
105
106
  >{{
106
107
  $t(
107
108
  'windward.core.components.utils.math_expression_editor.read_text_aloud'
@@ -245,18 +246,38 @@ export default {
245
246
  this.$emit('input', latex)
246
247
  }
247
248
  },
248
- getBtnCode(button) {
249
- if (button.cmd) {
249
+ getBtnCode(button, isAlpha) {
250
+ if (button.cmd && isAlpha) {
250
251
  return button.latex
251
252
  }
252
253
  return button.text
253
254
  },
255
+
256
+ isLastCharValid(str, pos = 0) {
257
+ const lastChar = str.slice(pos, pos + 1)
258
+ const alphanumericRegex = /^[a-z0-9]$/i
259
+ const validSymbols = [')', '}', '|']
260
+ return (
261
+ alphanumericRegex.test(lastChar) ||
262
+ validSymbols.includes(lastChar)
263
+ )
264
+ },
254
265
  insert(latex) {
255
- this.$refs.mathfield.insert(this.getBtnCode(latex), {
256
- selectionMode: 'item',
257
- insertionMode: 'replaceSelection',
258
- focus: true,
259
- })
266
+ const existingText = this.$refs.mathfield.getValue()
267
+ this.$refs.mathfield.insert(
268
+ this.getBtnCode(
269
+ latex,
270
+ this.isLastCharValid(
271
+ existingText,
272
+ this.$refs.mathfield.$el.position - 1
273
+ )
274
+ ),
275
+ {
276
+ selectionMode: 'placeholder',
277
+ insertionMode: 'replaceSelection',
278
+ focus: true,
279
+ }
280
+ )
260
281
  },
261
282
 
262
283
  setSRText() {
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <math-field :id="id" style="font-size: 1.5rem; display: block"
2
+ <math-field
3
+ :id="id"
4
+ style="font-size: 1.5rem; display: block"
5
+ @change="onInput"
6
+ @input="onInput"
3
7
  ><slot></slot
4
8
  ></math-field>
5
9
  </template>
@@ -21,6 +25,13 @@ export default {
21
25
  }
22
26
  },
23
27
  watch: {
28
+ value(newVal) {
29
+ let current = this.$el.getValue()
30
+ newVal !== current &&
31
+ this.$el.setValue(newVal, {
32
+ silenceNotifications: !0,
33
+ })
34
+ },
24
35
  options: {
25
36
  deep: true,
26
37
  handler(newValue) {
@@ -29,30 +40,27 @@ export default {
29
40
  },
30
41
  },
31
42
  mounted() {
32
- this.$nextTick(() => {
33
- this.$el.setOptions({
34
- ...this.options,
35
- macros: {
36
- ...this.$el.getOptions('macros'),
37
- smallfrac: '{}^{#1}\\!\\!/\\!{}_{#2}',
38
- },
39
- onContentDidChange: () => {
40
- this.$emit('input', this.$el.getValue())
41
- this.$emit('change')
42
- },
43
- onFocus: () => {
44
- this.$emit('focus')
45
- },
46
- onBlur: () => {
47
- this.$emit('blur')
48
- },
49
- onUndoStateDidChange: (t, e) => {
50
- this.$emit('undo-state-did-change', e)
51
- },
52
- onReadAloudStatus: (t, e) => {
53
- this.$emit('read-aloud-status-change', e)
54
- },
55
- })
43
+ //this.$nextTick(() => this.$el.setOptions(this.options))
44
+ this.$el.mathVirtualKeyboardPolicy = 'manual'
45
+
46
+ this.$el.menuItems = this.$el.menuItems.filter((item) => {
47
+ const itemIdPrefix = item.id ? item.id.split('-')[0] : null
48
+
49
+ if (itemIdPrefix === 'color' || itemIdPrefix === 'background') {
50
+ return false
51
+ }
52
+
53
+ if (
54
+ !_.isEmpty(item.submenu) &&
55
+ typeof item.submenu !== 'undefined'
56
+ ) {
57
+ item.submenu = item.submenu.filter((subItem) => {
58
+ return subItem.id
59
+ ? !subItem.id.startsWith('mode-latex')
60
+ : true
61
+ })
62
+ }
63
+ return true
56
64
  })
57
65
  if (this.value !== '') {
58
66
  this.$el.setValue(this.value)
@@ -83,6 +91,20 @@ export default {
83
91
  setValue(value) {
84
92
  this.$el.setValue(value)
85
93
  },
94
+ onInput() {
95
+ this.$emit('input', this.$el.getValue())
96
+ this.$emit('change')
97
+ },
86
98
  },
87
99
  }
88
100
  </script>
101
+ <style>
102
+ @media not (pointer: coarse) {
103
+ math-field::part(virtual-keyboard-toggle) {
104
+ display: none;
105
+ }
106
+ math-field::part(menu-toggle) {
107
+ display: none;
108
+ }
109
+ }
110
+ </style>