@windward/core 0.5.2 → 0.7.0

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 (53) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/components/Content/Blocks/Accordion.vue +28 -0
  3. package/components/Content/Blocks/ClickableIcons.vue +31 -21
  4. package/components/Content/Blocks/Email.vue +11 -2
  5. package/components/Content/Blocks/FileDownload.vue +6 -8
  6. package/components/Content/Blocks/GenerateAIQuestionButton.vue +14 -6
  7. package/components/Content/Blocks/HorizontalRule.vue +1 -4
  8. package/components/Content/Blocks/ScenarioChoice.vue +58 -33
  9. package/components/Content/Blocks/Tab.vue +5 -0
  10. package/components/Content/Blocks/UserUpload.vue +1 -8
  11. package/components/Content/Blocks/Video.vue +96 -8
  12. package/components/Settings/AccordionSettings.vue +176 -136
  13. package/components/Settings/BlockQuoteSettings.vue +41 -2
  14. package/components/Settings/ClickableIconsSettings.vue +66 -10
  15. package/components/Settings/EmailSettings.vue +39 -4
  16. package/components/Settings/FileDownloadSettings.vue +38 -7
  17. package/components/Settings/HorizontalRuleSettings.vue +0 -3
  18. package/components/Settings/ScenarioChoiceSettings.vue +47 -9
  19. package/components/Settings/TabSettings.vue +124 -71
  20. package/components/Settings/TextEditorSettings.vue +14 -2
  21. package/components/Settings/UserUploadSettings.vue +42 -23
  22. package/components/Settings/VideoSettings/SourcePicker.vue +222 -0
  23. package/components/Settings/VideoSettings.vue +151 -165
  24. package/components/utils/TinyMCEWrapper.vue +25 -3
  25. package/components/utils/assets/tinymce/content/global.scss +14 -0
  26. package/components/utils/glossary/CourseGlossary.vue +52 -27
  27. package/helpers/tinymce/WindwardPlugins.ts +59 -10
  28. package/i18n/en-US/components/content/blocks/generate_questions.ts +2 -1
  29. package/i18n/en-US/components/content/blocks/video.ts +2 -51
  30. package/i18n/en-US/components/settings/accordion.ts +1 -0
  31. package/i18n/en-US/components/settings/tab.ts +1 -0
  32. package/i18n/en-US/components/settings/user_upload.ts +1 -0
  33. package/i18n/en-US/components/settings/video.ts +51 -0
  34. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +9 -1
  35. package/i18n/en-US/shared/settings.ts +3 -0
  36. package/i18n/es-ES/components/content/blocks/generate_questions.ts +2 -1
  37. package/i18n/es-ES/components/content/blocks/video.ts +3 -53
  38. package/i18n/es-ES/components/settings/accordion.ts +1 -0
  39. package/i18n/es-ES/components/settings/tab.ts +2 -0
  40. package/i18n/es-ES/components/settings/user_upload.ts +1 -0
  41. package/i18n/es-ES/components/settings/video.ts +53 -0
  42. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +9 -0
  43. package/i18n/es-ES/shared/settings.ts +3 -0
  44. package/i18n/sv-SE/components/content/blocks/generate_questions.ts +2 -1
  45. package/i18n/sv-SE/components/content/blocks/video.ts +2 -51
  46. package/i18n/sv-SE/components/settings/accordion.ts +2 -0
  47. package/i18n/sv-SE/components/settings/tab.ts +1 -0
  48. package/i18n/sv-SE/components/settings/user_upload.ts +1 -0
  49. package/i18n/sv-SE/components/settings/video.ts +51 -0
  50. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +8 -0
  51. package/i18n/sv-SE/shared/settings.ts +3 -0
  52. package/package.json +2 -1
  53. package/plugin.js +1 -1
@@ -4,17 +4,19 @@
4
4
  v-model="block.metadata.config.title"
5
5
  outlined
6
6
  :counter="50"
7
+ :rules="validation.shortInputRules"
7
8
  :autofocus="true"
8
- :label="$t('components.content.settings.base.title_optional')"
9
+ :label="$t('components.content.settings.base.title')"
9
10
  :disabled="render"
10
11
  ></v-text-field>
11
- <TextEditor
12
+ <v-textarea
12
13
  v-model="block.metadata.config.instructions"
14
+ outlined
15
+ :counter="255"
16
+ :rules="validation.instructionRule"
13
17
  :disabled="render"
14
- :label="
15
- $t('components.content.settings.base.instructions_optional')
16
- "
17
- />
18
+ :label="$t('components.content.settings.base.instructions')"
19
+ ></v-textarea>
18
20
  <v-switch
19
21
  v-model="block.metadata.config.display_detailed"
20
22
  :label="
@@ -37,6 +39,8 @@
37
39
  <v-text-field
38
40
  v-model="block.metadata.config.items[index].name"
39
41
  :autofocus="true"
42
+ :counter="50"
43
+ :rules="validation.shortInputRules"
40
44
  outlined
41
45
  :label="
42
46
  $t(
@@ -94,7 +98,34 @@ export default {
94
98
  extends: BaseContentSettings,
95
99
  components: { TextEditor, SortableExpansionPanel },
96
100
  data() {
97
- return {}
101
+ return {
102
+ validation: {
103
+ shortInputRules: [
104
+ (v) => {
105
+ if (v && v.length >= 50) {
106
+ return this.$t(
107
+ 'windward.core.shared.settings.errors.input_limitations',
108
+ [50]
109
+ )
110
+ } else {
111
+ return true
112
+ }
113
+ },
114
+ ],
115
+ instructionRule: [
116
+ (v) => {
117
+ if (v && v.length >= 255) {
118
+ return this.$t(
119
+ 'windward.core.shared.settings.errors.input_limitations',
120
+ [255]
121
+ )
122
+ } else {
123
+ return true
124
+ }
125
+ },
126
+ ],
127
+ },
128
+ }
98
129
  },
99
130
  computed: {
100
131
  filename() {
@@ -28,9 +28,6 @@ export default {
28
28
  if (_.isEmpty(this.block.metadata.config)) {
29
29
  this.block.metadata.config = {}
30
30
  }
31
- if (_.isEmpty(this.block.metadata.config)) {
32
- this.block.metadata.config = {}
33
- }
34
31
  if (!_.isBoolean(this.block.metadata.config.dashed)) {
35
32
  this.block.metadata.config.dashed = false
36
33
  }
@@ -4,6 +4,9 @@
4
4
  <v-col class="pa-0">
5
5
  <v-text-field
6
6
  v-model="block.metadata.config.title"
7
+ :rules="validation.shortInputRules"
8
+ :counter="50"
9
+ outlined
7
10
  id="title"
8
11
  :label="
9
12
  $t(
@@ -12,16 +15,15 @@
12
15
  "
13
16
  :disabled="render"
14
17
  ></v-text-field>
15
- <v-text-field
18
+ <v-textarea
16
19
  v-model="block.metadata.config.description"
17
20
  id="description"
18
- :label="
19
- $t(
20
- 'windward.core.components.settings.scenario_choice.description'
21
- )
22
- "
21
+ :rules="validation.instructionRule"
22
+ :counter="255"
23
+ outlined
24
+ :label="$t('components.content.settings.base.instructions')"
23
25
  :disabled="render"
24
- ></v-text-field>
26
+ ></v-textarea>
25
27
  <v-select
26
28
  v-model="block.metadata.config.display_style"
27
29
  :items="displayStyles"
@@ -75,6 +77,9 @@
75
77
  v-model="
76
78
  block.metadata.config.items[index].title
77
79
  "
80
+ :rules="validation.shortInputRules"
81
+ :counter="50"
82
+ outlined
78
83
  :id="'item-' + index + '-title'"
79
84
  :label="
80
85
  $t(
@@ -200,6 +205,7 @@ import BaseContentSettings from '~/components/Content/Settings/BaseContentSettin
200
205
  import TextEditor from '~/components/Text/TextEditor'
201
206
  import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
202
207
  import DialogBox from '~/components/Core/DialogBox.vue'
208
+ import Uuid from '~/helpers/Uuid'
203
209
 
204
210
  export default {
205
211
  name: 'ScenarioChoiceSettings',
@@ -243,6 +249,32 @@ export default {
243
249
  value: 'number',
244
250
  },
245
251
  ],
252
+ validation: {
253
+ shortInputRules: [
254
+ (v) => {
255
+ if (v && v.length >= 50) {
256
+ return this.$t(
257
+ 'windward.core.shared.settings.errors.input_limitations',
258
+ [50]
259
+ )
260
+ } else {
261
+ return true
262
+ }
263
+ },
264
+ ],
265
+ instructionRule: [
266
+ (v) => {
267
+ if (v && v.length >= 255) {
268
+ return this.$t(
269
+ 'windward.core.shared.settings.errors.input_limitations',
270
+ [255]
271
+ )
272
+ } else {
273
+ return true
274
+ }
275
+ },
276
+ ],
277
+ },
246
278
  }
247
279
  },
248
280
  beforeMount() {
@@ -263,8 +295,14 @@ export default {
263
295
  if (_.isEmpty(this.block.metadata.config.title)) {
264
296
  this.block.metadata.config.title = ''
265
297
  }
266
- if (_.isEmpty(this.block.metadata.config.description)) {
267
- this.block.metadata.config.description = ''
298
+ if (
299
+ _.isEmpty(this.block.metadata.config.description) &&
300
+ this.block.id &&
301
+ !Uuid.test(this.block.id)
302
+ ) {
303
+ this.block.metadata.config.description = this.$t(
304
+ 'windward.core.components.content.blocks.scenario_choice.information'
305
+ )
268
306
  }
269
307
  if (_.isEmpty(this.block.metadata.config.display_style)) {
270
308
  this.block.metadata.config.display_style = 'letter'
@@ -1,78 +1,92 @@
1
1
  <template>
2
2
  <div>
3
- <v-form ref="form" v-model="valid" v-if="!loading">
4
- <v-divider class="my-4 primary"></v-divider>
5
- <p>{{ $t('windward.core.components.settings.tab.tabs') }}</p>
6
- <SortableExpansionPanel
7
- v-model="block.metadata.config.items"
8
- v-bind:currentPanel.sync="block.metadata.config.currentTab"
3
+ <v-row class="pl-3 pr-3">
4
+ <v-text-field
5
+ v-model="block.metadata.config.title"
6
+ :autofocus="true"
7
+ :rules="validation.shortInputRules"
8
+ :counter="50"
9
+ outlined
10
+ id="title"
11
+ :label="
12
+ $t('windward.core.components.settings.clickable_icon.title')
13
+ "
9
14
  :disabled="render"
10
- @change="onDragged"
11
- @click:close="onRemoveElement($event)"
12
- >
13
- <template #header="{ item }">
14
- {{ item.tabHeader !== '' ? item.tabHeader : 'No Header' }}
15
- </template>
16
- <template #body="{ item, index }">
17
- <v-container :key="expansionPanelKey">
18
- <p class="p-label">
19
- {{
20
- $t(
21
- 'windward.core.components.settings.tab.header'
22
- )
23
- }}
24
- </p>
25
- <v-text-field
26
- outlined
27
- :autofocus="true"
28
- v-model="
29
- block.metadata.config.items[index].tabHeader
30
- "
31
- :placeholder="'item ' + (index + 1)"
32
- :disabled="render"
33
- ></v-text-field>
34
- <v-btn
35
- @click="onToggleExpand(index)"
36
- text
37
- elevation="0"
38
- class="mb-3"
39
- :disabled="render"
15
+ ></v-text-field>
16
+ <v-textarea
17
+ v-model="block.metadata.config.instructions"
18
+ :rules="validation.instructionRule"
19
+ :counter="255"
20
+ outlined
21
+ :label="$t('components.content.settings.base.instructions')"
22
+ :disabled="render"
23
+ ></v-textarea>
24
+ </v-row>
25
+ <v-divider class="my-4 primary"></v-divider>
26
+ <p>{{ $t('windward.core.components.settings.tab.tabs') }}</p>
27
+ <SortableExpansionPanel
28
+ v-model="block.metadata.config.items"
29
+ v-bind:currentPanel.sync="block.metadata.config.currentTab"
30
+ :disabled="render"
31
+ @change="onDragged"
32
+ @click:close="onRemoveElement($event)"
33
+ >
34
+ <template #header="{ item }">
35
+ {{ item.tabHeader !== '' ? item.tabHeader : 'No Header' }}
36
+ </template>
37
+ <template #body="{ item, index }">
38
+ <v-container :key="expansionPanelKey">
39
+ <p class="p-label">
40
+ {{ $t('windward.core.components.settings.tab.header') }}
41
+ </p>
42
+ <v-text-field
43
+ outlined
44
+ :autofocus="true"
45
+ v-model="block.metadata.config.items[index].tabHeader"
46
+ :counter="50"
47
+ :rules="validation.shortInputRules"
48
+ :label="'item ' + (index + 1)"
49
+ :disabled="render"
50
+ ></v-text-field>
51
+ <v-btn
52
+ @click="onToggleExpand(index)"
53
+ text
54
+ elevation="0"
55
+ class="mb-3"
56
+ :disabled="render"
57
+ >
58
+ <v-icon
59
+ v-if="!block.metadata.config.items[index].expand"
60
+ color="primary"
61
+ >mdi-arrow-expand-all</v-icon
62
+ >
63
+ <v-icon
64
+ v-if="block.metadata.config.items[index].expand"
65
+ color="primary"
40
66
  >
41
- <v-icon
42
- v-if="
43
- !block.metadata.config.items[index].expand
44
- "
45
- color="primary"
46
- >mdi-arrow-expand-all</v-icon
47
- >
48
- <v-icon
49
- v-if="block.metadata.config.items[index].expand"
50
- color="primary"
51
- >
52
- mdi-arrow-collapse-all
53
- </v-icon>
54
- </v-btn>
55
- <TextEditor
56
- v-model="block.metadata.config.items[index].content"
57
- v-if="!item.expand"
58
- :key="textEditorUpdateKey"
59
- :disabled="render"
60
- ></TextEditor>
61
- </v-container>
62
- </template>
63
- </SortableExpansionPanel>
64
- <v-row justify="center" class="my-4">
65
- <v-btn
66
- color="primary"
67
- elevation="0"
68
- :disabled="render"
69
- @click="onAddElement"
70
- >
71
- <v-icon>mdi-plus</v-icon>
72
- {{ $t('windward.core.components.settings.tab.add_tab') }}
73
- </v-btn>
74
- </v-row>
75
- </v-form>
67
+ mdi-arrow-collapse-all
68
+ </v-icon>
69
+ </v-btn>
70
+ <TextEditor
71
+ v-model="block.metadata.config.items[index].content"
72
+ v-if="!item.expand"
73
+ :key="textEditorUpdateKey"
74
+ :disabled="render"
75
+ ></TextEditor>
76
+ </v-container>
77
+ </template>
78
+ </SortableExpansionPanel>
79
+ <v-row justify="center" class="my-4">
80
+ <v-btn
81
+ color="primary"
82
+ elevation="0"
83
+ :disabled="render"
84
+ @click="onAddElement"
85
+ >
86
+ <v-icon>mdi-plus</v-icon>
87
+ {{ $t('windward.core.components.settings.tab.add_tab') }}
88
+ </v-btn>
89
+ </v-row>
76
90
  <div v-if="loading" class="text-center">
77
91
  <v-progress-circular
78
92
  :size="70"
@@ -90,6 +104,7 @@ import Crypto from '~/helpers/Crypto'
90
104
  import TextEditor from '~/components/Text/TextEditor'
91
105
  import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
92
106
  import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
107
+ import Uuid from '~/helpers/Uuid'
93
108
 
94
109
  export default {
95
110
  name: 'TabSettings',
@@ -110,6 +125,18 @@ export default {
110
125
  if (_.isEmpty(this.block.metadata.config)) {
111
126
  this.block.metadata.config = {}
112
127
  }
128
+ if (_.isEmpty(this.block.metadata.config.title)) {
129
+ this.block.metadata.config.title = ''
130
+ }
131
+ if (
132
+ _.isEmpty(this.block.metadata.config.instructions) &&
133
+ this.block.id &&
134
+ !Uuid.test(this.block.id)
135
+ ) {
136
+ this.block.metadata.config.instructions = this.$t(
137
+ 'windward.core.components.settings.tab.instructions'
138
+ )
139
+ }
113
140
  if (_.isEmpty(this.block.metadata.config.currentTab)) {
114
141
  this.block.metadata.config.currentTab = 0
115
142
  }
@@ -129,6 +156,32 @@ export default {
129
156
  textEditorUpdateKey: Crypto.id(),
130
157
  valid: true,
131
158
  loading: false,
159
+ validation: {
160
+ shortInputRules: [
161
+ (v) => {
162
+ if (v && v.length >= 50) {
163
+ return this.$t(
164
+ 'windward.core.shared.settings.errors.input_limitations',
165
+ [50]
166
+ )
167
+ } else {
168
+ return true
169
+ }
170
+ },
171
+ ],
172
+ instructionRule: [
173
+ (v) => {
174
+ if (v && v.length >= 255) {
175
+ return this.$t(
176
+ 'windward.core.shared.settings.errors.input_limitations',
177
+ [255]
178
+ )
179
+ } else {
180
+ return true
181
+ }
182
+ },
183
+ ],
184
+ },
132
185
  }
133
186
  },
134
187
  mounted() {
@@ -5,7 +5,13 @@
5
5
  <v-btn-toggle v-model="settingSelector" multiple borderless>
6
6
  <v-tooltip top>
7
7
  <template #activator="{ on, attrs }">
8
- <v-btn elevation="0" v-bind="attrs" v-on="on" text :disabled="render">
8
+ <v-btn
9
+ elevation="0"
10
+ v-bind="attrs"
11
+ v-on="on"
12
+ text
13
+ :disabled="render"
14
+ >
9
15
  <v-icon>mdi-comment-text-multiple</v-icon>
10
16
  {{
11
17
  $t(
@@ -25,7 +31,13 @@
25
31
 
26
32
  <v-tooltip top>
27
33
  <template #activator="{ on, attrs }">
28
- <v-btn elevation="0" v-bind="attrs" v-on="on" text :disabled="render">
34
+ <v-btn
35
+ elevation="0"
36
+ v-bind="attrs"
37
+ v-on="on"
38
+ text
39
+ :disabled="render"
40
+ >
29
41
  <v-icon> mdi-text-long</v-icon>
30
42
  {{
31
43
  $t(
@@ -3,31 +3,20 @@
3
3
  <v-text-field
4
4
  v-model="block.metadata.config.title"
5
5
  outlined
6
+ :rules="validation.titleRules"
6
7
  :counter="50"
7
8
  :autofocus="true"
8
- :label="$t('components.content.settings.base.title_optional')"
9
+ :label="$t('components.content.settings.base.title')"
9
10
  :disabled="render"
10
11
  ></v-text-field>
11
- <v-btn
12
- elevation="0"
13
- text
14
- class="mb-4"
15
- :disabled="render"
16
- @click="block.__expandInstructions = !block.__expandInstructions"
17
- >
18
- <v-icon v-if="!block.__expandInstructions" color="primary"
19
- >mdi-arrow-expand-all</v-icon
20
- >
21
- <v-icon v-if="block.__expandInstructions" color="primary">
22
- mdi-arrow-collapse-all
23
- </v-icon>
24
- </v-btn>
25
- <TextEditor
12
+ <v-textarea
26
13
  v-model="block.metadata.config.instructions"
14
+ :rules="validation.instructionRule"
15
+ :counter="255"
16
+ outlined
27
17
  :label="$t('components.content.settings.base.instructions')"
28
- :loading="block.__expandInstructions"
29
18
  :disabled="render"
30
- />
19
+ ></v-textarea>
31
20
  <v-switch
32
21
  v-model="block.metadata.config.uploadSettings.multiple"
33
22
  :label="
@@ -57,6 +46,7 @@ import BaseContentSettings from '~/components/Content/Settings/BaseContentSettin
57
46
  import Crypto from '~/helpers/Crypto'
58
47
  import TextEditor from '~/components/Text/TextEditor'
59
48
  import _ from 'lodash'
49
+ import Uuid from '~/helpers/Uuid'
60
50
 
61
51
  export default {
62
52
  name: 'UserUploadSettings',
@@ -67,9 +57,6 @@ export default {
67
57
  this.block = {}
68
58
  }
69
59
 
70
- // Default the instructions to collapsed
71
- this.block.__expandInstructions = false
72
-
73
60
  if (_.isEmpty(this.block.body)) {
74
61
  this.block.body = this.$t(
75
62
  'windward.core.shared.content_blocks.title.user_upload'
@@ -84,8 +71,14 @@ export default {
84
71
  if (_.isEmpty(this.block.metadata.config.title)) {
85
72
  this.block.metadata.config.title = ''
86
73
  }
87
- if (_.isEmpty(this.block.metadata.config.title)) {
88
- this.block.metadata.config.instructions = ''
74
+ if (
75
+ _.isEmpty(this.block.metadata.config.instructions) &&
76
+ this.block.id &&
77
+ !Uuid.test(this.block.id)
78
+ ) {
79
+ this.block.metadata.config.instructions = this.$t(
80
+ 'windward.core.components.settings.user_upload.instructions'
81
+ )
89
82
  }
90
83
  if (_.isEmpty(this.block.metadata.config.uploadSettings)) {
91
84
  this.block.metadata.config.uploadSettings = {
@@ -136,6 +129,32 @@ export default {
136
129
  boilerplate: true,
137
130
  elevation: 0,
138
131
  },
132
+ validation: {
133
+ titleRules: [
134
+ (v) => {
135
+ if (v && v.length >= 50) {
136
+ return this.$t(
137
+ 'windward.core.shared.settings.errors.input_limitations',
138
+ [50]
139
+ )
140
+ } else {
141
+ return true
142
+ }
143
+ },
144
+ ],
145
+ instructionRule: [
146
+ (v) => {
147
+ if (v && v.length >= 255) {
148
+ return this.$t(
149
+ 'windward.core.shared.settings.errors.input_limitations',
150
+ [255]
151
+ )
152
+ } else {
153
+ return true
154
+ }
155
+ },
156
+ ],
157
+ },
139
158
  }
140
159
  },
141
160
  mounted() {},