@windward/core 0.12.5 → 0.13.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.
- package/CHANGELOG.md +6 -0
- package/components/Navigation/Items/AskTheExpert.vue +84 -80
- package/components/Settings/TextEditorSettings.vue +7 -4
- package/components/utils/ContentViewer.vue +5 -0
- package/components/utils/TinyMCEWrapper.vue +1 -1
- package/components/utils/glossary/CourseGlossary.vue +1 -1
- package/helpers/tinymce/WindwardPlugins.ts +23 -8
- package/i18n/en-US/index.ts +1 -1
- package/i18n/en-US/shared/index.ts +4 -2
- package/i18n/en-US/shared/notification.ts +13 -0
- package/i18n/es-ES/index.ts +1 -1
- package/i18n/es-ES/shared/index.ts +4 -2
- package/i18n/es-ES/shared/notification.ts +14 -0
- package/i18n/sv-SE/index.ts +1 -1
- package/i18n/sv-SE/shared/index.ts +4 -2
- package/i18n/sv-SE/shared/notification.ts +13 -0
- package/package.json +2 -2
- package/plugin.js +1 -0
- package/utils/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,13 +7,28 @@
|
|
|
7
7
|
<v-list-item-title>
|
|
8
8
|
{{ $t(config.i18n) }}
|
|
9
9
|
</v-list-item-title>
|
|
10
|
-
<DialogBox
|
|
10
|
+
<DialogBox
|
|
11
|
+
:value="dialog"
|
|
12
|
+
color="primary"
|
|
13
|
+
action-save
|
|
14
|
+
text
|
|
15
|
+
:trigger="false"
|
|
16
|
+
@input="$emit('input', $event)"
|
|
17
|
+
@click:save="onSubmit"
|
|
18
|
+
@click:close="dialog = false"
|
|
19
|
+
>
|
|
11
20
|
<template #title>{{ $t(config.i18n) }}</template>
|
|
12
21
|
<template #form="{ on, attrs }">
|
|
13
|
-
<v-
|
|
22
|
+
<v-form
|
|
23
|
+
v-model="formValid"
|
|
24
|
+
flat
|
|
25
|
+
v-bind="attrs"
|
|
26
|
+
v-on="on"
|
|
27
|
+
@input="on['change:valid']($event)"
|
|
28
|
+
>
|
|
14
29
|
<v-container fluid>
|
|
15
30
|
<v-row>
|
|
16
|
-
<v-col cols="12"
|
|
31
|
+
<v-col cols="12">
|
|
17
32
|
<h3>
|
|
18
33
|
{{
|
|
19
34
|
$t(
|
|
@@ -31,27 +46,24 @@
|
|
|
31
46
|
"
|
|
32
47
|
cols="12"
|
|
33
48
|
>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
></v-text-field>
|
|
54
|
-
</v-col>
|
|
49
|
+
<h3 class="pb-4">
|
|
50
|
+
{{
|
|
51
|
+
$t(
|
|
52
|
+
'windward.core.components.navigation.ask_the_expert.config'
|
|
53
|
+
)
|
|
54
|
+
}}
|
|
55
|
+
</h3>
|
|
56
|
+
<v-text-field
|
|
57
|
+
v-model="courseAndContentName"
|
|
58
|
+
disabled
|
|
59
|
+
outlined
|
|
60
|
+
:label="
|
|
61
|
+
$t(
|
|
62
|
+
'windward.core.components.navigation.ask_the_expert.course_info'
|
|
63
|
+
)
|
|
64
|
+
"
|
|
65
|
+
:rules="$Validation.getRule('exists')"
|
|
66
|
+
></v-text-field>
|
|
55
67
|
</v-col>
|
|
56
68
|
<v-col
|
|
57
69
|
v-if="
|
|
@@ -62,48 +74,44 @@
|
|
|
62
74
|
"
|
|
63
75
|
cols="12"
|
|
64
76
|
>
|
|
65
|
-
<v-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<div>
|
|
80
|
-
{{
|
|
81
|
-
$t(
|
|
82
|
-
'windward.core.components.navigation.ask_the_expert.question'
|
|
83
|
-
)
|
|
84
|
-
}}
|
|
85
|
-
</div>
|
|
86
|
-
</template>
|
|
87
|
-
</v-textarea>
|
|
88
|
-
</v-col>
|
|
89
|
-
<v-col
|
|
90
|
-
cols="12"
|
|
91
|
-
class="pt-5 pb-5 d-flex flex-row-reverse"
|
|
77
|
+
<v-text-field
|
|
78
|
+
v-model="subject"
|
|
79
|
+
outlined
|
|
80
|
+
:rules="$Validation.getRule('exists')"
|
|
81
|
+
:label="
|
|
82
|
+
$t(
|
|
83
|
+
'windward.core.components.navigation.ask_the_expert.subject'
|
|
84
|
+
)
|
|
85
|
+
"
|
|
86
|
+
></v-text-field>
|
|
87
|
+
<v-textarea
|
|
88
|
+
v-model="body"
|
|
89
|
+
:rules="$Validation.getRule('exists')"
|
|
90
|
+
outlined
|
|
92
91
|
>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
102
|
-
</v-
|
|
92
|
+
<template #label>
|
|
93
|
+
<div>
|
|
94
|
+
{{
|
|
95
|
+
$t(
|
|
96
|
+
'windward.core.components.navigation.ask_the_expert.question'
|
|
97
|
+
)
|
|
98
|
+
}}
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
</v-textarea>
|
|
103
102
|
</v-col>
|
|
104
103
|
</v-row>
|
|
105
104
|
</v-container>
|
|
106
|
-
</v-
|
|
105
|
+
</v-form>
|
|
106
|
+
</template>
|
|
107
|
+
<template #actions-save-text>
|
|
108
|
+
<span>
|
|
109
|
+
<v-icon>mdi-send</v-icon>
|
|
110
|
+
{{ $t('shared.forms.send') }}
|
|
111
|
+
</span>
|
|
112
|
+
</template>
|
|
113
|
+
<template #actions-save-tooltip-text>
|
|
114
|
+
{{ $t('shared.forms.send') }}
|
|
107
115
|
</template>
|
|
108
116
|
</DialogBox>
|
|
109
117
|
</v-list-item-content>
|
|
@@ -115,6 +123,9 @@ import { mapGetters } from 'vuex'
|
|
|
115
123
|
import DialogBox from '~/components/Core/DialogBox.vue'
|
|
116
124
|
import AuthUserRepository from '~/models/repositories/AuthUserRepository'
|
|
117
125
|
import AskTheExpert from '~/models/AskTheExpert'
|
|
126
|
+
import Organization from '~/models/Organization'
|
|
127
|
+
import Course from '~/models/Course'
|
|
128
|
+
import CourseSection from '~/models/CourseSection'
|
|
118
129
|
|
|
119
130
|
export default {
|
|
120
131
|
name: 'NavigationItemAskTheExpert',
|
|
@@ -126,40 +137,33 @@ export default {
|
|
|
126
137
|
return {
|
|
127
138
|
currentUser: new AuthUserRepository(this.$nuxt),
|
|
128
139
|
expert: '',
|
|
129
|
-
course: this.$ContentService.getCourse(),
|
|
130
|
-
content: this.$ContentService.get().content,
|
|
131
140
|
courseAndContentName: '',
|
|
132
141
|
body: '',
|
|
133
142
|
subject: '',
|
|
134
143
|
dialog: false,
|
|
144
|
+
formValid: false,
|
|
135
145
|
}
|
|
136
146
|
},
|
|
137
147
|
computed: {
|
|
138
148
|
...mapGetters({
|
|
139
149
|
enrollment: 'enrollment/get',
|
|
150
|
+
courseContent: 'content/get',
|
|
151
|
+
course: 'course/get',
|
|
152
|
+
organization: 'organization/get',
|
|
140
153
|
}),
|
|
141
|
-
valid() {
|
|
142
|
-
if (this.body === '' || this.subject === '') {
|
|
143
|
-
return true
|
|
144
|
-
} else {
|
|
145
|
-
return false
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
mounted() {
|
|
150
|
-
this.courseAndContentName = this.course.name + ': ' + this.content.name
|
|
151
154
|
},
|
|
155
|
+
mounted() {},
|
|
152
156
|
methods: {
|
|
153
157
|
async onSubmit() {
|
|
154
158
|
const askTheExpertSubmission = new AskTheExpert({
|
|
155
159
|
body: this.body,
|
|
156
160
|
subject: this.subject,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
course_content_id: this.courseContent.id,
|
|
162
|
+
}).for(
|
|
163
|
+
new Organization({ id: this.organization.id }),
|
|
164
|
+
new Course({ id: this.course.id }),
|
|
165
|
+
new CourseSection({ id: this.enrollment.course_section_id })
|
|
166
|
+
)
|
|
163
167
|
await askTheExpertSubmission.save()
|
|
164
168
|
if (askTheExpertSubmission) {
|
|
165
169
|
this.$dialog.success('Ask The Expert Email Sent Successfully')
|
|
@@ -273,13 +273,16 @@ export default {
|
|
|
273
273
|
currentGlossary.push(this.selectedTerm)
|
|
274
274
|
}
|
|
275
275
|
const course = new Course(this.course)
|
|
276
|
-
|
|
276
|
+
|
|
277
|
+
// If the course metadata is empty then init it
|
|
278
|
+
if (_.isEmpty(course.metadata)) {
|
|
277
279
|
course.metadata = {}
|
|
278
280
|
course.metadata.glossary = {}
|
|
279
281
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
|
|
283
|
+
// Set the updated glossary
|
|
284
|
+
course.metadata.glossary = currentGlossary
|
|
285
|
+
|
|
283
286
|
const updatedCourse = await course.save()
|
|
284
287
|
this.$store.commit('course/set', updatedCourse)
|
|
285
288
|
this.$toast.success(this.$t('shared.forms.saved'))
|
|
@@ -32,6 +32,10 @@ export default {
|
|
|
32
32
|
let content = ''
|
|
33
33
|
if (this.value) {
|
|
34
34
|
content = _.cloneDeep(this.value)
|
|
35
|
+
|
|
36
|
+
content = content.replaceAll('{{', '<span>{{</span>')
|
|
37
|
+
content = content.replaceAll('}}', '<span>}}</span>')
|
|
38
|
+
|
|
35
39
|
if (
|
|
36
40
|
MathHelper.containsMathML(content) ||
|
|
37
41
|
MathHelper.containsLatex(content) ||
|
|
@@ -55,6 +59,7 @@ export default {
|
|
|
55
59
|
FillInBlankHelper.renderFillInTHeBlankHtml(content)
|
|
56
60
|
}
|
|
57
61
|
}
|
|
62
|
+
|
|
58
63
|
return Vue.compile('<div>' + content + '</div>')
|
|
59
64
|
},
|
|
60
65
|
},
|
|
@@ -330,7 +330,7 @@ export default {
|
|
|
330
330
|
const deleteIndex = this.glossaryTerms.indexOf(item)
|
|
331
331
|
this.glossaryTerms.splice(deleteIndex, 1)
|
|
332
332
|
const course = new Course(this.course)
|
|
333
|
-
if (
|
|
333
|
+
if (_.isEmpty(course.metadata)) {
|
|
334
334
|
course.metadata = {}
|
|
335
335
|
course.metadata.glossary = {}
|
|
336
336
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Scanner } from 'accessibility-scanner'
|
|
2
|
-
import _ from 'lodash'
|
|
2
|
+
import * as _ from 'lodash'
|
|
3
3
|
import local from '../../i18n/index'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -20,12 +20,23 @@ export class WindwardPlugins {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
public $t(key: string, replacements: string[] = []): string {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const browserLang: any = _.get(
|
|
24
|
+
navigator,
|
|
25
|
+
'languages[0]',
|
|
26
|
+
navigator.language || 'en-US'
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const lang: any =
|
|
30
|
+
local.messages[browserLang as keyof typeof local.messages] ||
|
|
31
|
+
local.messages['en-US']
|
|
25
32
|
|
|
33
|
+
// Fetch the translation string with a default empty string
|
|
34
|
+
let str = _.get(lang, key, '')
|
|
35
|
+
|
|
36
|
+
// Replace placeholders with replacements
|
|
26
37
|
str = str.replace(
|
|
27
38
|
/{(\d+)}/g,
|
|
28
|
-
(match:
|
|
39
|
+
(match: string, number: string) => replacements[+number] || match
|
|
29
40
|
)
|
|
30
41
|
|
|
31
42
|
return str
|
|
@@ -42,6 +53,7 @@ export class WindwardPlugins {
|
|
|
42
53
|
private registerIcon(iconName: string, svgPath: string) {
|
|
43
54
|
this.editor.ui.registry.addIcon(iconName, svgPath)
|
|
44
55
|
}
|
|
56
|
+
|
|
45
57
|
/**
|
|
46
58
|
* Adds icons to the editor's UI registry.
|
|
47
59
|
*/
|
|
@@ -59,6 +71,7 @@ export class WindwardPlugins {
|
|
|
59
71
|
'<svg viewBox="0 0 24 24" width="20px" height="20px" ><path d="M3,15H1V3A2,2 0 0,1 3,1H19V3H3V15M12,23A1,1 0 0,1 11,22V19H7A2,2 0 0,1 5,17V7A2,2 0 0,1 7,5H21A2,2 0 0,1 23,7V17A2,2 0 0,1 21,19H16.9L13.2,22.71C13,22.89 12.76,23 12.5,23H12M9,9V11H19V9H9M9,13V15H17V13H9Z"></path></svg>'
|
|
60
72
|
)
|
|
61
73
|
}
|
|
74
|
+
|
|
62
75
|
/**
|
|
63
76
|
* Opens the equation editor window in the TinyMCE editor.
|
|
64
77
|
* @return {void}
|
|
@@ -178,11 +191,12 @@ export class WindwardPlugins {
|
|
|
178
191
|
onAction: () => void
|
|
179
192
|
) {
|
|
180
193
|
this.editor.ui.registry.addButton(name, {
|
|
181
|
-
icon
|
|
182
|
-
tooltip
|
|
183
|
-
onAction
|
|
194
|
+
icon,
|
|
195
|
+
tooltip,
|
|
196
|
+
onAction,
|
|
184
197
|
})
|
|
185
198
|
}
|
|
199
|
+
|
|
186
200
|
/**
|
|
187
201
|
* Adds a menu item to the editor's UI registry.
|
|
188
202
|
*
|
|
@@ -200,7 +214,7 @@ export class WindwardPlugins {
|
|
|
200
214
|
): void {
|
|
201
215
|
this.editor.ui.registry.addMenuItem(itemKey, {
|
|
202
216
|
text: itemText,
|
|
203
|
-
icon
|
|
217
|
+
icon,
|
|
204
218
|
onAction: () => {
|
|
205
219
|
this.editor.execCommand(command, true)
|
|
206
220
|
},
|
|
@@ -257,6 +271,7 @@ export class WindwardPlugins {
|
|
|
257
271
|
this.setOnClickFillInBlank(this.editor)
|
|
258
272
|
})
|
|
259
273
|
}
|
|
274
|
+
|
|
260
275
|
/**
|
|
261
276
|
* Adds an onclick listener to all equation content within the editor.
|
|
262
277
|
*
|
package/i18n/en-US/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contentBlocks from './content_blocks'
|
|
2
2
|
import settings from './settings'
|
|
3
3
|
import menu from './menu'
|
|
4
|
+
import notification from './notification'
|
|
4
5
|
import permission from './permission'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
|
-
content_blocks,
|
|
8
|
+
content_blocks: contentBlocks,
|
|
8
9
|
settings,
|
|
9
10
|
menu,
|
|
11
|
+
notification,
|
|
10
12
|
permission,
|
|
11
13
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
event: {
|
|
3
|
+
type_title: {
|
|
4
|
+
'windward-core-ask-the-expert': 'Course Ask the Expert',
|
|
5
|
+
'windward-core-contact-support': 'Course Contact Support',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
type_description: {
|
|
9
|
+
'windward-core-ask-the-expert': 'Course Ask the Expert',
|
|
10
|
+
'windward-core-contact-support': 'Course Contact Support',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
}
|
package/i18n/es-ES/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contentBlocks from './content_blocks'
|
|
2
2
|
import settings from './settings'
|
|
3
3
|
import menu from './menu'
|
|
4
|
+
import notification from './notification'
|
|
4
5
|
import permission from './permission'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
|
-
content_blocks,
|
|
8
|
+
content_blocks: contentBlocks,
|
|
8
9
|
settings,
|
|
9
10
|
menu,
|
|
11
|
+
notification,
|
|
10
12
|
permission,
|
|
11
13
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
event: {
|
|
3
|
+
type_title: {
|
|
4
|
+
'windward-core-ask-the-expert': 'Curso Pregúntele al experto',
|
|
5
|
+
'windward-core-contact-support':
|
|
6
|
+
'Curso Comuníquese con el soporte técnico',
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
type_description: {
|
|
10
|
+
'windward-core-ask-the-expert': 'Curso Pregúntele al experto',
|
|
11
|
+
'windward-core-contact-support': 'Soporte de contacto del curso',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
}
|
package/i18n/sv-SE/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contentBlocks from './content_blocks'
|
|
2
2
|
import settings from './settings'
|
|
3
3
|
import menu from './menu'
|
|
4
|
+
import notification from './notification'
|
|
4
5
|
import permission from './permission'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
|
-
content_blocks,
|
|
8
|
+
content_blocks: contentBlocks,
|
|
8
9
|
settings,
|
|
9
10
|
menu,
|
|
11
|
+
notification,
|
|
10
12
|
permission,
|
|
11
13
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
event: {
|
|
3
|
+
type_title: {
|
|
4
|
+
'windward-core-ask-the-expert': 'Kurs Fråga experten',
|
|
5
|
+
'windward-core-contact-support': 'Course Contact Support',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
type_description: {
|
|
9
|
+
'windward-core-ask-the-expert': 'Kurs Fråga experten',
|
|
10
|
+
'windward-core-contact-support': 'Course Contact Support',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windward/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Windward UI Core Plugins",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://bitbucket.org/mindedge/windward-ui-plugin-core#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@mindedge/vuetify-player": "^0.4.
|
|
24
|
+
"@mindedge/vuetify-player": "^0.4.7",
|
|
25
25
|
"@tinymce/tinymce-vue": "^3.2.8",
|
|
26
26
|
"accessibility-scanner": "^0.0.1",
|
|
27
27
|
"eslint": "^8.11.0",
|
package/plugin.js
CHANGED
package/utils/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import TinyMCEWrapper from '../components/utils/TinyMCEWrapper.vue'
|
|
|
7
7
|
import MathExpressionEditor from '../components/utils/MathExpressionEditor'
|
|
8
8
|
import CourseGlossary from '../components/utils/glossary/CourseGlossary.vue'
|
|
9
9
|
import CourseGlossaryForm from '../components/utils/glossary/CourseGlossaryForm.vue'
|
|
10
|
-
import GenerateAIQuestionButton from '../components/Content/Blocks/GenerateAIQuestionButton.vue'
|
|
10
|
+
import GenerateAIQuestionButton from '../components/Content/Blocks/GenerateAIQuestionButton.vue'
|
|
11
|
+
|
|
11
12
|
export {
|
|
12
13
|
MathHelper,
|
|
13
14
|
ContentViewer,
|