@windward/core 0.2.0 → 0.2.2

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 (67) hide show
  1. package/components/Content/Blocks/Accordion.vue +25 -11
  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 +64 -24
  5. package/components/Content/Blocks/Feedback.vue +5 -13
  6. package/components/Content/Blocks/Image.vue +8 -1
  7. package/components/Content/Blocks/Math.vue +3 -1
  8. package/components/Content/Blocks/OpenResponseCollate.vue +1 -1
  9. package/components/Content/Blocks/ScenarioChoice.vue +3 -1
  10. package/components/Content/Blocks/Tab.vue +3 -1
  11. package/components/Content/Blocks/UserUpload.vue +5 -3
  12. package/components/Settings/AccordionSettings.vue +34 -11
  13. package/components/Settings/BlockQuoteSettings.vue +1 -1
  14. package/components/Settings/ClickableIconsSettings.vue +1 -1
  15. package/components/Settings/EmailSettings.vue +61 -19
  16. package/components/Settings/FeedbackSettings.vue +3 -1
  17. package/components/Settings/MathSettings.vue +6 -4
  18. package/components/Settings/ScenarioChoiceSettings.vue +57 -48
  19. package/components/Settings/TabSettings.vue +4 -2
  20. package/components/Settings/TextEditorSettings.vue +72 -30
  21. package/components/Settings/UserUploadSettings.vue +4 -4
  22. package/components/Settings/VideoSettings.vue +2 -2
  23. package/components/utils/ContentViewer.vue +2 -1
  24. package/components/utils/FillInBlank/FillInTheBlanksManager.vue +20 -24
  25. package/components/utils/MathExpressionEditor.vue +81 -85
  26. package/components/utils/MathLiveWrapper.vue +3 -1
  27. package/components/utils/TinyMCEWrapper.vue +91 -21
  28. package/components/utils/glossary/CourseGlossary.vue +45 -32
  29. package/components/utils/glossary/CourseGlossaryForm.vue +1 -0
  30. package/config/tinymce.config.ts +314 -0
  31. package/helpers/tinymce/plugin.ts +48 -27
  32. package/i18n/en-US/components/content/blocks/email.ts +2 -0
  33. package/i18n/en-US/components/settings/accordion.ts +2 -1
  34. package/i18n/en-US/components/settings/email.ts +1 -0
  35. package/i18n/en-US/components/settings/text_editor.ts +4 -1
  36. package/i18n/en-US/components/utils/math_expression_editor.ts +11 -0
  37. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  38. package/i18n/en-US/pages/index.ts +2 -0
  39. package/i18n/en-US/pages/plugins/error.ts +9 -0
  40. package/i18n/en-US/pages/plugins/index.ts +5 -0
  41. package/i18n/en-US/shared/settings.ts +1 -1
  42. package/i18n/es-ES/components/content/blocks/email.ts +2 -0
  43. package/i18n/es-ES/components/settings/accordion.ts +2 -1
  44. package/i18n/es-ES/components/settings/email.ts +1 -0
  45. package/i18n/es-ES/components/settings/text_editor.ts +4 -1
  46. package/i18n/es-ES/components/utils/math_expression_editor.ts +11 -0
  47. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  48. package/i18n/es-ES/pages/index.ts +2 -0
  49. package/i18n/es-ES/pages/plugins/error.ts +9 -0
  50. package/i18n/es-ES/pages/plugins/index.ts +5 -0
  51. package/i18n/sv-SE/components/content/blocks/email.ts +2 -0
  52. package/i18n/sv-SE/components/settings/accordion.ts +1 -0
  53. package/i18n/sv-SE/components/settings/email.ts +1 -0
  54. package/i18n/sv-SE/components/settings/text_editor.ts +4 -1
  55. package/i18n/sv-SE/components/utils/math_expression_editor.ts +11 -0
  56. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  57. package/i18n/sv-SE/pages/index.ts +2 -0
  58. package/i18n/sv-SE/pages/plugins/error.ts +8 -0
  59. package/i18n/sv-SE/pages/plugins/index.ts +5 -0
  60. package/package.json +1 -1
  61. package/pages/plugins/tinymce/_plugin.vue +79 -0
  62. package/plugin.js +10 -0
  63. package/test/Components/Settings/EmailSettings.spec.js +18 -2
  64. package/test/Pages/Plugins/TinyMce.spec.js +23 -0
  65. package/test/__mocks__/componentsMock.js +0 -12
  66. package/test/mocks.js +1 -0
  67. package/config/tinymce.config.js +0 -136
@@ -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,84 @@
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
+ <button
38
+ v-for="(
39
+ button, buttonIndex
40
+ ) in keyboard.buttons"
41
+ :key="buttonIndex"
42
+ class="btn"
43
+ @click="insert(button)"
44
+ v-html="'<strong>'+convertLatexToMarkup(button.text)+'</strong>'"
45
+ >
46
+ </button>
47
+ </div>
48
+ </v-container>
116
49
  </v-tab-item>
117
50
  </v-tabs-items>
51
+
52
+ <math-live-wrapper
53
+ ref="mathfield"
54
+ v-model="formula"
55
+ :id="mathElementId"
56
+ :options="options"
57
+ :value="value"
58
+ @change="submit"
59
+ ></math-live-wrapper>
60
+ <br />
61
+ <v-container>
62
+ <v-row align="center">
63
+ <v-switch
64
+ v-model="spokenTextChanged"
65
+ :label="
66
+ $t(
67
+ 'windward.core.components.utils.math_expression_editor.custom_screen_reader_text'
68
+ )
69
+ "
70
+ hide-details
71
+ class="shrink mr-2 mt-0"
72
+ ></v-switch>
73
+ <v-textarea
74
+ v-model="spokenText"
75
+ :disabled="!spokenTextChanged"
76
+ :label="
77
+ $t(
78
+ 'windward.core.components.utils.math_expression_editor.screen_reader_text'
79
+ )
80
+ "
81
+ class="col-md-12"
82
+ @input="submit"
83
+ ></v-textarea>
84
+ </v-row>
85
+ </v-container>
86
+
87
+ <br />
88
+ <v-row class="float-right">
89
+ <v-btn
90
+ primary
91
+ color="success"
92
+ @click="setSRText"
93
+ :class="fontSize"
94
+ >{{
95
+ $t(
96
+ 'windward.core.components.utils.math_expression_editor.default_screen_reader_text'
97
+ )
98
+ }}
99
+ </v-btn>
100
+ &nbsp;
101
+ <v-btn color="primary" :class="fontSize" @click="readSRText"
102
+ >{{
103
+ $t(
104
+ 'windward.core.components.utils.math_expression_editor.read_text_aloud'
105
+ )
106
+ }}
107
+ </v-btn>
108
+ </v-row>
118
109
  </v-card-text>
119
110
  </v-card>
120
111
  </div>
@@ -142,7 +133,7 @@ export default {
142
133
  options: {
143
134
  smartFence: true,
144
135
  smartMode: false,
145
- virtualKeyboardMode: 'manual',
136
+ virtualKeyboardMode: 'none',
146
137
  keypressSound: 'none',
147
138
  plonkSound: 'none',
148
139
  readOnly: false,
@@ -268,7 +259,12 @@ export default {
268
259
  this.spokenText = this.convertLatexToSpeakableText(this.formula)
269
260
  },
270
261
  readSRText() {
271
- this.$refs.mathfield.executeCommand('speak')
262
+ if (!this.spokenText) {
263
+ this.$refs.mathfield.executeCommand('speak')
264
+ } else {
265
+ const utterance = new SpeechSynthesisUtterance(this.spokenText)
266
+ speechSynthesis.speak(utterance)
267
+ }
272
268
  },
273
269
  },
274
270
  }
@@ -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>
@@ -1,14 +1,41 @@
1
1
  <template>
2
- <editor
3
- :key="seed + config.skin"
4
- v-model="text"
5
- initial-value=""
6
- :api-key="api_key"
7
- :init="config"
8
- tag-name="div"
9
- model-events="change keydown blur focus paste input submit SetContent"
10
- >
11
- </editor>
2
+ <div>
3
+ <div class="included">
4
+ <editor
5
+ :key="seed + config.skin"
6
+ v-model="text"
7
+ initial-value=""
8
+ :api-key="api_key"
9
+ :init="config"
10
+ tag-name="div"
11
+ model-events="change keydown blur focus mouseDown paste input submit SetContent"
12
+ @onfocus="onEditorFocus"
13
+ v-click-outside="{
14
+ handler: onClickOutside,
15
+ include,
16
+ }"
17
+ >
18
+ </editor>
19
+ </div>
20
+
21
+ <v-btn-toggle dense multiple class="pt-1 d-flex justify-end">
22
+ <slot name="actions-prepend" :render="render"></slot>
23
+ <slot name="actions" :render="render">
24
+ <v-btn
25
+ v-if="render"
26
+ color="primary"
27
+ outlined
28
+ @click="onClickOutside"
29
+ >{{
30
+ $t(
31
+ 'windward.core.components.utils.tiny_mce_wrapper.minimize'
32
+ )
33
+ }}
34
+ </v-btn>
35
+ </slot>
36
+ <slot name="actions-append" :render="render"></slot>
37
+ </v-btn-toggle>
38
+ </div>
12
39
  </template>
13
40
 
14
41
  <script>
@@ -35,19 +62,17 @@ export default {
35
62
  type: String,
36
63
  required: false,
37
64
  default:
38
- 'undo redo | formatselect | fontsizeselect | bold italic underline strikethrough removeformat | alignleft aligncenter alignright | table bullist numlist outdent indent | mathButton ',
65
+ 'undo redo | formatselect | fontsizeselect | bold italic underline strikethrough removeformat | alignleft aligncenter alignright | table bullist numlist outdent indent | glossaryButton fibButton mathButton ',
39
66
  },
40
67
  root_block: { type: String, required: false, default: 'div' },
68
+ label: { type: String, required: true, default: '' },
41
69
  },
42
70
  beforeMount() {
43
71
  this.text = this.value
44
- if (this.height !== null) {
45
- this.config.height = this.height
46
- }
47
72
  },
48
73
  data() {
49
74
  return {
50
- render: true,
75
+ render: false,
51
76
  text: '',
52
77
  seed: Crypto.id(),
53
78
  }
@@ -58,14 +83,39 @@ export default {
58
83
  },
59
84
  },
60
85
  computed: {
86
+ filteredMenubar() {
87
+ if (this.render) {
88
+ return this.menubar
89
+ } else {
90
+ return ''
91
+ }
92
+ },
93
+ filteredToolbar() {
94
+ if (this.render) {
95
+ return this.toolbar
96
+ } else {
97
+ return ''
98
+ }
99
+ },
100
+ filteredHeight() {
101
+ if (!this.render) {
102
+ return 50
103
+ } else if (this.height !== null) {
104
+ return this.height
105
+ } else {
106
+ return 500
107
+ }
108
+ },
61
109
  config() {
62
110
  return {
63
- height: 500,
111
+ draggable_modal: true,
112
+ height: this.filteredHeight,
64
113
  visual: false,
65
114
  forced_root_block: this.root_block,
66
- menubar: this.menubar,
115
+ menubar: this.filteredMenubar,
67
116
  browser_spellcheck: true,
68
117
  contextmenu: false,
118
+ statusbar: false,
69
119
  menu: {
70
120
  insert: {
71
121
  title: 'Insert',
@@ -86,7 +136,7 @@ export default {
86
136
  'anchor insertdatetime ',
87
137
  'paste code wordcount table WindwardToolKit',
88
138
  ],
89
- toolbar: this.toolbar,
139
+ toolbar: this.filteredToolbar,
90
140
  table_advtab: false,
91
141
  table_cell_advtab: false,
92
142
  table_row_advtab: false,
@@ -232,9 +282,11 @@ export default {
232
282
  },
233
283
  ],
234
284
  style_formats_merge: true,
235
- placeholder: this.$t(
236
- 'windward.core.shared.settings.title.placeholder'
237
- ),
285
+ placeholder: this.label
286
+ ? this.label
287
+ : this.$t(
288
+ 'windward.core.shared.settings.title.placeholder'
289
+ ),
238
290
  //required as it will be displayed as inline style in tinymce renderer
239
291
 
240
292
  skin: this.$vuetify.theme.isDark ? 'oxide-dark' : 'oxide',
@@ -254,5 +306,23 @@ export default {
254
306
  }
255
307
  },
256
308
  },
309
+ methods: {
310
+ onEditorFocus() {
311
+ if (!this.render) {
312
+ this.seed = Crypto.id()
313
+ this.render = true
314
+ }
315
+ },
316
+ onClickOutside() {
317
+ if (this.render) {
318
+ this.seed = Crypto.id()
319
+ this.render = false
320
+ }
321
+ },
322
+ include() {
323
+ // vuetify function to include an element with this class into clickable area without close
324
+ return [document.querySelector('.included')]
325
+ },
326
+ },
257
327
  }
258
328
  </script>
@@ -94,36 +94,45 @@
94
94
  <td>{{ item.related_term }}</td>
95
95
 
96
96
  <td>
97
- <v-btn
98
- class="primary"
99
- :disabled="
100
- !$PermissionService.userHasAccessTo(
101
- 'windward.global.course,windward.organization.course.contentBlock',
102
- 'writable'
103
- )
104
- "
105
- @click="editTerm(item)"
97
+ <SpeedDial
98
+ direction="left"
99
+ transition="slide-x-reverse-transition"
106
100
  >
107
- <v-icon small> mdi-pencil </v-icon>
108
- <span class="sr-only">{{
109
- $t('forms.edit')
110
- }}</span>
111
- </v-btn>
112
- <v-btn
113
- class="primary"
114
- :disabled="
115
- !$PermissionService.userHasAccessTo(
116
- 'windward.global.course,windward.organization.course.contentBlock',
117
- 'writable'
118
- )
119
- "
120
- @click="onDelete(item)"
121
- >
122
- <v-icon small> mdi-delete </v-icon>
123
- <span class="sr-only">{{
124
- $t('shared.forms.delete')
125
- }}</span>
126
- </v-btn>
101
+ <v-btn
102
+ color="error"
103
+ class="outlined"
104
+ outlined
105
+ :disabled="
106
+ !$PermissionService.userHasAccessTo(
107
+ 'windward.global.course,windward.organization.course.contentBlock',
108
+ 'writable'
109
+ )
110
+ "
111
+ @click="onDelete(item)"
112
+ >
113
+ {{ $t('shared.forms.delete') }}
114
+ <span class="sr-only">{{
115
+ $t('shared.forms.delete')
116
+ }}</span>
117
+ </v-btn>
118
+ <v-btn
119
+ color="primary"
120
+ class="outlined"
121
+ outlined
122
+ :disabled="
123
+ !$PermissionService.userHasAccessTo(
124
+ 'windward.global.course,windward.organization.course.contentBlock',
125
+ 'writable'
126
+ )
127
+ "
128
+ @click="editTerm(item)"
129
+ >
130
+ {{ $t('shared.forms.edit') }}
131
+ <span class="sr-only">{{
132
+ $t('forms.edit')
133
+ }}</span>
134
+ </v-btn>
135
+ </SpeedDial>
127
136
  </td>
128
137
  </tr>
129
138
  </template>
@@ -138,11 +147,12 @@ import { mapGetters, mapMutations } from 'vuex'
138
147
  import _ from 'lodash'
139
148
  import Crypto from '~/helpers/Crypto'
140
149
  import Course from '~/models/Course'
150
+ import SpeedDial from '~/components/SpeedDial.vue'
141
151
 
142
152
  import CourseGlossaryForm from './CourseGlossaryForm'
143
153
  export default {
144
154
  name: 'CourseGlossary',
145
- components: { CourseGlossaryForm },
155
+ components: { CourseGlossaryForm, SpeedDial },
146
156
  layout: 'course',
147
157
  middleware: ['auth'],
148
158
  props: {},
@@ -176,6 +186,11 @@ export default {
176
186
  sortable: true,
177
187
  value: 'related_term',
178
188
  },
189
+ {
190
+ text: this.$t('shared.forms.actions'),
191
+ value: 'actions',
192
+ sortable: false,
193
+ },
179
194
  ],
180
195
  dialog: false,
181
196
  editMode: false,
@@ -297,5 +312,3 @@ export default {
297
312
  },
298
313
  }
299
314
  </script>
300
-
301
- <!--<style scoped></style>-->
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <v-form ref="form" v-model="formValid" class="pa-6">
3
3
  <v-text-field
4
+ id="glossary-form-term"
4
5
  v-model="selectedTerm.term"
5
6
  :counter="50"
6
7
  :label="$t('windward.core.pages.glossary.term')"