@windward/core 0.8.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/ClickableIcons.vue +3 -9
- package/components/Content/Blocks/GenerateAIQuestionButton.vue +85 -18
- package/components/Content/Blocks/Image.vue +7 -182
- package/components/Content/Blocks/Tab.vue +10 -0
- package/components/Navigation/Items/GlossaryNav.vue +25 -10
- package/components/Settings/ImageSettings.vue +12 -240
- package/components/Settings/TabSettings.vue +17 -1
- package/components/utils/ContentViewer.vue +0 -3
- package/components/utils/FillInBlank/FillInBlankInput.vue +29 -47
- package/components/utils/TinyMCEWrapper.vue +36 -78
- package/components/utils/glossary/GlossaryToolTip.vue +6 -0
- package/helpers/tinymce/WindwardPlugins.ts +166 -118
- package/i18n/en-US/components/content/blocks/generate_questions.ts +3 -2
- 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/es-ES/components/content/blocks/generate_questions.ts +2 -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/sv-SE/components/content/blocks/generate_questions.ts +2 -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 +2 -1
- 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
|
@@ -1,176 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-container>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
v-model="block.metadata.config.asset"
|
|
6
|
-
class="mb-4"
|
|
7
|
-
:label="
|
|
8
|
-
$t(
|
|
9
|
-
'windward.core.components.settings.image.current_image_file'
|
|
10
|
-
) + ':'
|
|
11
|
-
"
|
|
12
|
-
:disabled="render"
|
|
3
|
+
<ImageAssetSettings
|
|
4
|
+
v-model="block.metadata.config"
|
|
13
5
|
:assets.sync="block.assets"
|
|
14
|
-
@click:file="onFileSelect"
|
|
15
6
|
>
|
|
16
|
-
|
|
17
|
-
{{ $t('windward.core.components.settings.image.place_image') }}
|
|
18
|
-
</template>
|
|
19
|
-
</ContentBlockAsset>
|
|
20
|
-
|
|
21
|
-
<v-switch
|
|
22
|
-
v-model="block.metadata.config.hideBackground"
|
|
23
|
-
:label="
|
|
24
|
-
$t('windward.core.components.settings.image.hide_background')
|
|
25
|
-
"
|
|
26
|
-
:disabled="render"
|
|
27
|
-
></v-switch>
|
|
28
|
-
<v-switch
|
|
29
|
-
v-model="block.metadata.config.modal"
|
|
30
|
-
:label="$t('windward.core.components.settings.image.modal')"
|
|
31
|
-
:disabled="render"
|
|
32
|
-
></v-switch>
|
|
33
|
-
<v-tooltip top color="primary">
|
|
34
|
-
<template #activator="{ on, attrs }">
|
|
35
|
-
<v-switch
|
|
36
|
-
v-model="block.metadata.config.decorative"
|
|
37
|
-
:disabled="render"
|
|
38
|
-
@change="onDecorativeToggled($event)"
|
|
39
|
-
>
|
|
40
|
-
<template #label>
|
|
41
|
-
<span v-bind="attrs" v-on="on">
|
|
42
|
-
{{
|
|
43
|
-
$t(
|
|
44
|
-
'windward.core.components.settings.image.decorative'
|
|
45
|
-
)
|
|
46
|
-
}}
|
|
47
|
-
<v-icon x-small class="help-offset-icon">
|
|
48
|
-
mdi-help
|
|
49
|
-
</v-icon>
|
|
50
|
-
</span>
|
|
51
|
-
</template>
|
|
52
|
-
</v-switch>
|
|
53
|
-
</template>
|
|
54
|
-
<span class="span-description">{{
|
|
55
|
-
$t(
|
|
56
|
-
'windward.core.components.settings.image.decorative_toggle_description'
|
|
57
|
-
)
|
|
58
|
-
}}</span>
|
|
59
|
-
</v-tooltip>
|
|
60
|
-
|
|
61
|
-
<v-form v-if="!block.metadata.config.decorative">
|
|
62
|
-
<v-tooltip top color="primary">
|
|
63
|
-
<template #activator="{ on, attrs }">
|
|
64
|
-
<v-switch
|
|
65
|
-
v-model="block.metadata.config.inherit"
|
|
66
|
-
:disabled="render"
|
|
67
|
-
>
|
|
68
|
-
<template #label>
|
|
69
|
-
<span v-bind="attrs" v-on="on">
|
|
70
|
-
{{
|
|
71
|
-
$t(
|
|
72
|
-
'windward.core.components.settings.image.inherit'
|
|
73
|
-
)
|
|
74
|
-
}}
|
|
75
|
-
<v-icon x-small class="help-offset-icon">
|
|
76
|
-
mdi-help
|
|
77
|
-
</v-icon>
|
|
78
|
-
</span>
|
|
79
|
-
</template>
|
|
80
|
-
</v-switch>
|
|
81
|
-
</template>
|
|
82
|
-
<span class="span-description">{{
|
|
83
|
-
$t(
|
|
84
|
-
'windward.core.components.settings.image.inherit_global_toggle_description'
|
|
85
|
-
)
|
|
86
|
-
}}</span>
|
|
87
|
-
</v-tooltip>
|
|
88
|
-
|
|
89
|
-
<v-alert
|
|
90
|
-
v-if="block.metadata.config.inherit && !assetAltText"
|
|
91
|
-
type="warning"
|
|
92
|
-
>
|
|
93
|
-
{{
|
|
94
|
-
$t('windward.core.components.settings.image.inherit_no_alt')
|
|
95
|
-
}}
|
|
96
|
-
</v-alert>
|
|
97
|
-
|
|
98
|
-
<v-text-field
|
|
99
|
-
v-if="block.metadata.config.inherit && assetAltText"
|
|
100
|
-
:value="assetAltText"
|
|
101
|
-
:label="
|
|
102
|
-
$t('windward.core.components.navigation.image.default_alt')
|
|
103
|
-
"
|
|
104
|
-
outlined
|
|
105
|
-
counter
|
|
106
|
-
maxlength="125"
|
|
107
|
-
:rules="$Validation.getRule('exists')"
|
|
108
|
-
disabled
|
|
109
|
-
>
|
|
110
|
-
</v-text-field>
|
|
111
|
-
|
|
112
|
-
<v-text-field
|
|
113
|
-
v-if="!block.metadata.config.inherit"
|
|
114
|
-
v-model="block.metadata.config.alt"
|
|
115
|
-
outlined
|
|
116
|
-
counter
|
|
117
|
-
maxlength="125"
|
|
118
|
-
:label="
|
|
119
|
-
$t('windward.core.components.navigation.image.default_alt')
|
|
120
|
-
"
|
|
121
|
-
:rules="$Validation.getRule('exists')"
|
|
122
|
-
:disabled="render"
|
|
123
|
-
>
|
|
124
|
-
<template #append>
|
|
125
|
-
<v-tooltip top color="primary">
|
|
126
|
-
<template #activator="{ on }">
|
|
127
|
-
<v-icon v-on="on" small>mdi-help</v-icon>
|
|
128
|
-
</template>
|
|
129
|
-
<span class="span-description">{{
|
|
130
|
-
$t(
|
|
131
|
-
'windward.core.components.settings.image.alt_description'
|
|
132
|
-
)
|
|
133
|
-
}}</span>
|
|
134
|
-
</v-tooltip>
|
|
135
|
-
</template>
|
|
136
|
-
</v-text-field>
|
|
137
|
-
<h5 class="pb-2">
|
|
138
|
-
{{ $t('windward.core.components.settings.image.screenreader') }}
|
|
139
|
-
<v-tooltip top color="primary">
|
|
140
|
-
<template #activator="{ on }">
|
|
141
|
-
<v-icon v-on="on" small class="help-offset-icon">
|
|
142
|
-
mdi-help
|
|
143
|
-
</v-icon>
|
|
144
|
-
</template>
|
|
145
|
-
<span class="span-description">{{
|
|
146
|
-
$t(
|
|
147
|
-
'windward.core.components.settings.image.screenreader_description'
|
|
148
|
-
)
|
|
149
|
-
}}</span>
|
|
150
|
-
</v-tooltip>
|
|
151
|
-
</h5>
|
|
152
|
-
<TextEditor
|
|
153
|
-
v-if="!block.metadata.config.inherit"
|
|
154
|
-
v-model="block.metadata.config.ariaDescribedBy"
|
|
155
|
-
menubar="bullist numlist"
|
|
156
|
-
:disabled="render"
|
|
157
|
-
></TextEditor>
|
|
158
|
-
|
|
159
|
-
<div v-if="block.metadata.config.inherit">
|
|
160
|
-
<v-card v-if="assetDescribedByText">
|
|
161
|
-
<v-card-text>
|
|
162
|
-
<TextViewer v-model="assetDescribedByText"></TextViewer>
|
|
163
|
-
</v-card-text>
|
|
164
|
-
</v-card>
|
|
165
|
-
<v-alert v-if="!assetDescribedByText" type="warning">
|
|
166
|
-
{{
|
|
167
|
-
$t(
|
|
168
|
-
'windward.core.components.settings.image.inherit_no_aria'
|
|
169
|
-
)
|
|
170
|
-
}}
|
|
171
|
-
</v-alert>
|
|
172
|
-
</div>
|
|
173
|
-
</v-form>
|
|
7
|
+
</ImageAssetSettings>
|
|
174
8
|
</v-container>
|
|
175
9
|
</template>
|
|
176
10
|
|
|
@@ -180,35 +14,22 @@ import TextEditor from '~/components/Text/TextEditor'
|
|
|
180
14
|
import TextViewer from '~/components/Text/TextViewer'
|
|
181
15
|
import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
|
|
182
16
|
import ContentBlockAsset from '~/components/Content/ContentBlockAsset.vue'
|
|
17
|
+
import ImageAssetSettings from '~/components/Content/Settings/ImageAssetSettings.vue'
|
|
183
18
|
|
|
184
19
|
export default {
|
|
185
20
|
name: 'ImageSettings',
|
|
186
21
|
extends: BaseContentSettings,
|
|
187
|
-
components: {
|
|
22
|
+
components: {
|
|
23
|
+
ImageAssetSettings,
|
|
24
|
+
ContentBlockAsset,
|
|
25
|
+
TextEditor,
|
|
26
|
+
TextViewer,
|
|
27
|
+
},
|
|
188
28
|
props: {
|
|
189
29
|
settings: { type: Object, required: false, default: null },
|
|
190
30
|
context: { type: String, required: false, default: 'block' },
|
|
191
31
|
},
|
|
192
|
-
computed: {
|
|
193
|
-
assetAltText() {
|
|
194
|
-
// Get the block aria info and fallback to the asset metadata
|
|
195
|
-
return _.get(this.fileAsset, 'metadata.props.alt', null)
|
|
196
|
-
},
|
|
197
|
-
assetDescribedByText() {
|
|
198
|
-
// Get the block aria info and fallback to the asset metadata
|
|
199
|
-
return _.get(
|
|
200
|
-
this.fileAsset,
|
|
201
|
-
'metadata.props.aria_describedby',
|
|
202
|
-
null
|
|
203
|
-
)
|
|
204
|
-
},
|
|
205
|
-
fileAsset() {
|
|
206
|
-
return _.get(this.block, 'assets[0].asset', null)
|
|
207
|
-
},
|
|
208
|
-
fileAssetMap() {
|
|
209
|
-
return _.get(this.block, 'metadata.config.asset', null)
|
|
210
|
-
},
|
|
211
|
-
},
|
|
32
|
+
computed: {},
|
|
212
33
|
beforeMount() {
|
|
213
34
|
if (_.isEmpty(this.block)) {
|
|
214
35
|
this.block = {}
|
|
@@ -249,55 +70,6 @@ export default {
|
|
|
249
70
|
},
|
|
250
71
|
watch: {},
|
|
251
72
|
mounted() {},
|
|
252
|
-
methods: {
|
|
253
|
-
onDecorativeToggled(evt) {
|
|
254
|
-
if (evt) {
|
|
255
|
-
this.block.metadata.config.ariaDescribedBy = ''
|
|
256
|
-
this.block.metadata.config.alt = ''
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
onFileSelect(file) {
|
|
260
|
-
// Clear out the body since we're defining a proper file link now
|
|
261
|
-
this.block.body = ''
|
|
262
|
-
|
|
263
|
-
// file = null when you remove a file
|
|
264
|
-
if (_.isEmpty(file)) {
|
|
265
|
-
this.block.assets = []
|
|
266
|
-
} else {
|
|
267
|
-
this.block.assets = [file]
|
|
268
|
-
|
|
269
|
-
//Assign height and width for skeleton loader
|
|
270
|
-
if (!_.isEmpty(file.asset.metadata.props)) {
|
|
271
|
-
this.block.metadata.config.height =
|
|
272
|
-
file.asset.metadata.props['height']
|
|
273
|
-
this.block.metadata.config.width =
|
|
274
|
-
file.asset.metadata.props['width']
|
|
275
|
-
}
|
|
276
|
-
// Assign any alt text from the filemanager file
|
|
277
|
-
this.block.metadata.config.alt = _.get(
|
|
278
|
-
file,
|
|
279
|
-
'asset.metadata.props.alt',
|
|
280
|
-
''
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
this.block.metadata.config.ariaDescribedBy = _.get(
|
|
284
|
-
file,
|
|
285
|
-
'asset.metadata.props.aria_describedby',
|
|
286
|
-
''
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
},
|
|
73
|
+
methods: {},
|
|
291
74
|
}
|
|
292
75
|
</script>
|
|
293
|
-
<style>
|
|
294
|
-
.span-description {
|
|
295
|
-
display: flex;
|
|
296
|
-
justify-content: center;
|
|
297
|
-
width: 200px;
|
|
298
|
-
}
|
|
299
|
-
.help-offset-icon {
|
|
300
|
-
position: relative;
|
|
301
|
-
top: -8px;
|
|
302
|
-
}
|
|
303
|
-
</style>
|
|
@@ -74,6 +74,19 @@
|
|
|
74
74
|
:key="textEditorUpdateKey"
|
|
75
75
|
:disabled="render"
|
|
76
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>
|
|
77
90
|
</v-container>
|
|
78
91
|
</template>
|
|
79
92
|
</SortableExpansionPanel>
|
|
@@ -103,13 +116,14 @@
|
|
|
103
116
|
import _, { get } from 'lodash'
|
|
104
117
|
import Crypto from '~/helpers/Crypto'
|
|
105
118
|
import TextEditor from '~/components/Text/TextEditor'
|
|
119
|
+
import ImageAssetSettings from '~/components/Content/Settings/ImageAssetSettings.vue'
|
|
106
120
|
import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
|
|
107
121
|
import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
|
|
108
122
|
import Uuid from '~/helpers/Uuid'
|
|
109
123
|
|
|
110
124
|
export default {
|
|
111
125
|
name: 'TabSettings',
|
|
112
|
-
components: { TextEditor, SortableExpansionPanel },
|
|
126
|
+
components: { TextEditor, ImageAssetSettings, SortableExpansionPanel },
|
|
113
127
|
extends: BaseContentSettings,
|
|
114
128
|
beforeMount() {
|
|
115
129
|
if (_.isEmpty(this.block)) {
|
|
@@ -146,6 +160,7 @@ export default {
|
|
|
146
160
|
tabHeader: '',
|
|
147
161
|
expand: false,
|
|
148
162
|
content: '',
|
|
163
|
+
imageAsset: null,
|
|
149
164
|
}
|
|
150
165
|
this.block.metadata.config.items = []
|
|
151
166
|
this.block.metadata.config.items.push(defaultObject)
|
|
@@ -175,6 +190,7 @@ export default {
|
|
|
175
190
|
tabHeader: '',
|
|
176
191
|
expand: false,
|
|
177
192
|
content: '',
|
|
193
|
+
imageAsset: null,
|
|
178
194
|
}
|
|
179
195
|
this.block.metadata.config.items.push(defaultObject)
|
|
180
196
|
this.block.metadata.config.currentTab =
|
|
@@ -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() {
|
|
@@ -18,12 +18,6 @@
|
|
|
18
18
|
:init="config"
|
|
19
19
|
tag-name="div"
|
|
20
20
|
model-events="change keydown blur focus mouseDown paste input submit SetContent"
|
|
21
|
-
@onfocus="onEditorFocus"
|
|
22
|
-
v-click-outside="{
|
|
23
|
-
handler: onClickOutside,
|
|
24
|
-
closeConditional,
|
|
25
|
-
include,
|
|
26
|
-
}"
|
|
27
21
|
>
|
|
28
22
|
</Editor>
|
|
29
23
|
|
|
@@ -35,7 +29,7 @@
|
|
|
35
29
|
<v-btn-toggle dense multiple class="pt-1 d-flex justify-end">
|
|
36
30
|
<slot name="actions-prepend" :render="render"></slot>
|
|
37
31
|
<slot name="actions" :render="render">
|
|
38
|
-
<v-btn-toggle
|
|
32
|
+
<v-btn-toggle v-if="allowRead" dense>
|
|
39
33
|
<v-btn v-if="render" color="primary" outlined @click="read">
|
|
40
34
|
<v-icon> mdi-play</v-icon>
|
|
41
35
|
</v-btn>
|
|
@@ -51,19 +45,6 @@
|
|
|
51
45
|
<v-icon> mdi-stop</v-icon>
|
|
52
46
|
</v-btn>
|
|
53
47
|
</v-btn-toggle>
|
|
54
|
-
|
|
55
|
-
<v-btn
|
|
56
|
-
v-if="render && !inline"
|
|
57
|
-
color="primary"
|
|
58
|
-
elevation="0"
|
|
59
|
-
outlined
|
|
60
|
-
@click="onClickOutside"
|
|
61
|
-
>{{
|
|
62
|
-
$t(
|
|
63
|
-
'windward.core.components.utils.tiny_mce_wrapper.minimize'
|
|
64
|
-
)
|
|
65
|
-
}}
|
|
66
|
-
</v-btn>
|
|
67
48
|
</slot>
|
|
68
49
|
<slot name="actions-append" :render="render"></slot>
|
|
69
50
|
</v-btn-toggle>
|
|
@@ -124,12 +105,14 @@ import 'tinymce/skins/ui/oxide-dark/content.js'
|
|
|
124
105
|
import 'tinymce/skins/content/default/content.js'
|
|
125
106
|
import 'tinymce/skins/content/dark/content.js'
|
|
126
107
|
|
|
108
|
+
import { Synthesizer } from 'speechreader'
|
|
109
|
+
import Crypto from '~/helpers/Crypto'
|
|
110
|
+
import MathHelper from '../../helpers/MathHelper'
|
|
127
111
|
import { WindwardPlugins } from '../../helpers/tinymce/WindwardPlugins'
|
|
112
|
+
|
|
128
113
|
import ContentCss from '!raw-loader!sass-loader!./assets/tinymce/content/global.scss'
|
|
129
114
|
import EditorCss from '!raw-loader!sass-loader!./assets/tinymce/ui/global.scss'
|
|
130
|
-
|
|
131
|
-
import MathHelper from '../../helpers/MathHelper'
|
|
132
|
-
import { Synthesizer } from 'speechreader'
|
|
115
|
+
|
|
133
116
|
export default {
|
|
134
117
|
name: 'ContentEditorRichText',
|
|
135
118
|
components: {
|
|
@@ -150,19 +133,12 @@ export default {
|
|
|
150
133
|
default:
|
|
151
134
|
'undo redo | styles | bold italic underline strikethrough removeformat | alignleft aligncenter alignright | table tablerowprops tablecellprops |bullist numlist outdent indent |glossaryButton fibFormatButton mathButton a11yButton',
|
|
152
135
|
},
|
|
153
|
-
|
|
136
|
+
rootBlock: { type: String, required: false, default: 'div' },
|
|
154
137
|
label: { type: String, required: false, default: '' },
|
|
155
138
|
hint: { type: String, required: false, default: '' },
|
|
156
139
|
inline: { type: Boolean, required: false, default: false },
|
|
157
140
|
allowRead: { type: Boolean, required: false, default: false },
|
|
158
141
|
},
|
|
159
|
-
beforeMount() {
|
|
160
|
-
if (MathHelper.containsLatex(this.value)) {
|
|
161
|
-
this.text = MathHelper.wrapMathContentForTinyMCE(this.value)
|
|
162
|
-
} else {
|
|
163
|
-
this.text = this.value
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
142
|
data() {
|
|
167
143
|
return {
|
|
168
144
|
render: false,
|
|
@@ -172,11 +148,7 @@ export default {
|
|
|
172
148
|
paused: false,
|
|
173
149
|
}
|
|
174
150
|
},
|
|
175
|
-
|
|
176
|
-
text: function (newVal) {
|
|
177
|
-
this.$emit('input', this.text)
|
|
178
|
-
},
|
|
179
|
-
},
|
|
151
|
+
|
|
180
152
|
computed: {
|
|
181
153
|
dataCy() {
|
|
182
154
|
return (
|
|
@@ -189,36 +161,12 @@ export default {
|
|
|
189
161
|
isDarkTheme() {
|
|
190
162
|
return this.$vuetify.theme.isDark
|
|
191
163
|
},
|
|
192
|
-
filteredMenubar() {
|
|
193
|
-
if (this.render) {
|
|
194
|
-
return this.menubar
|
|
195
|
-
} else {
|
|
196
|
-
return ''
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
filteredToolbar() {
|
|
200
|
-
if (this.render) {
|
|
201
|
-
return this.toolbar
|
|
202
|
-
} else {
|
|
203
|
-
return ''
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
filteredHeight() {
|
|
207
|
-
if (!this.render) {
|
|
208
|
-
return 100
|
|
209
|
-
} else if (this.height !== null) {
|
|
210
|
-
return this.height
|
|
211
|
-
} else {
|
|
212
|
-
return 500
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
164
|
config() {
|
|
216
165
|
return {
|
|
217
166
|
draggable_modal: true,
|
|
218
|
-
height: this.filteredHeight,
|
|
219
167
|
visual: false,
|
|
220
|
-
forced_root_block: this.
|
|
221
|
-
menubar: this.
|
|
168
|
+
forced_root_block: this.rootBlock,
|
|
169
|
+
menubar: this.menubar,
|
|
222
170
|
toolbar_mode: 'sliding',
|
|
223
171
|
browser_spellcheck: true,
|
|
224
172
|
contextmenu: false,
|
|
@@ -244,7 +192,11 @@ export default {
|
|
|
244
192
|
items: ' bold italic underline strikethrough superscript subscript codeformat | formats align | language | removeformat',
|
|
245
193
|
},
|
|
246
194
|
},
|
|
195
|
+
autoresize_min_height: 100,
|
|
196
|
+
autoresize_max_height: 1000,
|
|
197
|
+
autoresize_bottom_margin: 0,
|
|
247
198
|
plugins: [
|
|
199
|
+
'autoresize',
|
|
248
200
|
'advlist',
|
|
249
201
|
'autolink',
|
|
250
202
|
'lists',
|
|
@@ -260,8 +212,13 @@ export default {
|
|
|
260
212
|
'wordcount',
|
|
261
213
|
'table',
|
|
262
214
|
'WindwardToolKit',
|
|
215
|
+
'help',
|
|
263
216
|
],
|
|
264
|
-
|
|
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,
|
|
265
222
|
inline: this.inline,
|
|
266
223
|
table_advtab: false,
|
|
267
224
|
table_cell_advtab: false,
|
|
@@ -352,7 +309,6 @@ export default {
|
|
|
352
309
|
}
|
|
353
310
|
)
|
|
354
311
|
},
|
|
355
|
-
|
|
356
312
|
formats: {
|
|
357
313
|
glossary: {
|
|
358
314
|
inline: 'span',
|
|
@@ -480,6 +436,21 @@ export default {
|
|
|
480
436
|
return []
|
|
481
437
|
},
|
|
482
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
|
+
|
|
483
454
|
methods: {
|
|
484
455
|
read() {
|
|
485
456
|
if (this.paused) {
|
|
@@ -510,18 +481,6 @@ export default {
|
|
|
510
481
|
this.paused = false
|
|
511
482
|
}
|
|
512
483
|
},
|
|
513
|
-
onEditorFocus() {
|
|
514
|
-
if (!this.render) {
|
|
515
|
-
this.seed = Crypto.id()
|
|
516
|
-
this.render = true
|
|
517
|
-
}
|
|
518
|
-
},
|
|
519
|
-
onClickOutside() {
|
|
520
|
-
if (this.render) {
|
|
521
|
-
this.seed = Crypto.id()
|
|
522
|
-
this.render = false
|
|
523
|
-
}
|
|
524
|
-
},
|
|
525
484
|
include() {
|
|
526
485
|
// vuetify function to include an element with this class into clickable area without close
|
|
527
486
|
return this.elementBody
|
|
@@ -530,7 +489,7 @@ export default {
|
|
|
530
489
|
closeConditional(e) {
|
|
531
490
|
const targetClass = e.target.className
|
|
532
491
|
let parentNode
|
|
533
|
-
//check if target is svg element
|
|
492
|
+
// check if target is svg element
|
|
534
493
|
if (e.target.matches('svg') || e.target instanceof SVGElement) {
|
|
535
494
|
parentNode = e.target.parentNode.parentNode
|
|
536
495
|
} else {
|
|
@@ -546,7 +505,6 @@ export default {
|
|
|
546
505
|
) {
|
|
547
506
|
return false
|
|
548
507
|
} else {
|
|
549
|
-
this.onClickOutside()
|
|
550
508
|
return true
|
|
551
509
|
}
|
|
552
510
|
},
|