@windward/core 0.0.3 → 0.0.6
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/.vscode/settings.json +3 -0
- package/README.md +2 -1
- package/components/Content/Blocks/ClickableIcons.vue +12 -3
- package/components/Content/Blocks/Feedback.vue +19 -11
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionLikert.vue +6 -6
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionOpenResponse.vue +11 -10
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionTrueFalse.vue +3 -3
- package/components/Content/Blocks/Video.vue +2 -2
- package/components/Navigation/Items/AskTheExpert.vue +173 -0
- package/components/Settings/ClickableIconsSettings.vue +10 -5
- package/components/Settings/FeedbackSettings.vue +3 -3
- package/components/Settings/UserUploadSettings.vue +2 -2
- package/components/Settings/VideoSettings.vue +6 -6
- package/components/utils/ContentViewer.vue +15 -4
- package/components/utils/FillInBlank/FillInBlankInput.vue +208 -0
- package/components/utils/FillInBlank/FillInTheBlanksManager.vue +98 -0
- package/components/utils/MathExpressionEditor.vue +8 -6
- package/components/utils/TinyMCEWrapper.vue +48 -8
- package/components/utils/assets/tinymce/css/content.scss +9 -0
- package/components/utils/glossary/CourseGlossary.vue +12 -8
- package/components/utils/glossary/CourseGlossaryForm.vue +24 -5
- package/helpers/FillInBlankHelper.ts +55 -0
- package/helpers/GlossaryHelper.ts +4 -4
- package/helpers/tinymce/plugin.ts +99 -4
- package/i18n/en-US/components/content/blocks/feedback.ts +3 -0
- package/i18n/en-US/components/index.ts +0 -1
- package/i18n/en-US/components/navigation/ask_the_expert.ts +11 -0
- package/i18n/en-US/components/navigation/index.ts +2 -0
- package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
- package/i18n/en-US/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
- package/i18n/en-US/components/utils/FillInBlank/index.ts +6 -0
- package/i18n/en-US/components/utils/index.ts +2 -1
- package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/en-US/shared/menu.ts +1 -0
- package/i18n/es-ES/components/content/blocks/feedback.ts +29 -0
- package/i18n/es-ES/components/content/blocks/image.ts +5 -0
- package/i18n/es-ES/components/content/blocks/index.ts +15 -0
- package/i18n/es-ES/components/content/blocks/tab.ts +4 -0
- package/i18n/es-ES/components/content/blocks/table.ts +4 -0
- package/i18n/es-ES/components/content/blocks/user_upload.ts +13 -0
- package/i18n/es-ES/components/content/blocks/video.ts +55 -0
- package/i18n/es-ES/components/content/index.ts +5 -0
- package/i18n/es-ES/components/index.ts +12 -0
- package/i18n/es-ES/components/navigation/ask_the_expert.ts +11 -0
- package/i18n/es-ES/components/navigation/image.ts +4 -0
- package/i18n/es-ES/components/navigation/index.ts +7 -0
- package/i18n/es-ES/components/navigation/user_upload.ts +3 -0
- package/i18n/es-ES/components/settings/clickable_icon.ts +10 -0
- package/i18n/es-ES/components/settings/image.ts +1 -0
- package/i18n/es-ES/components/settings/index.ts +13 -0
- package/i18n/es-ES/components/settings/text_editor.ts +7 -0
- package/i18n/es-ES/components/settings/user_upload.ts +11 -0
- package/i18n/es-ES/components/settings/video.ts +13 -0
- package/i18n/es-ES/components/utils/index.ts +5 -0
- package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +18 -0
- package/i18n/es-ES/index.ts +16 -0
- package/i18n/es-ES/modules/index.ts +5 -0
- package/i18n/es-ES/pages/glossary.ts +7 -0
- package/i18n/es-ES/pages/index.ts +7 -0
- package/i18n/es-ES/pages/user_upload.ts +3 -0
- package/i18n/es-ES/shared/content_blocks.ts +20 -0
- package/i18n/es-ES/shared/index.ts +11 -0
- package/i18n/es-ES/shared/menu.ts +3 -0
- package/i18n/es-ES/shared/permission.ts +15 -0
- package/i18n/es-ES/shared/settings.ts +16 -0
- package/i18n/sv-SE/components/content/blocks/feedback.ts +29 -0
- package/i18n/sv-SE/components/content/blocks/image.ts +5 -0
- package/i18n/sv-SE/components/content/blocks/index.ts +15 -0
- package/i18n/sv-SE/components/content/blocks/tab.ts +4 -0
- package/i18n/sv-SE/components/content/blocks/table.ts +4 -0
- package/i18n/sv-SE/components/content/blocks/user_upload.ts +13 -0
- package/i18n/sv-SE/components/content/blocks/video.ts +53 -0
- package/i18n/sv-SE/components/content/index.ts +5 -0
- package/i18n/sv-SE/components/index.ts +12 -0
- package/i18n/sv-SE/components/navigation/ask_the_expert.ts +11 -0
- package/i18n/sv-SE/components/navigation/image.ts +4 -0
- package/i18n/sv-SE/components/navigation/index.ts +7 -0
- package/i18n/sv-SE/components/navigation/user_upload.ts +3 -0
- package/i18n/sv-SE/components/settings/clickable_icon.ts +10 -0
- package/i18n/sv-SE/components/settings/image.ts +1 -0
- package/i18n/sv-SE/components/settings/index.ts +13 -0
- package/i18n/sv-SE/components/settings/text_editor.ts +7 -0
- package/i18n/sv-SE/components/settings/user_upload.ts +11 -0
- package/i18n/sv-SE/components/settings/video.ts +13 -0
- package/i18n/sv-SE/components/utils/index.ts +5 -0
- package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +18 -0
- package/i18n/sv-SE/index.ts +16 -0
- package/i18n/sv-SE/modules/index.ts +5 -0
- package/i18n/sv-SE/pages/glossary.ts +7 -0
- package/i18n/sv-SE/pages/index.ts +7 -0
- package/i18n/sv-SE/pages/user_upload.ts +3 -0
- package/{lib/i18n/en-US/shared/content_blocks.js → i18n/sv-SE/shared/content_blocks.ts} +8 -9
- package/i18n/sv-SE/shared/index.ts +11 -0
- package/i18n/sv-SE/shared/menu.ts +3 -0
- package/i18n/sv-SE/shared/permission.ts +15 -0
- package/i18n/sv-SE/shared/settings.ts +15 -0
- package/package.json +1 -1
- package/pages/glossary.vue +2 -2
- package/pages/userUpload.vue +1 -1
- package/plugin.js +28 -3
- package/.idea/codeStyles/Project.xml +0 -58
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/php-docker-settings.xml +0 -24
- package/.idea/php.xml +0 -19
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/windward-ui-plugin-core.iml +0 -8
- package/coverage/clover.xml +0 -223
- package/coverage/coverage-final.json +0 -16
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
- package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
- package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
- package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
- package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
- package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
- package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
- package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
- package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
- package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
- package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
- package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
- package/coverage/lcov-report/components/utils/index.html +0 -161
- package/coverage/lcov-report/config/index.html +0 -116
- package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
- package/coverage/lcov-report/helpers/index.html +0 -116
- package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
- package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
- package/coverage/lcov-report/index.html +0 -191
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov-report/test/mocks.js.html +0 -457
- package/coverage/lcov.info +0 -403
- package/lib/helpers/GlossaryHelper.d.ts +0 -9
- package/lib/helpers/GlossaryHelper.js +0 -118
- package/lib/helpers/GlossaryTerm.d.ts +0 -10
- package/lib/helpers/GlossaryTerm.js +0 -22
- package/lib/helpers/MathHelper.d.ts +0 -99
- package/lib/helpers/MathHelper.js +0 -194
- package/lib/helpers/tinymce/plugin.d.ts +0 -2
- package/lib/helpers/tinymce/plugin.js +0 -86
- package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
- package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
- package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
- package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
- package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
- package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
- package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
- package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
- package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
- package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
- package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
- package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
- package/lib/i18n/en-US/components/content/index.d.ts +0 -77
- package/lib/i18n/en-US/components/content/index.js +0 -6
- package/lib/i18n/en-US/components/index.d.ts +0 -140
- package/lib/i18n/en-US/components/index.js +0 -12
- package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
- package/lib/i18n/en-US/components/navigation/image.js +0 -6
- package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
- package/lib/i18n/en-US/components/navigation/index.js +0 -8
- package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
- package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
- package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
- package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
- package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
- package/lib/i18n/en-US/components/settings/image.js +0 -3
- package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
- package/lib/i18n/en-US/components/settings/index.js +0 -14
- package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
- package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
- package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
- package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
- package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
- package/lib/i18n/en-US/components/settings/video.js +0 -14
- package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
- package/lib/i18n/en-US/components/utils/index.js +0 -6
- package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
- package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
- package/lib/i18n/en-US/index.d.ts +0 -197
- package/lib/i18n/en-US/index.js +0 -16
- package/lib/i18n/en-US/modules/index.d.ts +0 -2
- package/lib/i18n/en-US/modules/index.js +0 -6
- package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
- package/lib/i18n/en-US/pages/glossary.js +0 -9
- package/lib/i18n/en-US/pages/index.d.ts +0 -13
- package/lib/i18n/en-US/pages/index.js +0 -8
- package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
- package/lib/i18n/en-US/pages/user_upload.js +0 -5
- package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
- package/lib/i18n/en-US/shared/index.d.ts +0 -39
- package/lib/i18n/en-US/shared/index.js +0 -10
- package/lib/i18n/en-US/shared/menu.d.ts +0 -4
- package/lib/i18n/en-US/shared/menu.js +0 -5
- package/lib/i18n/en-US/shared/settings.d.ts +0 -15
- package/lib/i18n/en-US/shared/settings.js +0 -16
- package/lib/i18n/en-US.d.ts +0 -197
- package/lib/i18n/en-US.js +0 -15
- package/lib/models/UserFileAsset.d.ts +0 -5
- package/lib/models/UserFileAsset.js +0 -37
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="fib">
|
|
3
|
+
<v-dialog v-model="show" max-width="300">
|
|
4
|
+
<v-card>
|
|
5
|
+
<v-card-title class="text-h5">
|
|
6
|
+
{{
|
|
7
|
+
answerIsCorrect
|
|
8
|
+
? $t(
|
|
9
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.correct'
|
|
10
|
+
)
|
|
11
|
+
: $t(
|
|
12
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.incorrect'
|
|
13
|
+
)
|
|
14
|
+
}}
|
|
15
|
+
</v-card-title>
|
|
16
|
+
<v-card-text>
|
|
17
|
+
<div v-if="answerIsCorrect || showAnswer">
|
|
18
|
+
<p>
|
|
19
|
+
<ContentViewer v-model="computedDescription" />
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
<div v-else-if="!answerIsCorrect && userInput">
|
|
23
|
+
{{
|
|
24
|
+
$t(
|
|
25
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.input_incorrect',
|
|
26
|
+
[userInput]
|
|
27
|
+
)
|
|
28
|
+
}}
|
|
29
|
+
</div>
|
|
30
|
+
</v-card-text>
|
|
31
|
+
<v-card-actions>
|
|
32
|
+
<v-container justify="center" align="center" class="pb-5">
|
|
33
|
+
<v-row justify="center" align="center"
|
|
34
|
+
><v-btn
|
|
35
|
+
ref="action_button_1"
|
|
36
|
+
color="primary"
|
|
37
|
+
outlined
|
|
38
|
+
@click="show = false"
|
|
39
|
+
>
|
|
40
|
+
{{
|
|
41
|
+
answerIsCorrect
|
|
42
|
+
? $t(
|
|
43
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.close'
|
|
44
|
+
)
|
|
45
|
+
: $t(
|
|
46
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.try_again'
|
|
47
|
+
)
|
|
48
|
+
}}
|
|
49
|
+
</v-btn>
|
|
50
|
+
<v-btn
|
|
51
|
+
color="primary"
|
|
52
|
+
outlined
|
|
53
|
+
@click="displayAnswer"
|
|
54
|
+
v-if="!answerIsCorrect"
|
|
55
|
+
>
|
|
56
|
+
{{
|
|
57
|
+
$t(
|
|
58
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.answer'
|
|
59
|
+
)
|
|
60
|
+
}}
|
|
61
|
+
</v-btn></v-row
|
|
62
|
+
>
|
|
63
|
+
</v-container>
|
|
64
|
+
</v-card-actions>
|
|
65
|
+
</v-card>
|
|
66
|
+
</v-dialog>
|
|
67
|
+
|
|
68
|
+
<div class="fib">
|
|
69
|
+
<v-text-field
|
|
70
|
+
:disabled="false"
|
|
71
|
+
outlined
|
|
72
|
+
dense
|
|
73
|
+
v-model="userInput"
|
|
74
|
+
clear-icon="mdi-close-circle-outline"
|
|
75
|
+
@click:append-outer="toggleToolTip"
|
|
76
|
+
clearable
|
|
77
|
+
:background-color="feedback"
|
|
78
|
+
:placeholder="
|
|
79
|
+
$t(
|
|
80
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.add_answer'
|
|
81
|
+
)
|
|
82
|
+
"
|
|
83
|
+
@input="showAnswer = false"
|
|
84
|
+
@keydown="onPressEnter"
|
|
85
|
+
></v-text-field>
|
|
86
|
+
|
|
87
|
+
<v-btn
|
|
88
|
+
v-if="userInput && userInput.length > 0"
|
|
89
|
+
@click="toggleToolTip"
|
|
90
|
+
color="primary"
|
|
91
|
+
outlined
|
|
92
|
+
:aria-label="
|
|
93
|
+
$t(
|
|
94
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.check_answer'
|
|
95
|
+
)
|
|
96
|
+
"
|
|
97
|
+
>{{
|
|
98
|
+
show
|
|
99
|
+
? $t(
|
|
100
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.reset'
|
|
101
|
+
)
|
|
102
|
+
: $t(
|
|
103
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.check'
|
|
104
|
+
)
|
|
105
|
+
}}</v-btn
|
|
106
|
+
>
|
|
107
|
+
</div>
|
|
108
|
+
</span>
|
|
109
|
+
</template>
|
|
110
|
+
<script>
|
|
111
|
+
import ContentViewer from '../ContentViewer.vue'
|
|
112
|
+
import _ from 'lodash'
|
|
113
|
+
export default {
|
|
114
|
+
name: 'FillInBlankInput',
|
|
115
|
+
components: { ContentViewer },
|
|
116
|
+
props: {
|
|
117
|
+
answer: { type: String, required: true },
|
|
118
|
+
description: {
|
|
119
|
+
type: String,
|
|
120
|
+
required: false,
|
|
121
|
+
default: '',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
data() {
|
|
126
|
+
return {
|
|
127
|
+
userInput: '',
|
|
128
|
+
show: false,
|
|
129
|
+
showAnswer: false,
|
|
130
|
+
timerId: '',
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
computed: {
|
|
135
|
+
answerIsCorrect() {
|
|
136
|
+
if (_.toLower(this.answer) === _.toLower(this.userInput)) {
|
|
137
|
+
return true
|
|
138
|
+
}
|
|
139
|
+
return false
|
|
140
|
+
},
|
|
141
|
+
feedback() {
|
|
142
|
+
if (this.answerIsCorrect && this.showAnswer) {
|
|
143
|
+
return 'light-green lighten-2'
|
|
144
|
+
}
|
|
145
|
+
if (this.show && !this.answerIsCorrect) {
|
|
146
|
+
return 'red lighten-3'
|
|
147
|
+
}
|
|
148
|
+
return ''
|
|
149
|
+
},
|
|
150
|
+
computedDescription() {
|
|
151
|
+
return atob(this.description)
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
methods: {
|
|
155
|
+
setFocusAction() {
|
|
156
|
+
this.$refs.action_button_1.$el.focus()
|
|
157
|
+
},
|
|
158
|
+
onPressEnter(e) {
|
|
159
|
+
if (e.code === 'Enter') {
|
|
160
|
+
this.toggleToolTip()
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
reset() {
|
|
164
|
+
this.show = false
|
|
165
|
+
},
|
|
166
|
+
displayAnswer() {
|
|
167
|
+
this.userInput = this.answer
|
|
168
|
+
},
|
|
169
|
+
toggleToolTip() {
|
|
170
|
+
if (this.showAnswer === true) {
|
|
171
|
+
this.showAnswer = false
|
|
172
|
+
}
|
|
173
|
+
if (this.answerIsCorrect) {
|
|
174
|
+
this.show = true
|
|
175
|
+
this.showAnswer = true
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.show = !this.show
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
watch: {
|
|
183
|
+
//set focus on the action button when dialog loaded for accessibility
|
|
184
|
+
show: function (newValue) {
|
|
185
|
+
if (newValue) {
|
|
186
|
+
this.timerId = setTimeout(() => {
|
|
187
|
+
this.setFocusAction()
|
|
188
|
+
}, 100)
|
|
189
|
+
} else {
|
|
190
|
+
if (this.timerId !== '') {
|
|
191
|
+
clearTimeout(this.timeout)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
}
|
|
197
|
+
</script>
|
|
198
|
+
<style scoped>
|
|
199
|
+
.fib {
|
|
200
|
+
display: inline-flex;
|
|
201
|
+
}
|
|
202
|
+
.correct {
|
|
203
|
+
background-color: #7c7;
|
|
204
|
+
}
|
|
205
|
+
.incorrect {
|
|
206
|
+
background: #e01f1f;
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-row align="center" justify="center">
|
|
4
|
+
<v-col>
|
|
5
|
+
<v-row align="center" justify="center">
|
|
6
|
+
<v-text-field
|
|
7
|
+
class="col-10"
|
|
8
|
+
:label="
|
|
9
|
+
$t(
|
|
10
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_the_blank_manager.answer'
|
|
11
|
+
)
|
|
12
|
+
"
|
|
13
|
+
v-model="answer"
|
|
14
|
+
outlined
|
|
15
|
+
@input="submit"
|
|
16
|
+
></v-text-field>
|
|
17
|
+
</v-row>
|
|
18
|
+
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
<v-row align="center" justify="center">
|
|
22
|
+
<TextEditor
|
|
23
|
+
:key="key"
|
|
24
|
+
v-model="feedback"
|
|
25
|
+
@input="submit"
|
|
26
|
+
></TextEditor>
|
|
27
|
+
</v-row>
|
|
28
|
+
</v-col>
|
|
29
|
+
</v-row>
|
|
30
|
+
</v-container>
|
|
31
|
+
</template>
|
|
32
|
+
<script>
|
|
33
|
+
import TextEditor from '~/components/Text/TextEditor.vue'
|
|
34
|
+
import _ from 'lodash'
|
|
35
|
+
import Crypto from '~/helpers/Crypto'
|
|
36
|
+
export default {
|
|
37
|
+
name: 'FillInTheBlanksManager',
|
|
38
|
+
components: { TextEditor },
|
|
39
|
+
data() {
|
|
40
|
+
return {
|
|
41
|
+
answer: '',
|
|
42
|
+
feedback: '',
|
|
43
|
+
key: '',
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
mounted() {
|
|
47
|
+
window.parent.postMessage(
|
|
48
|
+
{
|
|
49
|
+
mceAction: 'fib-plugin-mounted',
|
|
50
|
+
status: true,
|
|
51
|
+
},
|
|
52
|
+
'*'
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
created() {
|
|
56
|
+
window.parent.addEventListener('message', (event) => {
|
|
57
|
+
if (event.data.answer)
|
|
58
|
+
this.init({
|
|
59
|
+
answer: event.data.answer,
|
|
60
|
+
feedback: event.data.feedback,
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
computed: {},
|
|
66
|
+
|
|
67
|
+
methods: {
|
|
68
|
+
init(data) {
|
|
69
|
+
this.answer = data.answer
|
|
70
|
+
this.feedback = _.cloneDeep(
|
|
71
|
+
atob(data.feedback ? data.feedback : 'empty')
|
|
72
|
+
)
|
|
73
|
+
this.key = Crypto.id()
|
|
74
|
+
},
|
|
75
|
+
submit() {
|
|
76
|
+
window.parent.postMessage(
|
|
77
|
+
{
|
|
78
|
+
mceAction: 'fib-insert',
|
|
79
|
+
content: {
|
|
80
|
+
answer: this.answer,
|
|
81
|
+
feedback: btoa(this.feedback),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
'*'
|
|
85
|
+
)
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
<style scoped>
|
|
91
|
+
.correct,
|
|
92
|
+
p {
|
|
93
|
+
background: #7c7;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.answer {
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
primary
|
|
61
61
|
color="success"
|
|
62
62
|
@click="setSRText"
|
|
63
|
-
:class="
|
|
63
|
+
:class="fontSize"
|
|
64
64
|
>{{ $t('shared.accessibility.default_text') }}
|
|
65
65
|
</v-btn>
|
|
66
66
|
<v-btn
|
|
67
67
|
:disabled="spokenTextChanged"
|
|
68
68
|
color="primary"
|
|
69
|
-
:class="
|
|
69
|
+
:class="fontSize"
|
|
70
70
|
@click="readSRText"
|
|
71
71
|
>{{
|
|
72
72
|
$t(
|
|
@@ -140,7 +140,6 @@ export default {
|
|
|
140
140
|
tab: null,
|
|
141
141
|
toggle_exclusive: true,
|
|
142
142
|
panel: [],
|
|
143
|
-
shrinkClass: '',
|
|
144
143
|
}
|
|
145
144
|
},
|
|
146
145
|
computed: {
|
|
@@ -151,6 +150,12 @@ export default {
|
|
|
151
150
|
|
|
152
151
|
return plugin[0]
|
|
153
152
|
},
|
|
153
|
+
fontSize() {
|
|
154
|
+
if (this.shrinkFont === true) {
|
|
155
|
+
return 'adjustFont'
|
|
156
|
+
}
|
|
157
|
+
return ''
|
|
158
|
+
},
|
|
154
159
|
},
|
|
155
160
|
beforeMount() {
|
|
156
161
|
if (this.mode === 'standalone') {
|
|
@@ -158,9 +163,6 @@ export default {
|
|
|
158
163
|
}
|
|
159
164
|
},
|
|
160
165
|
mounted() {
|
|
161
|
-
if (this.shrinkFont === true) {
|
|
162
|
-
this.shrinkClass = 'adjustFont'
|
|
163
|
-
}
|
|
164
166
|
if (this.mode === 'plugin') {
|
|
165
167
|
window.parent.postMessage(
|
|
166
168
|
{
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<script>
|
|
15
15
|
import _ from 'lodash'
|
|
16
16
|
import Editor from '@tinymce/tinymce-vue'
|
|
17
|
-
import {
|
|
17
|
+
import { WindwardPlugins } from '../../helpers/tinymce/plugin'
|
|
18
18
|
import contentCss from '!raw-loader!sass-loader!./assets/tinymce/css/content.scss'
|
|
19
19
|
import Crypto from '~/helpers/Crypto'
|
|
20
20
|
export default {
|
|
@@ -50,11 +50,11 @@ export default {
|
|
|
50
50
|
return {
|
|
51
51
|
height: 500,
|
|
52
52
|
visual: false,
|
|
53
|
-
menubar: 'file edit insert format view table help',
|
|
53
|
+
menubar: 'file edit insert format view table windward help',
|
|
54
54
|
menu: {
|
|
55
55
|
insert: {
|
|
56
56
|
title: 'Insert',
|
|
57
|
-
items: ' link inserttable | charmap | anchor | math | insertdatetime',
|
|
57
|
+
items: ' link inserttable | charmap | anchor | math | FIB | insertdatetime',
|
|
58
58
|
},
|
|
59
59
|
table: {
|
|
60
60
|
title: 'Table',
|
|
@@ -65,10 +65,10 @@ export default {
|
|
|
65
65
|
'advlist autolink lists link charmap',
|
|
66
66
|
'searchreplace visualblocks code fullscreen',
|
|
67
67
|
'anchor insertdatetime ',
|
|
68
|
-
'paste code wordcount table
|
|
68
|
+
'paste code wordcount table WindwardToolKit ',
|
|
69
69
|
],
|
|
70
70
|
toolbar:
|
|
71
|
-
'undo redo | formatselect | bold italic | alignleft aligncenter alignright | table bullist numlist outdent indent | mathButton',
|
|
71
|
+
'undo redo | formatselect | bold italic | alignleft aligncenter alignright | table bullist numlist outdent indent | mathButton ',
|
|
72
72
|
table_advtab: false,
|
|
73
73
|
table_cell_advtab: false,
|
|
74
74
|
table_row_advtab: false,
|
|
@@ -149,8 +149,8 @@ export default {
|
|
|
149
149
|
setup() {
|
|
150
150
|
// Here we can add plugin
|
|
151
151
|
window.tinymce.PluginManager.add(
|
|
152
|
-
'
|
|
153
|
-
|
|
152
|
+
'WindwardToolKit',
|
|
153
|
+
WindwardPlugins
|
|
154
154
|
)
|
|
155
155
|
},
|
|
156
156
|
formats: {
|
|
@@ -163,6 +163,21 @@ export default {
|
|
|
163
163
|
},
|
|
164
164
|
classes: 'glossary-word',
|
|
165
165
|
},
|
|
166
|
+
fib: {
|
|
167
|
+
title: this.$t(
|
|
168
|
+
'windward.core.components.utils.tiny_mce_wrapper.fill_blank'
|
|
169
|
+
),
|
|
170
|
+
inline: 'span',
|
|
171
|
+
classes: 'windward-fill-blank',
|
|
172
|
+
attributes: {
|
|
173
|
+
contenteditable: 'true',
|
|
174
|
+
'data-feedback': btoa(
|
|
175
|
+
this.$t(
|
|
176
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.default.description'
|
|
177
|
+
)
|
|
178
|
+
),
|
|
179
|
+
},
|
|
180
|
+
},
|
|
166
181
|
removeformat: [
|
|
167
182
|
// Configures `clear formatting` to remove the class glossary-word from spans and if the element then becomes empty it's left intact
|
|
168
183
|
{
|
|
@@ -170,15 +185,30 @@ export default {
|
|
|
170
185
|
classes: 'glossary-word',
|
|
171
186
|
remove: 'all',
|
|
172
187
|
},
|
|
188
|
+
{
|
|
189
|
+
selector: 'span',
|
|
190
|
+
classes: 'windward-fill-blank',
|
|
191
|
+
remove: 'all',
|
|
192
|
+
split: true,
|
|
193
|
+
expand: false,
|
|
194
|
+
deep: true,
|
|
195
|
+
},
|
|
173
196
|
],
|
|
174
197
|
},
|
|
175
198
|
style_formats: [
|
|
199
|
+
{ title: 'Windward formats' },
|
|
176
200
|
{
|
|
177
201
|
title: this.$t(
|
|
178
202
|
'windward.core.components.utils.tiny_mce_wrapper.term'
|
|
179
203
|
),
|
|
180
204
|
format: 'glossary',
|
|
181
205
|
},
|
|
206
|
+
{
|
|
207
|
+
title: this.$t(
|
|
208
|
+
'windward.core.components.utils.tiny_mce_wrapper.fill_blank'
|
|
209
|
+
),
|
|
210
|
+
format: 'fib',
|
|
211
|
+
},
|
|
182
212
|
],
|
|
183
213
|
style_formats_merge: true,
|
|
184
214
|
placeholder: this.$t(
|
|
@@ -188,7 +218,17 @@ export default {
|
|
|
188
218
|
|
|
189
219
|
skin: this.$vuetify.theme.isDark ? 'oxide-dark' : 'oxide',
|
|
190
220
|
content_css: this.$vuetify.theme.isDark ? 'dark' : 'default',
|
|
191
|
-
|
|
221
|
+
//we need to inject the glossary style directly
|
|
222
|
+
content_style:
|
|
223
|
+
contentCss +
|
|
224
|
+
' .glossary-word {\n' +
|
|
225
|
+
' display: inline-block;\n' +
|
|
226
|
+
' border-radius: 12px;\n' +
|
|
227
|
+
' padding: 0px 7px;\n' +
|
|
228
|
+
' background-color: #ffd269;\n ' +
|
|
229
|
+
' font-weight: bold;\n' +
|
|
230
|
+
' color: #1a1d1e;' +
|
|
231
|
+
'}',
|
|
192
232
|
importcss_append: true,
|
|
193
233
|
}
|
|
194
234
|
},
|
|
@@ -140,14 +140,14 @@ export default {
|
|
|
140
140
|
{
|
|
141
141
|
text: this.$t('windward.core.pages.glossary.term'),
|
|
142
142
|
align: 'start',
|
|
143
|
-
sortable:
|
|
144
|
-
value: '
|
|
143
|
+
sortable: true,
|
|
144
|
+
value: 'term',
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
text: this.$t('windward.core.pages.glossary.definition'),
|
|
148
148
|
align: 'start',
|
|
149
149
|
sortable: true,
|
|
150
|
-
value: '
|
|
150
|
+
value: 'definition',
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
text: this.$t(
|
|
@@ -155,13 +155,13 @@ export default {
|
|
|
155
155
|
),
|
|
156
156
|
align: 'start',
|
|
157
157
|
sortable: true,
|
|
158
|
-
value: '
|
|
158
|
+
value: 'alternate_forms',
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
text: this.$t('windward.core.pages.glossary.related_term'),
|
|
162
162
|
align: 'start',
|
|
163
163
|
sortable: true,
|
|
164
|
-
value: '
|
|
164
|
+
value: 'related_term',
|
|
165
165
|
},
|
|
166
166
|
],
|
|
167
167
|
dialog: false,
|
|
@@ -207,12 +207,16 @@ export default {
|
|
|
207
207
|
} else {
|
|
208
208
|
this.glossaryTerms.push(this.selectedTerm)
|
|
209
209
|
}
|
|
210
|
-
const course = new Course(this.course)
|
|
211
|
-
if (
|
|
210
|
+
const course = new Course(_.cloneDeep(this.course))
|
|
211
|
+
if (
|
|
212
|
+
!course.hasOwnProperty('metadata') ||
|
|
213
|
+
course.metadata === null
|
|
214
|
+
) {
|
|
212
215
|
course.metadata = {}
|
|
213
216
|
course.metadata.glossary = {}
|
|
214
217
|
}
|
|
215
|
-
|
|
218
|
+
|
|
219
|
+
if (course.metadata.glossary !== undefined) {
|
|
216
220
|
course.metadata.glossary = this.glossaryTerms
|
|
217
221
|
}
|
|
218
222
|
const updatedCourse = await course.save()
|
|
@@ -10,19 +10,31 @@
|
|
|
10
10
|
<br />
|
|
11
11
|
<v-textarea
|
|
12
12
|
v-model="selectedTerm.definition"
|
|
13
|
-
:counter="255"
|
|
14
13
|
:label="$t('windward.core.pages.glossary.definition')"
|
|
15
14
|
outlined
|
|
16
15
|
required
|
|
17
16
|
:rules="validation.definitionRules"
|
|
18
17
|
></v-textarea>
|
|
19
18
|
<br />
|
|
20
|
-
<v-
|
|
19
|
+
<v-combobox
|
|
21
20
|
v-model="selectedTerm.alternate_forms"
|
|
22
|
-
|
|
21
|
+
chips
|
|
22
|
+
clearable
|
|
23
23
|
:label="$t('windward.core.pages.glossary.alternate_forms')"
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
multiple
|
|
25
|
+
solo
|
|
26
|
+
>
|
|
27
|
+
<template v-slot:selection="{ attrs, item, select, selected }">
|
|
28
|
+
<v-chip
|
|
29
|
+
v-bind="attrs"
|
|
30
|
+
:input-value="selected"
|
|
31
|
+
close
|
|
32
|
+
@click:close="removeAlternateForm(item)"
|
|
33
|
+
>
|
|
34
|
+
<strong>{{ item }}</strong>
|
|
35
|
+
</v-chip>
|
|
36
|
+
</template>
|
|
37
|
+
</v-combobox>
|
|
26
38
|
<br />
|
|
27
39
|
<v-select
|
|
28
40
|
v-model="selectedTerm.related_term"
|
|
@@ -97,6 +109,13 @@ export default {
|
|
|
97
109
|
return true
|
|
98
110
|
}
|
|
99
111
|
},
|
|
112
|
+
removeAlternateForm(form) {
|
|
113
|
+
const index = this.selectedTerm.alternate_forms.indexOf(form)
|
|
114
|
+
if (index > -1) {
|
|
115
|
+
// only splice array when item is found
|
|
116
|
+
this.selectedTerm.alternate_forms.splice(index, 1) // 2nd parameter means remove one item only
|
|
117
|
+
}
|
|
118
|
+
},
|
|
100
119
|
},
|
|
101
120
|
}
|
|
102
121
|
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as _ from "lodash";
|
|
2
|
+
import GlossaryTerm from "~/helpers/GlossaryTerm";
|
|
3
|
+
|
|
4
|
+
export default class FillInBlankHelper {
|
|
5
|
+
|
|
6
|
+
private static FillBlankRegex = /<span.*?.class="windward-fill-blank".*?>(.*?)<\/span>/gi;
|
|
7
|
+
|
|
8
|
+
public static containsFillInBlank(content: string): boolean {
|
|
9
|
+
const regex = new RegExp(this.FillBlankRegex);
|
|
10
|
+
|
|
11
|
+
return regex.exec(content) !== null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public static makeToolTip(htmlString: string): string {
|
|
15
|
+
const parser = new DOMParser();
|
|
16
|
+
const doc = parser.parseFromString(htmlString, "text/html");
|
|
17
|
+
// doc.body.firstChild can be null
|
|
18
|
+
let answer = doc.body.firstChild ? doc.body.firstChild.textContent : "";
|
|
19
|
+
let feedback = "";
|
|
20
|
+
if (doc.body.getElementsByClassName("windward-fill-blank")[0]["dataset"]["feedback"] !== undefined) {
|
|
21
|
+
feedback = doc.body.getElementsByClassName("windward-fill-blank")[0]["dataset"]["feedback"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
"<plugin-core-fill-in-blank-input answer=\"" + answer + "\" description=\"" + feedback + "\">" +
|
|
26
|
+
"</template>" + "</plugin-core-fill-in-blank-input>");
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public escapeHtml(html) {
|
|
31
|
+
var text = document.createTextNode(html);
|
|
32
|
+
var p = document.createElement("p");
|
|
33
|
+
p.appendChild(text);
|
|
34
|
+
return p.innerHTML;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static renderFillInTHeBlankHtml(content: string, glossary: any) {
|
|
38
|
+
const regex = new RegExp(this.FillBlankRegex);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
let match;
|
|
42
|
+
while ((match = regex.exec(content)) !== null) {
|
|
43
|
+
// This is necessary to avoid infinite loops with zero-width matches
|
|
44
|
+
if (match.index === regex.lastIndex) {
|
|
45
|
+
regex.lastIndex++;
|
|
46
|
+
}
|
|
47
|
+
content = content.replace(
|
|
48
|
+
match[0],
|
|
49
|
+
this.makeToolTip(match[0])
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return content;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -38,13 +38,13 @@ export default class GlossaryHelper {
|
|
|
38
38
|
|
|
39
39
|
}
|
|
40
40
|
public static containsGlossaryTerms(content :string): boolean {
|
|
41
|
-
const regex = this.glossaryRegex
|
|
41
|
+
const regex = new RegExp(this.glossaryRegex)
|
|
42
42
|
|
|
43
43
|
return regex.exec(content) !== null
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
public static getContentVerifiedGlossaryTerms(content :string, glossary :any) {
|
|
47
|
-
const regex = this.glossaryRegex
|
|
47
|
+
const regex = new RegExp( this.glossaryRegex)
|
|
48
48
|
const currentGlossary = glossary
|
|
49
49
|
|
|
50
50
|
let match
|
|
@@ -74,7 +74,7 @@ export default class GlossaryHelper {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
public static getContentUnVerifiedGlossaryTerms(content :string, glossary :any) {
|
|
77
|
-
const regex = this.glossaryRegex
|
|
77
|
+
const regex = new RegExp( this.glossaryRegex)
|
|
78
78
|
|
|
79
79
|
let match
|
|
80
80
|
const verifiedTerms = this.getContentVerifiedGlossaryTerms(content,glossary)
|
|
@@ -110,7 +110,7 @@ export default class GlossaryHelper {
|
|
|
110
110
|
return unVerifiedTerms
|
|
111
111
|
}
|
|
112
112
|
public static renderGlossaryWordsHtml(content :string, glossary :any) {
|
|
113
|
-
const regex =
|
|
113
|
+
const regex = new RegExp( this.glossaryRegex)
|
|
114
114
|
const currentGlossary = glossary
|
|
115
115
|
|
|
116
116
|
let match
|