@windward/core 0.3.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 (63) hide show
  1. package/components/Content/Blocks/Accordion.vue +37 -0
  2. package/components/Content/Blocks/BlockQuote.vue +2 -2
  3. package/components/Content/Blocks/ClickableIcons.vue +108 -21
  4. package/components/Content/Blocks/Email.vue +19 -6
  5. package/components/Content/Blocks/Feedback.vue +12 -5
  6. package/components/Content/Blocks/Image.vue +47 -19
  7. package/components/Content/Blocks/OpenResponse.vue +7 -3
  8. package/components/Content/Blocks/OpenResponseCollate.vue +1 -1
  9. package/components/Content/Blocks/ScenarioChoice.vue +2 -2
  10. package/components/Content/Blocks/UserUpload/DisplayUserFilesTable.vue +2 -0
  11. package/components/Content/Blocks/UserUpload.vue +1 -0
  12. package/components/Content/Blocks/Video.vue +82 -11
  13. package/components/Navigation/Items/AskTheExpert.vue +1 -0
  14. package/components/Settings/AccordionSettings.vue +55 -0
  15. package/components/Settings/ClickableIconsSettings.vue +89 -8
  16. package/components/Settings/EmailSettings.vue +6 -10
  17. package/components/Settings/FeedbackSettings.vue +1 -0
  18. package/components/Settings/ImageSettings.vue +142 -39
  19. package/components/Settings/MathSettings.vue +1 -1
  20. package/components/Settings/OpenResponseSettings.vue +1 -2
  21. package/components/Settings/ScenarioChoiceSettings.vue +1 -0
  22. package/components/Settings/TabSettings.vue +7 -1
  23. package/components/Settings/TextEditorSettings.vue +3 -2
  24. package/components/Settings/UserUploadSettings.vue +1 -1
  25. package/components/Settings/VideoSettings.vue +102 -63
  26. package/components/utils/ContentViewer.vue +6 -1
  27. package/components/utils/FillInBlank/FillInBlankInput.vue +3 -0
  28. package/components/utils/MathExpressionEditor.vue +37 -11
  29. package/components/utils/MathLiveWrapper.vue +47 -25
  30. package/components/utils/TinyMCEWrapper.vue +214 -34
  31. package/components/utils/assets/tinymce/content/dark/content.scss +4 -0
  32. package/components/utils/assets/tinymce/{css/content.scss → content/global.scss} +38 -37
  33. package/components/utils/assets/tinymce/content/light/content.scss +4 -0
  34. package/components/utils/assets/tinymce/ui/dark/content.scss +803 -0
  35. package/components/utils/assets/tinymce/ui/dark/skin.scss +4727 -0
  36. package/components/utils/assets/tinymce/ui/global.scss +19 -0
  37. package/components/utils/assets/tinymce/ui/light/content.scss +822 -0
  38. package/components/utils/assets/tinymce/ui/light/skin.scss +4731 -0
  39. package/components/utils/glossary/CourseGlossary.vue +3 -1
  40. package/config/tinymce.config.ts +32 -20
  41. package/helpers/FillInBlankHelper.ts +34 -28
  42. package/helpers/GlossaryHelper.ts +90 -73
  43. package/helpers/MathHelper.ts +108 -28
  44. package/helpers/tinymce/WindwardPlugins.ts +335 -0
  45. package/i18n/en-US/components/settings/clickable_icon.ts +2 -0
  46. package/i18n/en-US/components/settings/image.ts +6 -1
  47. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  48. package/i18n/en-US/shared/settings.ts +3 -0
  49. package/i18n/es-ES/components/settings/clickable_icon.ts +2 -0
  50. package/i18n/es-ES/components/settings/image.ts +8 -1
  51. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  52. package/i18n/es-ES/shared/settings.ts +3 -0
  53. package/i18n/sv-SE/components/settings/clickable_icon.ts +2 -0
  54. package/i18n/sv-SE/components/settings/image.ts +6 -1
  55. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  56. package/i18n/sv-SE/shared/settings.ts +3 -0
  57. package/package.json +6 -4
  58. package/test/Components/Settings/AccordionSettings.spec.js +16 -2
  59. package/test/__mocks__/contentBlockMock.js +6 -0
  60. package/test/__mocks__/contentSettingsMock.js +6 -0
  61. package/test/helpers/MathHelper.spec.js +36 -4
  62. package/tsconfig.json +4 -0
  63. package/helpers/tinymce/plugin.ts +0 -208
@@ -2,9 +2,10 @@
2
2
  <v-container>
3
3
  <ContentBlockAsset
4
4
  mimes="image/jpeg,image/png,image/gif"
5
- @click:file="onFileSelect"
5
+ v-model="block.metadata.config.asset"
6
6
  class="mb-4"
7
7
  :disabled="render"
8
+ @click:file="onFileSelect"
8
9
  >
9
10
  <template #title>
10
11
  {{ $t('windward.core.components.content.blocks.image.title') }}
@@ -19,7 +20,7 @@
19
20
  </ContentBlockAsset>
20
21
 
21
22
  <v-switch
22
- v-model="block.metadata.config.hide_background"
23
+ v-model="block.metadata.config.hideBackground"
23
24
  :label="
24
25
  $t('windward.core.components.settings.image.hide_background')
25
26
  "
@@ -31,30 +32,86 @@
31
32
  :disabled="render"
32
33
  ></v-switch>
33
34
  <v-tooltip top color="primary">
34
- <template v-slot:activator="{ on, attrs }">
35
- <div v-bind="attrs" v-on="on" class="d-flex justify-content">
36
- <v-switch
37
- v-model="block.metadata.config.decorative"
38
- @change="onDecorativeToggled($event)"
39
- :label="
40
- $t(
41
- 'windward.core.components.settings.image.decorative'
42
- )
43
- "
44
- :disabled="render"
45
- ></v-switch>
46
- <div class="d-flex align-center pb-4">
47
- <v-icon x-small>mdi-help</v-icon>
48
- </div>
49
- </div>
35
+ <template #activator="{ on, attrs }">
36
+ <v-switch
37
+ v-model="block.metadata.config.decorative"
38
+ :disabled="render"
39
+ @change="onDecorativeToggled($event)"
40
+ >
41
+ <template #label>
42
+ <span v-bind="attrs" v-on="on">
43
+ {{
44
+ $t(
45
+ 'windward.core.components.settings.image.decorative'
46
+ )
47
+ }}
48
+ <v-icon x-small class="help-offset-icon">
49
+ mdi-help
50
+ </v-icon>
51
+ </span>
52
+ </template>
53
+ </v-switch>
50
54
  </template>
51
55
  <span class="span-description">{{
52
- $t('windward.core.components.settings.image.toggle_description')
56
+ $t(
57
+ 'windward.core.components.settings.image.decorative_toggle_description'
58
+ )
53
59
  }}</span>
54
60
  </v-tooltip>
55
61
 
56
62
  <v-form v-if="!block.metadata.config.decorative">
63
+ <v-tooltip top color="primary">
64
+ <template #activator="{ on, attrs }">
65
+ <v-switch
66
+ v-model="block.metadata.config.inherit"
67
+ :disabled="render"
68
+ >
69
+ <template #label>
70
+ <span v-bind="attrs" v-on="on">
71
+ {{
72
+ $t(
73
+ 'windward.core.components.settings.image.inherit'
74
+ )
75
+ }}
76
+ <v-icon x-small class="help-offset-icon">
77
+ mdi-help
78
+ </v-icon>
79
+ </span>
80
+ </template>
81
+ </v-switch>
82
+ </template>
83
+ <span class="span-description">{{
84
+ $t(
85
+ 'windward.core.components.settings.image.inherit_global_toggle_description'
86
+ )
87
+ }}</span>
88
+ </v-tooltip>
89
+
90
+ <v-alert
91
+ v-if="block.metadata.config.inherit && !assetAltText"
92
+ type="warning"
93
+ >
94
+ {{
95
+ $t('windward.core.components.settings.image.inherit_no_alt')
96
+ }}
97
+ </v-alert>
98
+
99
+ <v-text-field
100
+ v-if="block.metadata.config.inherit && assetAltText"
101
+ :value="assetAltText"
102
+ :label="
103
+ $t('windward.core.components.navigation.image.default_alt')
104
+ "
105
+ outlined
106
+ counter
107
+ maxlength="125"
108
+ :rules="validation.textRules"
109
+ disabled
110
+ >
111
+ </v-text-field>
112
+
57
113
  <v-text-field
114
+ v-if="!block.metadata.config.inherit"
58
115
  v-model="block.metadata.config.alt"
59
116
  outlined
60
117
  counter
@@ -65,9 +122,9 @@
65
122
  :rules="validation.textRules"
66
123
  :disabled="render"
67
124
  >
68
- <template v-slot:append>
125
+ <template #append>
69
126
  <v-tooltip top color="primary">
70
- <template v-slot:activator="{ on }">
127
+ <template #activator="{ on }">
71
128
  <v-icon v-on="on" small>mdi-help</v-icon>
72
129
  </template>
73
130
  <span class="span-description">{{
@@ -81,8 +138,10 @@
81
138
  <h5 class="pb-2">
82
139
  {{ $t('windward.core.components.settings.image.screenreader') }}
83
140
  <v-tooltip top color="primary">
84
- <template v-slot:activator="{ on }">
85
- <v-icon v-on="on" small class="pb-3">mdi-help</v-icon>
141
+ <template #activator="{ on }">
142
+ <v-icon v-on="on" small class="help-offset-icon">
143
+ mdi-help
144
+ </v-icon>
86
145
  </template>
87
146
  <span class="span-description">{{
88
147
  $t(
@@ -92,10 +151,26 @@
92
151
  </v-tooltip>
93
152
  </h5>
94
153
  <TextEditor
95
- v-model="block.metadata.config.aria_describedby"
154
+ v-if="!block.metadata.config.inherit"
155
+ v-model="block.metadata.config.ariaDescribedBy"
96
156
  menubar="bullist numlist"
97
157
  :disabled="render"
98
158
  ></TextEditor>
159
+
160
+ <div v-if="block.metadata.config.inherit">
161
+ <v-card v-if="assetDescribedByText">
162
+ <v-card-text>
163
+ <TextViewer v-model="assetDescribedByText"></TextViewer>
164
+ </v-card-text>
165
+ </v-card>
166
+ <v-alert v-if="!assetDescribedByText" type="warning">
167
+ {{
168
+ $t(
169
+ 'windward.core.components.settings.image.inherit_no_aria'
170
+ )
171
+ }}
172
+ </v-alert>
173
+ </div>
99
174
  </v-form>
100
175
  </v-container>
101
176
  </template>
@@ -103,17 +178,38 @@
103
178
  <script>
104
179
  import _ from 'lodash'
105
180
  import TextEditor from '~/components/Text/TextEditor'
181
+ import TextViewer from '~/components/Text/TextViewer'
106
182
  import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
107
183
  import ContentBlockAsset from '~/components/Content/ContentBlockAsset.vue'
108
184
 
109
185
  export default {
110
186
  name: 'ImageSettings',
111
187
  extends: BaseContentSettings,
112
- components: { ContentBlockAsset, TextEditor },
188
+ components: { ContentBlockAsset, TextEditor, TextViewer },
113
189
  props: {
114
190
  settings: { type: Object, required: false, default: null },
115
191
  context: { type: String, required: false, default: 'block' },
116
192
  },
193
+ computed: {
194
+ assetAltText() {
195
+ // Get the block aria info and fallback to the asset metadata
196
+ return _.get(this.fileAsset, 'metadata.props.alt', null)
197
+ },
198
+ assetDescribedByText() {
199
+ // Get the block aria info and fallback to the asset metadata
200
+ return _.get(
201
+ this.fileAsset,
202
+ 'metadata.props.aria_describedby',
203
+ null
204
+ )
205
+ },
206
+ fileAsset() {
207
+ return _.get(this.block, 'assets[0].asset', null)
208
+ },
209
+ fileAssetMap() {
210
+ return _.get(this.block, 'metadata.config.asset', null)
211
+ },
212
+ },
117
213
  beforeMount() {
118
214
  if (_.isEmpty(this.block)) {
119
215
  this.block = {}
@@ -127,11 +223,17 @@ export default {
127
223
  if (_.isEmpty(this.block.metadata.config)) {
128
224
  this.block.metadata.config = {}
129
225
  }
226
+ if (_.isEmpty(this.block.metadata.config.asset)) {
227
+ this.block.metadata.config.asset = null
228
+ }
130
229
  if (_.isEmpty(this.block.metadata.config.alt)) {
131
230
  this.block.metadata.config.alt = ''
132
231
  }
133
- if (!_.isBoolean(this.block.metadata.config.hide_background)) {
134
- this.block.metadata.config.hide_background = false
232
+ if (!_.isBoolean(this.block.metadata.config.hideBackground)) {
233
+ this.block.metadata.config.hideBackground = false
234
+ }
235
+ if (!_.isBoolean(this.block.metadata.config.inherit)) {
236
+ this.block.metadata.config.inherit = true
135
237
  }
136
238
  if (!_.isBoolean(this.block.metadata.config.modal)) {
137
239
  this.block.metadata.config.modal = false
@@ -139,18 +241,12 @@ export default {
139
241
  if (!_.isBoolean(this.block.metadata.config.decorative)) {
140
242
  this.block.metadata.config.decorative = false
141
243
  }
142
- if (_.isEmpty(this.block.metadata.config.aria_describedby)) {
143
- this.block.metadata.config.aria_describedby = ''
244
+ if (_.isEmpty(this.block.metadata.config.ariaDescribedBy)) {
245
+ this.block.metadata.config.ariaDescribedBy = ''
144
246
  }
145
247
  },
146
248
  data() {
147
249
  return {
148
- imageSettings: {
149
- // Default values
150
- alt_text: '',
151
- aria_described: '',
152
- release_results: 'submitted',
153
- },
154
250
  validation: {
155
251
  textRules: [
156
252
  (v) => !!v || this.$t('shared.forms.errors.required'),
@@ -163,16 +259,19 @@ export default {
163
259
  methods: {
164
260
  onDecorativeToggled(evt) {
165
261
  if (evt) {
166
- this.block.metadata.config.aria_describedby = ''
262
+ this.block.metadata.config.ariaDescribedBy = ''
167
263
  this.block.metadata.config.alt = ''
168
264
  }
169
265
  },
170
266
  onFileSelect(file) {
267
+ // Clear out the body since we're defining a proper file link now
268
+ this.block.body = ''
269
+
171
270
  // file = null when you remove a file
172
271
  if (_.isEmpty(file)) {
173
- this.block.body = ''
272
+ this.block.assets = []
174
273
  } else {
175
- this.block.body = file.asset.public_url
274
+ this.block.assets = [file]
176
275
 
177
276
  //Assign height and width for skeleton loader
178
277
  if (!_.isEmpty(file.asset.metadata.props)) {
@@ -188,7 +287,7 @@ export default {
188
287
  ''
189
288
  )
190
289
 
191
- this.block.metadata.config.aria_describedby = _.get(
290
+ this.block.metadata.config.ariaDescribedBy = _.get(
192
291
  file,
193
292
  'asset.metadata.props.aria_describedby',
194
293
  ''
@@ -204,4 +303,8 @@ export default {
204
303
  justify-content: center;
205
304
  width: 200px;
206
305
  }
306
+ .help-offset-icon {
307
+ position: relative;
308
+ top: -8px;
309
+ }
207
310
  </style>
@@ -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
  >
@@ -45,12 +45,11 @@
45
45
  import _ from 'lodash'
46
46
  import TextEditor from '~/components/Text/TextEditor'
47
47
  import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
48
- import ContentBlockAsset from '~/components/Content/ContentBlockAsset.vue'
49
48
 
50
49
  export default {
51
50
  name: 'ImageSettings',
52
51
  extends: BaseContentSettings,
53
- components: { ContentBlockAsset, TextEditor },
52
+ components: { TextEditor },
54
53
  props: {
55
54
  settings: { type: Object, required: false, default: null },
56
55
  context: { type: String, required: false, default: 'block' },
@@ -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
  >