@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
@@ -3,10 +3,12 @@ export default {
3
3
  from: 'Från',
4
4
  to: 'Till',
5
5
  cc: 'CC',
6
+ subject: 'Amne',
6
7
  body: 'E-posttext',
7
8
  simulation: 'E-postsimulering',
8
9
  reply: 'Svar',
9
10
  reply_all: 'Svara alla',
10
11
  forward: 'Fram',
11
12
  reset: 'Återställa',
13
+ email: 'E-post',
12
14
  }
@@ -2,4 +2,5 @@ export default {
2
2
  items: 'Dragspelsföremål',
3
3
  add: 'Lägg till dragspel',
4
4
  accordion: 'Dragspel',
5
+ label: 'Dragspel brödtext',
5
6
  }
@@ -6,4 +6,5 @@ export default {
6
6
  to: 'Till',
7
7
  cc: 'CC',
8
8
  body: 'E-posttext',
9
+ placeholder: 'E-postbrödtext',
9
10
  }
@@ -1,7 +1,10 @@
1
1
  export default {
2
2
  glossary: 'Ordlista',
3
- Text_editor: 'Editor',
3
+ text_editor: 'Editor',
4
4
  verified_terms: 'verifierade villkor',
5
5
  unverified_terms: 'overifierade termer',
6
6
  no_glossary: 'Ingen ordlista Termer upptäckt',
7
+ click_to_expand: 'klicka för att förbruka',
8
+ click_to_hide_editor: 'klicka för att dölja editorn',
9
+ click_to_hide_glossary: 'klicka för att dölja ordlistan',
7
10
  }
@@ -1,3 +1,14 @@
1
1
  export default {
2
2
  title: 'Redaktör för matematiska uttryck',
3
+ basic: 'Grundläggande',
4
+ operators: 'Operatörer',
5
+ trigonometry: 'Trigonometri',
6
+ greek: 'grekisk',
7
+ probability: 'Sannolikhet',
8
+ matrix: 'Matris',
9
+ eq_systems: 'Ekvationssystem',
10
+ screen_reader_text: 'skärmläsare text',
11
+ default_screen_reader_text: 'Standard skärmläsare text',
12
+ custom_screen_reader_text: 'Anpassa skärmläsartext',
13
+ read_text_aloud: 'Läs texten högt',
3
14
  }
@@ -16,4 +16,5 @@ export default {
16
16
  t_chart: 'T Chart',
17
17
  subject_report: 'Ämnesrapport',
18
18
  },
19
+ minimize: 'Minimera',
19
20
  }
@@ -1,7 +1,9 @@
1
1
  import user_upload from './user_upload'
2
2
  import glossary from './glossary'
3
+ import plugins from './plugins'
3
4
 
4
5
  export default {
5
6
  user_upload,
6
7
  glossary,
8
+ plugins,
7
9
  }
@@ -0,0 +1,8 @@
1
+ export default {
2
+ title_401: 'Ingen åtkomst',
3
+ description_401:
4
+ 'Du har inte behörighet att använda denna plugin. Vänligen kontakta din kontoadministratör',
5
+ not_enabled: "'{0}' är inte aktiverat. Kontakta din kontoadministratör",
6
+ missing_tag:
7
+ "Något gick fel på vår sida. '{0}' är aktiverat men kunde inte laddas. Kontakta din kontoadministratör",
8
+ }
@@ -0,0 +1,5 @@
1
+ import error from './error'
2
+
3
+ export default {
4
+ error,
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <div>
3
+ <component
4
+ :is="plugin.tag"
5
+ v-if="
6
+ isRegistered &&
7
+ $PermissionService.userHasAccessTo(
8
+ 'windward.global.course,windward.organization.contentBlock,windward.organization.course.contentBlock',
9
+ 'writable'
10
+ )
11
+ "
12
+ >
13
+ </component>
14
+ <!-- No permissions error condition -->
15
+ <div
16
+ v-if="
17
+ !$PermissionService.userHasAccessTo(
18
+ 'windward.global.course,windward.organization.contentBlock,windward.organization.course.contentBlock',
19
+ 'writable'
20
+ )
21
+ "
22
+ >
23
+ <h2>
24
+ {{ $t('windward.core.pages.plugins.error.title_401') }}
25
+ </h2>
26
+ <p>
27
+ {{ $t('windward.core.pages.plugins.error.description_401') }}
28
+ </p>
29
+ </div>
30
+ <!-- Plugin doesn't have a tag error condition -->
31
+ <v-alert v-if="!plugin.tag" type="error">
32
+ {{
33
+ $t('windward.core.pages.plugins.error.not_enabled', [
34
+ plugin.name,
35
+ ])
36
+ }}
37
+ </v-alert>
38
+ <!-- Plugin tag wasn't autoloaded error condition -->
39
+ <v-alert v-if="plugin.tag && !isRegistered" type="error">
40
+ {{
41
+ $t('windward.core.pages.plugins.error.missing_tag', [
42
+ plugin.name,
43
+ ])
44
+ }}
45
+ </v-alert>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ import _ from 'lodash'
51
+ import tinymcePluginConfig from '../../../config/tinymce.config'
52
+ export default {
53
+ layout: 'plugin',
54
+ data() {
55
+ return {}
56
+ },
57
+ computed: {
58
+ isRegistered() {
59
+ const c = _.get(
60
+ this.$root,
61
+ "$options.components['" + this.plugin.tag + "']",
62
+ null
63
+ )
64
+
65
+ return c !== null
66
+ },
67
+ plugin() {
68
+ const plugin = tinymcePluginConfig.plugins.filter((item) => {
69
+ return (
70
+ item.name.toLowerCase() ===
71
+ this.$route.params.plugin.toLowerCase()
72
+ )
73
+ })
74
+
75
+ return plugin[0] || { tag: null, name: this.$route.params.plugin }
76
+ },
77
+ },
78
+ }
79
+ </script>
package/plugin.js CHANGED
@@ -21,6 +21,8 @@ import Image from './components/Content/Blocks/Image'
21
21
  import UserUpload from './components/Content/Blocks/UserUpload'
22
22
 
23
23
  import GlossaryPage from './pages/glossary.vue'
24
+ import TinymcePlugin from './pages/plugins/tinymce/_plugin.vue'
25
+
24
26
  import CourseGlossaryToolNav from './components/Navigation/Items/CourseGlossaryToolNav.vue'
25
27
  import GlossaryNav from './components/Navigation/Items/GlossaryNav.vue'
26
28
  import AskTheExpert from './components/Navigation/Items/AskTheExpert.vue'
@@ -78,6 +80,14 @@ export default {
78
80
  name: 'CourseGlossaryPage',
79
81
  template: GlossaryPage,
80
82
  },
83
+ {
84
+ page: 'tinymce-plugin',
85
+ path: '/plugins/tinymce/:plugin',
86
+ i18n: 'windward.core.shared.menu.plugin',
87
+ icon: 'mdi-toy-brick',
88
+ name: 'TinymcePlugin',
89
+ template: TinymcePlugin,
90
+ },
81
91
  ],
82
92
  components: {
83
93
  utils: [
@@ -27,8 +27,24 @@ describe('EmailSettings', () => {
27
27
  })
28
28
  wrapper.vm.onAddElement()
29
29
  expect(wrapper.vm.$data.block.metadata.config.emails).toEqual([
30
- { from: '', to: '', cc: '', body: '', expand: false, initials: '' },
31
- { from: '', to: '', cc: '', body: '', expand: false, initials: '' },
30
+ {
31
+ from: '',
32
+ to: '',
33
+ cc: '',
34
+ body: '',
35
+ initials: '',
36
+ subject: '',
37
+ tinymce_expand: false,
38
+ },
39
+ {
40
+ from: '',
41
+ to: '',
42
+ cc: '',
43
+ body: '',
44
+ initials: '',
45
+ subject: '',
46
+ tinymce_expand: false,
47
+ },
32
48
  ])
33
49
  })
34
50
 
@@ -0,0 +1,23 @@
1
+ import { shallowMount } from '@vue/test-utils'
2
+ import Vue from 'vue'
3
+ import Vuetify from 'vuetify'
4
+ import { defaultMocks } from '@/test/mocks'
5
+
6
+ import TinyMcePlugin from '@/pages/plugins/tinymce/_plugin.vue'
7
+
8
+ Vue.use(Vuetify)
9
+
10
+ const mocks = {
11
+ ...defaultMocks,
12
+ $route: { params: { plugin: '' } },
13
+ }
14
+
15
+ describe('TinyMcePlugin', () => {
16
+ test('is a Vue instance', () => {
17
+ const wrapper = shallowMount(TinyMcePlugin, {
18
+ vuetify: new Vuetify(),
19
+ mocks,
20
+ })
21
+ expect(wrapper.vm).toBeTruthy()
22
+ })
23
+ })
@@ -34,18 +34,6 @@ jest.mock(
34
34
  { virtual: true }
35
35
  )
36
36
 
37
- jest.mock(
38
- '~/components/DialogBox.vue',
39
- () => {
40
- return {
41
- props: {},
42
- computed: {},
43
- methods: {},
44
- }
45
- },
46
- { virtual: true }
47
- )
48
-
49
37
  jest.mock(
50
38
  '~/components/Text/TextViewer',
51
39
  () => {
package/test/mocks.js CHANGED
@@ -56,6 +56,7 @@ const mocks = {
56
56
  app: {},
57
57
  $router: [],
58
58
  $PluginService: { mounted: () => {} },
59
+ $PermissionService: { userHasAccessTo: () => {} },
59
60
  $Grading: {
60
61
  getTypes() {
61
62
  return [
@@ -1,136 +0,0 @@
1
- export default {
2
- plugins: [
3
- {
4
- name: 'math',
5
- tag: 'plugin-core-math-expression-editor',
6
- buttons: {
7
- groups: [
8
- {
9
- name: 'shared.math.trigonometry',
10
- buttons: [
11
- {
12
- cmd: false,
13
- text: '\\sec',
14
- },
15
- {
16
- cmd: false,
17
- text: '\\sec^{-1}',
18
- },
19
- {
20
- cmd: false,
21
- text: '\\csc',
22
- },
23
- {
24
- cmd: false,
25
- text: '\\csc^{-1}',
26
- },
27
- {
28
- cmd: false,
29
- text: '\\cot',
30
- },
31
- {
32
- cmd: false,
33
- text: '\\cot^{-1}',
34
- },
35
- ],
36
- },
37
- {
38
- name: 'shared.math.statistic',
39
- buttons: [
40
- {
41
- cmd: false,
42
- text: '\\mu',
43
- },
44
- {
45
- cmd: false,
46
- text: '\\overline{x}',
47
- },
48
- {
49
- cmd: false,
50
- text: '\\overline{y}',
51
- },
52
- {
53
- cmd: false,
54
- text: 'x^i',
55
- },
56
- {
57
- cmd: false,
58
- text: 'x_i',
59
- },
60
- {
61
- cmd: false,
62
- text: 'x!',
63
- },
64
- {
65
- cmd: false,
66
- text: '\\Sigma',
67
- },
68
- ],
69
- },
70
- {
71
- name: 'shared.math.matrix',
72
- buttons: [
73
- {
74
- cmd: false,
75
- text: '\\begin{bmatrix} a & b \\\\ c & d \\end{bmatrix}',
76
- },
77
- {
78
- cmd: false,
79
- text: '\\begin{bmatrix} a & b & c \\\\ d & e & f \\\\ g & h & i \\end{bmatrix}',
80
- },
81
- ],
82
- },
83
- {
84
- name: 'shared.math.group',
85
- buttons: [
86
- {
87
- cmd: true,
88
- latex: '(\\placeholder{})',
89
- text: '(\\cdot)',
90
- },
91
- {
92
- cmd: true,
93
- latex: '[\\placeholder{}]',
94
- text: '[\\cdot]',
95
- },
96
- {
97
- cmd: true,
98
- latex: '|\\placeholder{}|',
99
- text: '|\\cdot|',
100
- },
101
- {
102
- cmd: false,
103
- text: '(x,y)',
104
- },
105
- {
106
- cmd: false,
107
- text: '[x,y]',
108
- },
109
- {
110
- cmd: false,
111
- text: '(x,y]',
112
- },
113
- {
114
- cmd: false,
115
- text: '[x,y)',
116
- },
117
- ],
118
- },
119
- {
120
- name: 'shared.math.equation_system',
121
- buttons: [
122
- {
123
- cmd: false,
124
- text: '\\begin{cases} x + y \\\\ x + y \\end{cases}',
125
- },
126
- {
127
- cmd: false,
128
- text: '\\begin{cases} x + y \\\\ x – y \\end{cases}',
129
- },
130
- ],
131
- },
132
- ],
133
- },
134
- },
135
- ],
136
- }