@windward/core 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +2 -1
  2. package/components/Content/Blocks/ClickableIcons.vue +10 -1
  3. package/components/Content/Blocks/Feedback.vue +12 -4
  4. package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionOpenResponse.vue +10 -9
  5. package/components/Content/Blocks/Image.vue +1 -6
  6. package/components/Content/Blocks/OpenResponse.vue +137 -0
  7. package/components/Content/Blocks/OpenResponseCollate.vue +158 -0
  8. package/components/Navigation/Items/AskTheExpert.vue +173 -0
  9. package/components/Settings/ClickableIconsSettings.vue +10 -5
  10. package/components/Settings/OpenResponseCollateSettings.vue +170 -0
  11. package/components/Settings/OpenResponseSettings.vue +81 -0
  12. package/components/utils/ContentViewer.vue +15 -4
  13. package/components/utils/FillInBlank/FillInBlankInput.vue +208 -0
  14. package/components/utils/FillInBlank/FillInTheBlanksManager.vue +98 -0
  15. package/components/utils/MathExpressionEditor.vue +8 -6
  16. package/components/utils/TinyMCEWrapper.vue +59 -9
  17. package/components/utils/assets/tinymce/css/content.scss +9 -0
  18. package/components/utils/glossary/CourseGlossary.vue +12 -8
  19. package/components/utils/glossary/CourseGlossaryForm.vue +24 -5
  20. package/helpers/FillInBlankHelper.ts +55 -0
  21. package/helpers/GlossaryHelper.ts +4 -4
  22. package/helpers/tinymce/plugin.ts +99 -4
  23. package/i18n/en-US/components/content/blocks/feedback.ts +3 -0
  24. package/i18n/en-US/components/content/blocks/index.ts +4 -0
  25. package/i18n/en-US/components/content/blocks/open_response.ts +5 -0
  26. package/i18n/en-US/components/content/blocks/open_response_collate.ts +6 -0
  27. package/i18n/en-US/components/index.ts +0 -1
  28. package/i18n/en-US/components/navigation/ask_the_expert.ts +11 -0
  29. package/i18n/en-US/components/navigation/index.ts +2 -0
  30. package/i18n/en-US/components/settings/index.ts +5 -1
  31. package/i18n/en-US/components/settings/open_response.ts +5 -0
  32. package/i18n/en-US/components/settings/open_response_collate.ts +6 -0
  33. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  34. package/i18n/en-US/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  35. package/i18n/en-US/components/utils/FillInBlank/index.ts +6 -0
  36. package/i18n/en-US/components/utils/index.ts +2 -1
  37. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  38. package/i18n/en-US/shared/content_blocks.ts +2 -0
  39. package/i18n/en-US/shared/menu.ts +1 -0
  40. package/i18n/en-US/shared/settings.ts +3 -1
  41. package/i18n/es-ES/components/content/blocks/feedback.ts +29 -0
  42. package/i18n/es-ES/components/content/blocks/image.ts +5 -0
  43. package/i18n/es-ES/components/content/blocks/index.ts +19 -0
  44. package/i18n/es-ES/components/content/blocks/open_response.ts +6 -0
  45. package/i18n/es-ES/components/content/blocks/open_response_collate.ts +6 -0
  46. package/i18n/es-ES/components/content/blocks/tab.ts +4 -0
  47. package/i18n/es-ES/components/content/blocks/table.ts +4 -0
  48. package/i18n/es-ES/components/content/blocks/user_upload.ts +13 -0
  49. package/i18n/es-ES/components/content/blocks/video.ts +55 -0
  50. package/i18n/es-ES/components/content/index.ts +5 -0
  51. package/i18n/es-ES/components/index.ts +12 -0
  52. package/i18n/es-ES/components/navigation/ask_the_expert.ts +11 -0
  53. package/i18n/es-ES/components/navigation/image.ts +4 -0
  54. package/i18n/es-ES/components/navigation/index.ts +7 -0
  55. package/i18n/es-ES/components/navigation/user_upload.ts +3 -0
  56. package/i18n/es-ES/components/settings/clickable_icon.ts +10 -0
  57. package/i18n/es-ES/components/settings/image.ts +1 -0
  58. package/i18n/es-ES/components/settings/index.ts +17 -0
  59. package/i18n/es-ES/components/settings/open_response.ts +5 -0
  60. package/i18n/es-ES/components/settings/open_response_collate.ts +7 -0
  61. package/i18n/es-ES/components/settings/text_editor.ts +7 -0
  62. package/i18n/es-ES/components/settings/user_upload.ts +11 -0
  63. package/i18n/es-ES/components/settings/video.ts +13 -0
  64. package/i18n/es-ES/components/utils/index.ts +5 -0
  65. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +18 -0
  66. package/i18n/es-ES/index.ts +16 -0
  67. package/i18n/es-ES/modules/index.ts +5 -0
  68. package/i18n/es-ES/pages/glossary.ts +7 -0
  69. package/i18n/es-ES/pages/index.ts +7 -0
  70. package/i18n/es-ES/pages/user_upload.ts +3 -0
  71. package/i18n/es-ES/shared/content_blocks.ts +22 -0
  72. package/i18n/es-ES/shared/index.ts +11 -0
  73. package/i18n/es-ES/shared/menu.ts +3 -0
  74. package/i18n/es-ES/shared/permission.ts +15 -0
  75. package/i18n/es-ES/shared/settings.ts +19 -0
  76. package/i18n/sv-SE/components/content/blocks/feedback.ts +29 -0
  77. package/i18n/sv-SE/components/content/blocks/image.ts +5 -0
  78. package/i18n/sv-SE/components/content/blocks/index.ts +19 -0
  79. package/i18n/sv-SE/components/content/blocks/open_response.ts +6 -0
  80. package/i18n/sv-SE/components/content/blocks/open_response_collate.ts +6 -0
  81. package/i18n/sv-SE/components/content/blocks/tab.ts +4 -0
  82. package/i18n/sv-SE/components/content/blocks/table.ts +4 -0
  83. package/i18n/sv-SE/components/content/blocks/user_upload.ts +13 -0
  84. package/i18n/sv-SE/components/content/blocks/video.ts +53 -0
  85. package/i18n/sv-SE/components/content/index.ts +5 -0
  86. package/i18n/sv-SE/components/index.ts +12 -0
  87. package/i18n/sv-SE/components/navigation/ask_the_expert.ts +11 -0
  88. package/i18n/sv-SE/components/navigation/image.ts +4 -0
  89. package/i18n/sv-SE/components/navigation/index.ts +7 -0
  90. package/i18n/sv-SE/components/navigation/user_upload.ts +3 -0
  91. package/i18n/sv-SE/components/settings/clickable_icon.ts +10 -0
  92. package/i18n/sv-SE/components/settings/image.ts +1 -0
  93. package/i18n/sv-SE/components/settings/index.ts +17 -0
  94. package/i18n/sv-SE/components/settings/open_response.ts +5 -0
  95. package/i18n/sv-SE/components/settings/open_response_collate.ts +6 -0
  96. package/i18n/sv-SE/components/settings/text_editor.ts +7 -0
  97. package/i18n/sv-SE/components/settings/user_upload.ts +11 -0
  98. package/i18n/sv-SE/components/settings/video.ts +13 -0
  99. package/i18n/sv-SE/components/utils/index.ts +5 -0
  100. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +18 -0
  101. package/i18n/sv-SE/index.ts +16 -0
  102. package/i18n/sv-SE/modules/index.ts +5 -0
  103. package/i18n/sv-SE/pages/glossary.ts +7 -0
  104. package/i18n/sv-SE/pages/index.ts +7 -0
  105. package/i18n/sv-SE/pages/user_upload.ts +3 -0
  106. package/i18n/sv-SE/shared/content_blocks.ts +22 -0
  107. package/i18n/sv-SE/shared/index.ts +11 -0
  108. package/i18n/sv-SE/shared/menu.ts +3 -0
  109. package/i18n/sv-SE/shared/permission.ts +15 -0
  110. package/i18n/sv-SE/shared/settings.ts +17 -0
  111. package/package.json +1 -1
  112. package/plugin.js +68 -0
  113. package/test/Components/Content/Blocks/OpenResponse.spec.js +31 -0
  114. package/test/Components/Content/Blocks/OpenResponseCollate.spec.js +36 -0
  115. package/test/Components/Settings/OpenResponseCollateSettings.spec.js +20 -0
  116. package/test/Components/Settings/OpenResponseSettings.spec.js +20 -0
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <v-container>
3
+ <v-form>
4
+ <p>
5
+ {{
6
+ $t(
7
+ 'windward.core.components.settings.open_response_collate.instructions'
8
+ )
9
+ }}
10
+ </p>
11
+ <v-switch
12
+ v-model="block.metadata.config.include_prompts"
13
+ :label="
14
+ $t(
15
+ 'windward.core.components.settings.open_response_collate.include_prompts'
16
+ )
17
+ "
18
+ ></v-switch>
19
+ <v-text-field
20
+ v-model="block.metadata.config.filename"
21
+ :label="
22
+ $t(
23
+ 'windward.core.components.settings.open_response_collate.filename'
24
+ )
25
+ "
26
+ ></v-text-field>
27
+ <v-list>
28
+ <v-list-item-group
29
+ v-model="linked"
30
+ multiple
31
+ color="primary"
32
+ @change="onLinkedChange"
33
+ >
34
+ <draggable
35
+ v-bind="dragOptions"
36
+ :list="contentBlocks"
37
+ @change="onDragChange"
38
+ >
39
+ <v-list-item
40
+ v-for="contentBlock in contentBlocks"
41
+ :key="contentBlock.id"
42
+ :value="contentBlock.id"
43
+ >
44
+ <template #default="{ active }">
45
+ <v-list-item-icon>
46
+ <v-icon>mdi-drag</v-icon>
47
+ </v-list-item-icon>
48
+
49
+ <v-list-item-content>
50
+ <v-list-item-title>
51
+ {{
52
+ contentBlock.block.body.replace(
53
+ /<[^>]*>?/gm,
54
+ ''
55
+ )
56
+ }}
57
+ </v-list-item-title>
58
+ </v-list-item-content>
59
+ <v-list-item-action>
60
+ <v-checkbox
61
+ :input-value="active"
62
+ color="primary"
63
+ ></v-checkbox>
64
+ </v-list-item-action>
65
+ </template>
66
+ </v-list-item>
67
+ </draggable>
68
+ </v-list-item-group>
69
+ </v-list>
70
+ </v-form>
71
+ </v-container>
72
+ </template>
73
+
74
+ <script>
75
+ import _ from 'lodash'
76
+ import { mapGetters } from 'vuex'
77
+ import draggable from 'vuedraggable'
78
+ import TextEditor from '~/components/Text/TextEditor.vue'
79
+ import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
80
+ import ContentBlock from '~/models/ContentBlock'
81
+ import Course from '~/models/Course'
82
+
83
+ export default {
84
+ name: 'ImageSettings',
85
+ extends: BaseContentSettings,
86
+ components: { draggable, TextEditor },
87
+ props: {
88
+ settings: { type: Object, required: false, default: null },
89
+ context: { type: String, required: false, default: 'block' },
90
+ },
91
+ data() {
92
+ return {
93
+ contentBlocks: [],
94
+ linked: [],
95
+ }
96
+ },
97
+ computed: {
98
+ ...mapGetters({
99
+ organization: 'organization/get',
100
+ course: 'course/get',
101
+ enrollment: 'enrollment/get',
102
+ }),
103
+ dragOptions() {
104
+ return {
105
+ animation: 200,
106
+ }
107
+ },
108
+ },
109
+ async fetch() {
110
+ this.contentBlocks = await ContentBlock.where(
111
+ 'tag',
112
+ 'plugin-core-open-response'
113
+ )
114
+ .for(new Course({ id: this.course.id }))
115
+ .get()
116
+ },
117
+ beforeMount() {
118
+ if (_.isEmpty(this.block)) {
119
+ this.block = {}
120
+ }
121
+ if (_.isEmpty(this.block.body)) {
122
+ this.block.body = ''
123
+ }
124
+ if (_.isEmpty(this.block.metadata)) {
125
+ this.block.metadata = {}
126
+ }
127
+ if (_.isEmpty(this.block.metadata.config)) {
128
+ this.block.metadata.config = {}
129
+ }
130
+ if (_.isEmpty(this.block.metadata.config.linked)) {
131
+ this.block.metadata.config.linked = []
132
+ }
133
+ if (_.isEmpty(this.block.metadata.config.filename)) {
134
+ this.block.metadata.config.filename = ''
135
+ }
136
+ if (_.isEmpty(this.block.metadata.config.include_prompts)) {
137
+ this.block.metadata.config.include_prompts = false
138
+ }
139
+
140
+ this.linked = this.block.metadata.config.linked
141
+ },
142
+ watch: {},
143
+ mounted() {},
144
+ methods: {
145
+ // Called when the order changes
146
+ onDragChange(e) {
147
+ this.setLinkedBlocks()
148
+ },
149
+ // Called when blocks are added / removed
150
+ onLinkedChange() {
151
+ this.setLinkedBlocks()
152
+ },
153
+ setLinkedBlocks() {
154
+ const linkedContentIds = []
155
+
156
+ // Loop over content blocks since they have the correct order we want to collate
157
+ this.contentBlocks.forEach((contentBlock) => {
158
+ // If the unsorted this.linked includes the block id, add it in the right order
159
+ if (this.linked.includes(contentBlock.id)) {
160
+ linkedContentIds.push(contentBlock.id)
161
+ }
162
+ })
163
+
164
+ // Set the linked and also body for convenience
165
+ this.block.metadata.config.linked = linkedContentIds
166
+ this.block.body = linkedContentIds.join()
167
+ },
168
+ },
169
+ }
170
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <v-container>
3
+ <v-form>
4
+ <h3 class="pb-2">
5
+ {{
6
+ $t(
7
+ 'windward.core.components.settings.open_response.question'
8
+ )
9
+ }}
10
+ </h3>
11
+ <TextEditor v-model="block.body" :height="200"></TextEditor>
12
+
13
+ <h3 class="pb-2">
14
+ {{
15
+ $t(
16
+ 'windward.core.components.settings.open_response.sample_response'
17
+ )
18
+ }}
19
+ </h3>
20
+ <TextEditor
21
+ v-model="block.metadata.config.sample_response"
22
+ :height="200"
23
+ ></TextEditor>
24
+
25
+ <h3 class="pb-2">
26
+ {{
27
+ $t(
28
+ 'windward.core.components.settings.open_response.starting_text'
29
+ )
30
+ }}
31
+ </h3>
32
+ <TextEditor
33
+ v-model="block.metadata.config.starting_text"
34
+ :height="200"
35
+ ></TextEditor>
36
+ </v-form>
37
+ </v-container>
38
+ </template>
39
+
40
+ <script>
41
+ import _ from 'lodash'
42
+ import TextEditor from '~/components/Text/TextEditor.vue'
43
+ import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
44
+ import ContentBlockAsset from '~/components/Content/ContentBlockAsset.vue'
45
+
46
+ export default {
47
+ name: 'ImageSettings',
48
+ extends: BaseContentSettings,
49
+ components: { ContentBlockAsset, TextEditor },
50
+ props: {
51
+ settings: { type: Object, required: false, default: null },
52
+ context: { type: String, required: false, default: 'block' },
53
+ },
54
+ beforeMount() {
55
+ if (_.isEmpty(this.block)) {
56
+ this.block = {}
57
+ }
58
+ if (_.isEmpty(this.block.body)) {
59
+ this.block.body = ''
60
+ }
61
+ if (_.isEmpty(this.block.metadata)) {
62
+ this.block.metadata = {}
63
+ }
64
+ if (_.isEmpty(this.block.metadata.config)) {
65
+ this.block.metadata.config = {}
66
+ }
67
+ if (_.isEmpty(this.block.metadata.config.sample_response)) {
68
+ this.block.metadata.config.sample_response = ''
69
+ }
70
+ if (_.isEmpty(this.block.metadata.config.starting_text)) {
71
+ this.block.metadata.config.starting_text = ''
72
+ }
73
+ },
74
+ data() {
75
+ return {}
76
+ },
77
+ watch: {},
78
+ mounted() {},
79
+ methods: {},
80
+ }
81
+ </script>
@@ -8,6 +8,7 @@
8
8
  <script>
9
9
  import MathHelper from '../../helpers/MathHelper'
10
10
  import GlossaryHelper from '../../helpers/GlossaryHelper'
11
+ import FillInBlankHelper from '../../helpers/FillInBlankHelper'
11
12
  import { mapGetters } from 'vuex'
12
13
  import Vue from 'vue'
13
14
  export default {
@@ -29,17 +30,27 @@ export default {
29
30
  convertedContent() {
30
31
  let content = ''
31
32
  if (this.value) {
33
+ content = _.cloneDeep(this.value)
32
34
  if (
33
- GlossaryHelper.containsGlossaryTerms(this.value) &&
35
+ MathHelper.containsMathML(content) ||
36
+ MathHelper.containsLatex(content)
37
+ ) {
38
+ content = MathHelper.convertMathContentToHtml(content)
39
+ }
40
+ if (
41
+ GlossaryHelper.containsGlossaryTerms(content) &&
34
42
  _.isObject(this.course.metadata) &&
35
43
  _.isArray(this.course.metadata.glossary)
36
44
  ) {
37
45
  content = GlossaryHelper.renderGlossaryWordsHtml(
38
- MathHelper.convertMathContentToHtml(this.value),
46
+ content,
39
47
  this.course.metadata.glossary
40
48
  )
41
- } else {
42
- content = MathHelper.convertMathContentToHtml(this.value)
49
+ }
50
+
51
+ if (FillInBlankHelper.containsFillInBlank(content)) {
52
+ content =
53
+ FillInBlankHelper.renderFillInTHeBlankHtml(content)
43
54
  }
44
55
  }
45
56
  return Vue.compile('<div>' + content + '</div>')
@@ -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
+ &nbsp;
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="shrinkClass"
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="shrinkClass"
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
  {