@windward/core 0.7.0 → 0.9.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/.eslintrc.js +5 -1
- package/.prettierrc +3 -2
- package/components/Content/Blocks/Accordion.vue +10 -2
- package/components/Content/Blocks/BlockQuote.vue +6 -2
- package/components/Content/Blocks/ClickableIcons.vue +12 -10
- package/components/Content/Blocks/Email.vue +7 -7
- package/components/Content/Blocks/GenerateAIQuestionButton.vue +85 -18
- package/components/Content/Blocks/HorizontalRule.vue +2 -0
- package/components/Content/Blocks/Image.vue +7 -182
- package/components/Content/Blocks/OpenResponse.vue +25 -0
- package/components/Content/Blocks/OpenResponseCollate.vue +13 -12
- package/components/Content/Blocks/ScenarioChoice.vue +10 -2
- package/components/Content/Blocks/Tab.vue +27 -3
- package/components/Content/Blocks/UserUpload.vue +5 -3
- package/components/Content/Blocks/Video.vue +33 -7
- package/components/Navigation/Items/GlossaryNav.vue +25 -10
- package/components/Settings/AccordionSettings.vue +20 -34
- package/components/Settings/BlockQuoteSettings.vue +17 -41
- package/components/Settings/ClickableIconsSettings.vue +18 -40
- package/components/Settings/EmailSettings.vue +12 -38
- package/components/Settings/FileDownloadSettings.vue +10 -35
- package/components/Settings/ImageSettings.vue +13 -247
- package/components/Settings/OpenResponseCollateSettings.vue +47 -55
- package/components/Settings/OpenResponseSettings.vue +62 -36
- package/components/Settings/ScenarioChoiceSettings.vue +13 -35
- package/components/Settings/TabSettings.vue +25 -34
- package/components/Settings/UserUploadSettings.vue +6 -30
- package/components/Settings/VideoSettings/SourcePicker.vue +1 -0
- package/components/Settings/VideoSettings.vue +6 -42
- package/components/utils/ContentViewer.vue +0 -3
- package/components/utils/FillInBlank/FillInBlankInput.vue +29 -47
- package/components/utils/TinyMCEWrapper.vue +42 -81
- package/components/utils/glossary/GlossaryToolTip.vue +6 -0
- package/helpers/GlossaryHelper.ts +12 -2
- package/helpers/tinymce/WindwardPlugins.ts +166 -118
- package/i18n/en-US/components/content/blocks/generate_questions.ts +3 -2
- package/i18n/en-US/components/settings/open_response_collate.ts +1 -1
- package/i18n/en-US/components/settings/scenario_choice.ts +3 -2
- package/i18n/en-US/components/settings/video.ts +1 -1
- package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
- package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/en-US/shared/settings.ts +1 -1
- package/i18n/es-ES/components/content/blocks/generate_questions.ts +2 -1
- package/i18n/es-ES/components/settings/open_response_collate.ts +1 -1
- package/i18n/es-ES/components/settings/scenario_choice.ts +3 -2
- package/i18n/es-ES/components/settings/video.ts +1 -1
- package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
- package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +3 -2
- package/i18n/es-ES/shared/settings.ts +1 -1
- package/i18n/sv-SE/components/content/blocks/generate_questions.ts +2 -1
- package/i18n/sv-SE/components/settings/open_response_collate.ts +1 -1
- package/i18n/sv-SE/components/settings/scenario_choice.ts +3 -2
- package/i18n/sv-SE/components/settings/video.ts +1 -1
- package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
- package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +2 -0
- package/package.json +3 -2
- package/pages/glossary.vue +1 -1
- package/stylelint.config.js +14 -0
- package/test/Components/Content/Blocks/OpenResponseCollate.spec.js +3 -3
- package/test/Components/Settings/TabSettings.spec.js +2 -2
- package/test/__mocks__/contentBlockMock.js +20 -0
- package/test/__mocks__/modelMock.js +1 -1
- package/test/helpers/GlossaryHelper.spec.js +22 -3
- package/test/mocks.js +8 -0
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<v-row class="pl-3 pr-3">
|
|
4
4
|
<v-text-field
|
|
5
|
+
id="block-settings-title"
|
|
5
6
|
v-model="block.metadata.config.title"
|
|
6
7
|
:autofocus="true"
|
|
7
|
-
:rules="
|
|
8
|
-
:counter="
|
|
8
|
+
:rules="$Validation.getRule('block.title')"
|
|
9
|
+
:counter="$Validation.getLimit('block.title')"
|
|
9
10
|
outlined
|
|
10
|
-
id="title"
|
|
11
11
|
:label="
|
|
12
12
|
$t('windward.core.components.settings.clickable_icon.title')
|
|
13
13
|
"
|
|
14
14
|
:disabled="render"
|
|
15
15
|
></v-text-field>
|
|
16
16
|
<v-textarea
|
|
17
|
+
id="block-settings-instructions"
|
|
17
18
|
v-model="block.metadata.config.instructions"
|
|
18
|
-
:rules="
|
|
19
|
-
:counter="
|
|
19
|
+
:rules="$Validation.getRule('block.instructions')"
|
|
20
|
+
:counter="$Validation.getLimit('block.instructions')"
|
|
20
21
|
outlined
|
|
21
22
|
:label="$t('components.content.settings.base.instructions')"
|
|
22
23
|
:disabled="render"
|
|
@@ -43,8 +44,8 @@
|
|
|
43
44
|
outlined
|
|
44
45
|
:autofocus="true"
|
|
45
46
|
v-model="block.metadata.config.items[index].tabHeader"
|
|
46
|
-
:
|
|
47
|
-
:
|
|
47
|
+
:rules="$Validation.getRule('shortInput')"
|
|
48
|
+
:counter="$Validation.getLimit('shortInput')"
|
|
48
49
|
:label="'item ' + (index + 1)"
|
|
49
50
|
:disabled="render"
|
|
50
51
|
></v-text-field>
|
|
@@ -73,6 +74,19 @@
|
|
|
73
74
|
:key="textEditorUpdateKey"
|
|
74
75
|
:disabled="render"
|
|
75
76
|
></TextEditor>
|
|
77
|
+
|
|
78
|
+
<v-card class="mt-2">
|
|
79
|
+
<v-card-text>
|
|
80
|
+
<ImageAssetSettings
|
|
81
|
+
v-model="
|
|
82
|
+
block.metadata.config.items[index]
|
|
83
|
+
.imageAsset
|
|
84
|
+
"
|
|
85
|
+
:assets.sync="block.assets"
|
|
86
|
+
>
|
|
87
|
+
</ImageAssetSettings>
|
|
88
|
+
</v-card-text>
|
|
89
|
+
</v-card>
|
|
76
90
|
</v-container>
|
|
77
91
|
</template>
|
|
78
92
|
</SortableExpansionPanel>
|
|
@@ -102,13 +116,14 @@
|
|
|
102
116
|
import _, { get } from 'lodash'
|
|
103
117
|
import Crypto from '~/helpers/Crypto'
|
|
104
118
|
import TextEditor from '~/components/Text/TextEditor'
|
|
119
|
+
import ImageAssetSettings from '~/components/Content/Settings/ImageAssetSettings.vue'
|
|
105
120
|
import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
|
|
106
121
|
import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
|
|
107
122
|
import Uuid from '~/helpers/Uuid'
|
|
108
123
|
|
|
109
124
|
export default {
|
|
110
125
|
name: 'TabSettings',
|
|
111
|
-
components: { TextEditor, SortableExpansionPanel },
|
|
126
|
+
components: { TextEditor, ImageAssetSettings, SortableExpansionPanel },
|
|
112
127
|
extends: BaseContentSettings,
|
|
113
128
|
beforeMount() {
|
|
114
129
|
if (_.isEmpty(this.block)) {
|
|
@@ -145,6 +160,7 @@ export default {
|
|
|
145
160
|
tabHeader: '',
|
|
146
161
|
expand: false,
|
|
147
162
|
content: '',
|
|
163
|
+
imageAsset: null,
|
|
148
164
|
}
|
|
149
165
|
this.block.metadata.config.items = []
|
|
150
166
|
this.block.metadata.config.items.push(defaultObject)
|
|
@@ -156,32 +172,6 @@ export default {
|
|
|
156
172
|
textEditorUpdateKey: Crypto.id(),
|
|
157
173
|
valid: true,
|
|
158
174
|
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
|
-
},
|
|
185
175
|
}
|
|
186
176
|
},
|
|
187
177
|
mounted() {
|
|
@@ -200,6 +190,7 @@ export default {
|
|
|
200
190
|
tabHeader: '',
|
|
201
191
|
expand: false,
|
|
202
192
|
content: '',
|
|
193
|
+
imageAsset: null,
|
|
203
194
|
}
|
|
204
195
|
this.block.metadata.config.items.push(defaultObject)
|
|
205
196
|
this.block.metadata.config.currentTab =
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<v-text-field
|
|
4
|
+
id="block-settings-title"
|
|
4
5
|
v-model="block.metadata.config.title"
|
|
5
6
|
outlined
|
|
6
|
-
:rules="
|
|
7
|
-
:counter="
|
|
7
|
+
:rules="$Validation.getRule('block.title')"
|
|
8
|
+
:counter="$Validation.getLimit('block.title')"
|
|
8
9
|
:autofocus="true"
|
|
9
10
|
:label="$t('components.content.settings.base.title')"
|
|
10
11
|
:disabled="render"
|
|
11
12
|
></v-text-field>
|
|
12
13
|
<v-textarea
|
|
14
|
+
id="block-settings-instructions"
|
|
13
15
|
v-model="block.metadata.config.instructions"
|
|
14
|
-
:rules="
|
|
15
|
-
:counter="
|
|
16
|
+
:rules="$Validation.getRule('block.instructions')"
|
|
17
|
+
:counter="$Validation.getLimit('block.instructions')"
|
|
16
18
|
outlined
|
|
17
19
|
:label="$t('components.content.settings.base.instructions')"
|
|
18
20
|
:disabled="render"
|
|
@@ -129,32 +131,6 @@ export default {
|
|
|
129
131
|
boilerplate: true,
|
|
130
132
|
elevation: 0,
|
|
131
133
|
},
|
|
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
|
-
},
|
|
158
134
|
}
|
|
159
135
|
},
|
|
160
136
|
mounted() {},
|
|
@@ -3,19 +3,21 @@
|
|
|
3
3
|
<v-row>
|
|
4
4
|
<v-col cols="12">
|
|
5
5
|
<v-text-field
|
|
6
|
+
id="block-settings-title"
|
|
6
7
|
v-model="block.metadata.config.title"
|
|
7
|
-
:
|
|
8
|
+
:rules="$Validation.getRule('block.title')"
|
|
9
|
+
:counter="$Validation.getLimit('block.title')"
|
|
8
10
|
outlined
|
|
9
|
-
:rules="validation.shortInputRules"
|
|
10
11
|
:label="$t('windward.core.components.settings.video.title')"
|
|
11
12
|
:disabled="render"
|
|
12
13
|
></v-text-field>
|
|
13
14
|
<v-textarea
|
|
15
|
+
id="block-settings-instructions"
|
|
14
16
|
v-model="block.metadata.config.description"
|
|
15
17
|
outlined
|
|
16
18
|
auto-grow
|
|
17
|
-
:rules="
|
|
18
|
-
:counter="
|
|
19
|
+
:rules="$Validation.getRule('block.instructions')"
|
|
20
|
+
:counter="$Validation.getLimit('block.instructions')"
|
|
19
21
|
:label="
|
|
20
22
|
$t(
|
|
21
23
|
'components.content.settings.base.description_optional'
|
|
@@ -426,44 +428,6 @@ export default {
|
|
|
426
428
|
},
|
|
427
429
|
},
|
|
428
430
|
},
|
|
429
|
-
validation: {
|
|
430
|
-
shortInputRules: [
|
|
431
|
-
(v) => {
|
|
432
|
-
if (v && v.length >= 50) {
|
|
433
|
-
return this.$t(
|
|
434
|
-
'windward.core.shared.settings.errors.input_limitations',
|
|
435
|
-
[50]
|
|
436
|
-
)
|
|
437
|
-
} else {
|
|
438
|
-
return true
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
],
|
|
442
|
-
instructionRule: [
|
|
443
|
-
(v) => {
|
|
444
|
-
if (v && v.length >= 255) {
|
|
445
|
-
return this.$t(
|
|
446
|
-
'windward.core.shared.settings.errors.input_limitations',
|
|
447
|
-
[255]
|
|
448
|
-
)
|
|
449
|
-
} else {
|
|
450
|
-
return true
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
],
|
|
454
|
-
clueRule: [
|
|
455
|
-
(v) => {
|
|
456
|
-
if (v && v.length >= 155) {
|
|
457
|
-
return this.$t(
|
|
458
|
-
'windward.core.shared.settings.errors.input_limitations',
|
|
459
|
-
[155]
|
|
460
|
-
)
|
|
461
|
-
} else {
|
|
462
|
-
return true
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
],
|
|
466
|
-
},
|
|
467
431
|
showPreRoll: false,
|
|
468
432
|
showPostRoll: false,
|
|
469
433
|
}
|
|
@@ -2,30 +2,24 @@
|
|
|
2
2
|
<span class="fib">
|
|
3
3
|
<v-dialog v-model="show" max-width="300">
|
|
4
4
|
<v-card>
|
|
5
|
-
<v-card-
|
|
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">
|
|
5
|
+
<v-card-text class="pt-6">
|
|
6
|
+
<div>
|
|
18
7
|
<p>
|
|
19
|
-
|
|
8
|
+
{{
|
|
9
|
+
$t(
|
|
10
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.user_input',
|
|
11
|
+
[userInput]
|
|
12
|
+
)
|
|
13
|
+
}}
|
|
14
|
+
</p>
|
|
15
|
+
<p class="pb-0 mb-0">
|
|
16
|
+
{{
|
|
17
|
+
$t(
|
|
18
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.correct_answer',
|
|
19
|
+
[answer]
|
|
20
|
+
)
|
|
21
|
+
}}
|
|
20
22
|
</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
23
|
</div>
|
|
30
24
|
</v-card-text>
|
|
31
25
|
<v-card-actions>
|
|
@@ -37,31 +31,14 @@
|
|
|
37
31
|
elevation="0"
|
|
38
32
|
outlined
|
|
39
33
|
@click="show = false"
|
|
40
|
-
>
|
|
41
|
-
{{
|
|
42
|
-
answerIsCorrect
|
|
43
|
-
? $t(
|
|
44
|
-
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.close'
|
|
45
|
-
)
|
|
46
|
-
: $t(
|
|
47
|
-
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.try_again'
|
|
48
|
-
)
|
|
49
|
-
}}
|
|
50
|
-
</v-btn>
|
|
51
|
-
<v-btn
|
|
52
|
-
color="primary"
|
|
53
|
-
outlined
|
|
54
|
-
elevation="0"
|
|
55
|
-
@click="displayAnswer"
|
|
56
|
-
v-if="!answerIsCorrect"
|
|
57
34
|
>
|
|
58
35
|
{{
|
|
59
36
|
$t(
|
|
60
|
-
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.
|
|
37
|
+
'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.close'
|
|
61
38
|
)
|
|
62
39
|
}}
|
|
63
|
-
</v-btn
|
|
64
|
-
>
|
|
40
|
+
</v-btn>
|
|
41
|
+
</v-row>
|
|
65
42
|
</v-container>
|
|
66
43
|
</v-card-actions>
|
|
67
44
|
</v-card>
|
|
@@ -142,8 +119,16 @@ export default {
|
|
|
142
119
|
computed: {
|
|
143
120
|
answerIsCorrect() {
|
|
144
121
|
if (
|
|
145
|
-
_.replace(
|
|
146
|
-
|
|
122
|
+
_.replace(
|
|
123
|
+
_.trim(_.toLower(this.answer)),
|
|
124
|
+
new RegExp(' ', 'g'),
|
|
125
|
+
''
|
|
126
|
+
) ===
|
|
127
|
+
_.replace(
|
|
128
|
+
_.trim(_.toLower(this.userInput)),
|
|
129
|
+
new RegExp(' ', 'g'),
|
|
130
|
+
''
|
|
131
|
+
)
|
|
147
132
|
) {
|
|
148
133
|
return true
|
|
149
134
|
}
|
|
@@ -158,9 +143,6 @@ export default {
|
|
|
158
143
|
}
|
|
159
144
|
return ''
|
|
160
145
|
},
|
|
161
|
-
computedDescription() {
|
|
162
|
-
return atob(this.description)
|
|
163
|
-
},
|
|
164
146
|
},
|
|
165
147
|
methods: {
|
|
166
148
|
setFocusAction() {
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
"
|
|
8
8
|
:data-cy="dataCy"
|
|
9
9
|
>
|
|
10
|
-
<
|
|
11
|
-
|
|
10
|
+
<slot name="label" :render="render">
|
|
11
|
+
<label v-if="label" class="editor-label">{{ label }}</label>
|
|
12
|
+
</slot>
|
|
12
13
|
<Editor
|
|
13
14
|
:id="id"
|
|
14
15
|
:key="seed + (isDarkTheme ? '-theme-dark' : '-theme-light')"
|
|
@@ -17,22 +18,18 @@
|
|
|
17
18
|
:init="config"
|
|
18
19
|
tag-name="div"
|
|
19
20
|
model-events="change keydown blur focus mouseDown paste input submit SetContent"
|
|
20
|
-
@onfocus="onEditorFocus"
|
|
21
|
-
v-click-outside="{
|
|
22
|
-
handler: onClickOutside,
|
|
23
|
-
closeConditional,
|
|
24
|
-
include,
|
|
25
|
-
}"
|
|
26
21
|
>
|
|
27
22
|
</Editor>
|
|
28
23
|
|
|
29
|
-
<
|
|
24
|
+
<slot name="hint" :render="render">
|
|
25
|
+
<label v-if="hint" class="editor-hint">{{ hint }}</label>
|
|
26
|
+
</slot>
|
|
30
27
|
</div>
|
|
31
28
|
|
|
32
29
|
<v-btn-toggle dense multiple class="pt-1 d-flex justify-end">
|
|
33
30
|
<slot name="actions-prepend" :render="render"></slot>
|
|
34
31
|
<slot name="actions" :render="render">
|
|
35
|
-
<v-btn-toggle
|
|
32
|
+
<v-btn-toggle v-if="allowRead" dense>
|
|
36
33
|
<v-btn v-if="render" color="primary" outlined @click="read">
|
|
37
34
|
<v-icon> mdi-play</v-icon>
|
|
38
35
|
</v-btn>
|
|
@@ -48,19 +45,6 @@
|
|
|
48
45
|
<v-icon> mdi-stop</v-icon>
|
|
49
46
|
</v-btn>
|
|
50
47
|
</v-btn-toggle>
|
|
51
|
-
|
|
52
|
-
<v-btn
|
|
53
|
-
v-if="render && !inline"
|
|
54
|
-
color="primary"
|
|
55
|
-
elevation="0"
|
|
56
|
-
outlined
|
|
57
|
-
@click="onClickOutside"
|
|
58
|
-
>{{
|
|
59
|
-
$t(
|
|
60
|
-
'windward.core.components.utils.tiny_mce_wrapper.minimize'
|
|
61
|
-
)
|
|
62
|
-
}}
|
|
63
|
-
</v-btn>
|
|
64
48
|
</slot>
|
|
65
49
|
<slot name="actions-append" :render="render"></slot>
|
|
66
50
|
</v-btn-toggle>
|
|
@@ -121,12 +105,14 @@ import 'tinymce/skins/ui/oxide-dark/content.js'
|
|
|
121
105
|
import 'tinymce/skins/content/default/content.js'
|
|
122
106
|
import 'tinymce/skins/content/dark/content.js'
|
|
123
107
|
|
|
108
|
+
import { Synthesizer } from 'speechreader'
|
|
109
|
+
import Crypto from '~/helpers/Crypto'
|
|
110
|
+
import MathHelper from '../../helpers/MathHelper'
|
|
124
111
|
import { WindwardPlugins } from '../../helpers/tinymce/WindwardPlugins'
|
|
112
|
+
|
|
125
113
|
import ContentCss from '!raw-loader!sass-loader!./assets/tinymce/content/global.scss'
|
|
126
114
|
import EditorCss from '!raw-loader!sass-loader!./assets/tinymce/ui/global.scss'
|
|
127
|
-
|
|
128
|
-
import MathHelper from '../../helpers/MathHelper'
|
|
129
|
-
import { Synthesizer } from 'speechreader'
|
|
115
|
+
|
|
130
116
|
export default {
|
|
131
117
|
name: 'ContentEditorRichText',
|
|
132
118
|
components: {
|
|
@@ -147,19 +133,12 @@ export default {
|
|
|
147
133
|
default:
|
|
148
134
|
'undo redo | styles | bold italic underline strikethrough removeformat | alignleft aligncenter alignright | table tablerowprops tablecellprops |bullist numlist outdent indent |glossaryButton fibFormatButton mathButton a11yButton',
|
|
149
135
|
},
|
|
150
|
-
|
|
136
|
+
rootBlock: { type: String, required: false, default: 'div' },
|
|
151
137
|
label: { type: String, required: false, default: '' },
|
|
152
138
|
hint: { type: String, required: false, default: '' },
|
|
153
139
|
inline: { type: Boolean, required: false, default: false },
|
|
154
140
|
allowRead: { type: Boolean, required: false, default: false },
|
|
155
141
|
},
|
|
156
|
-
beforeMount() {
|
|
157
|
-
if (MathHelper.containsLatex(this.value)) {
|
|
158
|
-
this.text = MathHelper.wrapMathContentForTinyMCE(this.value)
|
|
159
|
-
} else {
|
|
160
|
-
this.text = this.value
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
142
|
data() {
|
|
164
143
|
return {
|
|
165
144
|
render: false,
|
|
@@ -169,11 +148,7 @@ export default {
|
|
|
169
148
|
paused: false,
|
|
170
149
|
}
|
|
171
150
|
},
|
|
172
|
-
|
|
173
|
-
text: function (newVal) {
|
|
174
|
-
this.$emit('input', this.text)
|
|
175
|
-
},
|
|
176
|
-
},
|
|
151
|
+
|
|
177
152
|
computed: {
|
|
178
153
|
dataCy() {
|
|
179
154
|
return (
|
|
@@ -186,36 +161,12 @@ export default {
|
|
|
186
161
|
isDarkTheme() {
|
|
187
162
|
return this.$vuetify.theme.isDark
|
|
188
163
|
},
|
|
189
|
-
filteredMenubar() {
|
|
190
|
-
if (this.render) {
|
|
191
|
-
return this.menubar
|
|
192
|
-
} else {
|
|
193
|
-
return ''
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
filteredToolbar() {
|
|
197
|
-
if (this.render) {
|
|
198
|
-
return this.toolbar
|
|
199
|
-
} else {
|
|
200
|
-
return ''
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
filteredHeight() {
|
|
204
|
-
if (!this.render) {
|
|
205
|
-
return 100
|
|
206
|
-
} else if (this.height !== null) {
|
|
207
|
-
return this.height
|
|
208
|
-
} else {
|
|
209
|
-
return 500
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
164
|
config() {
|
|
213
165
|
return {
|
|
214
166
|
draggable_modal: true,
|
|
215
|
-
height: this.filteredHeight,
|
|
216
167
|
visual: false,
|
|
217
|
-
forced_root_block: this.
|
|
218
|
-
menubar: this.
|
|
168
|
+
forced_root_block: this.rootBlock,
|
|
169
|
+
menubar: this.menubar,
|
|
219
170
|
toolbar_mode: 'sliding',
|
|
220
171
|
browser_spellcheck: true,
|
|
221
172
|
contextmenu: false,
|
|
@@ -241,7 +192,11 @@ export default {
|
|
|
241
192
|
items: ' bold italic underline strikethrough superscript subscript codeformat | formats align | language | removeformat',
|
|
242
193
|
},
|
|
243
194
|
},
|
|
195
|
+
autoresize_min_height: 100,
|
|
196
|
+
autoresize_max_height: 1000,
|
|
197
|
+
autoresize_bottom_margin: 0,
|
|
244
198
|
plugins: [
|
|
199
|
+
'autoresize',
|
|
245
200
|
'advlist',
|
|
246
201
|
'autolink',
|
|
247
202
|
'lists',
|
|
@@ -257,8 +212,13 @@ export default {
|
|
|
257
212
|
'wordcount',
|
|
258
213
|
'table',
|
|
259
214
|
'WindwardToolKit',
|
|
215
|
+
'help',
|
|
260
216
|
],
|
|
261
|
-
|
|
217
|
+
help_accessibility: true,
|
|
218
|
+
iframe_aria_text: this.$t(
|
|
219
|
+
'windward.core.components.utils.tiny_mce_wrapper.aria_text'
|
|
220
|
+
),
|
|
221
|
+
toolbar: this.toolbar,
|
|
262
222
|
inline: this.inline,
|
|
263
223
|
table_advtab: false,
|
|
264
224
|
table_cell_advtab: false,
|
|
@@ -349,7 +309,6 @@ export default {
|
|
|
349
309
|
}
|
|
350
310
|
)
|
|
351
311
|
},
|
|
352
|
-
|
|
353
312
|
formats: {
|
|
354
313
|
glossary: {
|
|
355
314
|
inline: 'span',
|
|
@@ -477,6 +436,21 @@ export default {
|
|
|
477
436
|
return []
|
|
478
437
|
},
|
|
479
438
|
},
|
|
439
|
+
|
|
440
|
+
watch: {
|
|
441
|
+
text: function (_newVal) {
|
|
442
|
+
this.$emit('input', this.text)
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
|
|
446
|
+
beforeMount() {
|
|
447
|
+
if (MathHelper.containsLatex(this.value)) {
|
|
448
|
+
this.text = MathHelper.wrapMathContentForTinyMCE(this.value)
|
|
449
|
+
} else {
|
|
450
|
+
this.text = this.value
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
|
|
480
454
|
methods: {
|
|
481
455
|
read() {
|
|
482
456
|
if (this.paused) {
|
|
@@ -507,18 +481,6 @@ export default {
|
|
|
507
481
|
this.paused = false
|
|
508
482
|
}
|
|
509
483
|
},
|
|
510
|
-
onEditorFocus() {
|
|
511
|
-
if (!this.render) {
|
|
512
|
-
this.seed = Crypto.id()
|
|
513
|
-
this.render = true
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
onClickOutside() {
|
|
517
|
-
if (this.render) {
|
|
518
|
-
this.seed = Crypto.id()
|
|
519
|
-
this.render = false
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
484
|
include() {
|
|
523
485
|
// vuetify function to include an element with this class into clickable area without close
|
|
524
486
|
return this.elementBody
|
|
@@ -527,7 +489,7 @@ export default {
|
|
|
527
489
|
closeConditional(e) {
|
|
528
490
|
const targetClass = e.target.className
|
|
529
491
|
let parentNode
|
|
530
|
-
//check if target is svg element
|
|
492
|
+
// check if target is svg element
|
|
531
493
|
if (e.target.matches('svg') || e.target instanceof SVGElement) {
|
|
532
494
|
parentNode = e.target.parentNode.parentNode
|
|
533
495
|
} else {
|
|
@@ -543,7 +505,6 @@ export default {
|
|
|
543
505
|
) {
|
|
544
506
|
return false
|
|
545
507
|
} else {
|
|
546
|
-
this.onClickOutside()
|
|
547
508
|
return true
|
|
548
509
|
}
|
|
549
510
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="glossary-word"
|
|
4
|
+
:class="{ active: show }"
|
|
4
5
|
v-click-outside="onClickOutside"
|
|
5
6
|
@click="show = !show"
|
|
6
7
|
>
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
<div>
|
|
20
21
|
<div v-if="this.$slots['definition']">
|
|
21
22
|
<h6 class="text-capitalize">
|
|
23
|
+
<slot name="term"></slot>
|
|
22
24
|
{{
|
|
23
25
|
$t(
|
|
24
26
|
'windward.core.components.utils.tiny_mce_wrapper.definition'
|
|
@@ -32,6 +34,7 @@
|
|
|
32
34
|
</div>
|
|
33
35
|
<div v-if="this.$slots['alternate_forms']">
|
|
34
36
|
<h4 class="text-capitalize">
|
|
37
|
+
<slot name="term"></slot>
|
|
35
38
|
{{
|
|
36
39
|
$t(
|
|
37
40
|
'windward.core.components.utils.tiny_mce_wrapper.alternate_forms'
|
|
@@ -84,4 +87,7 @@ export default {
|
|
|
84
87
|
font-weight: bold;
|
|
85
88
|
color: var(--v-dark-text-base);
|
|
86
89
|
}
|
|
90
|
+
.active {
|
|
91
|
+
background: var(--v-secondary-base) !important;
|
|
92
|
+
}
|
|
87
93
|
</style>
|