@windward/core 0.0.5 → 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.
Files changed (91) 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/Navigation/Items/AskTheExpert.vue +173 -0
  6. package/components/Settings/ClickableIconsSettings.vue +10 -5
  7. package/components/utils/ContentViewer.vue +15 -4
  8. package/components/utils/FillInBlank/FillInBlankInput.vue +208 -0
  9. package/components/utils/FillInBlank/FillInTheBlanksManager.vue +98 -0
  10. package/components/utils/MathExpressionEditor.vue +8 -6
  11. package/components/utils/TinyMCEWrapper.vue +48 -8
  12. package/components/utils/assets/tinymce/css/content.scss +9 -0
  13. package/components/utils/glossary/CourseGlossary.vue +12 -8
  14. package/components/utils/glossary/CourseGlossaryForm.vue +24 -5
  15. package/helpers/FillInBlankHelper.ts +55 -0
  16. package/helpers/GlossaryHelper.ts +4 -4
  17. package/helpers/tinymce/plugin.ts +99 -4
  18. package/i18n/en-US/components/content/blocks/feedback.ts +3 -0
  19. package/i18n/en-US/components/index.ts +0 -1
  20. package/i18n/en-US/components/navigation/ask_the_expert.ts +11 -0
  21. package/i18n/en-US/components/navigation/index.ts +2 -0
  22. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  23. package/i18n/en-US/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  24. package/i18n/en-US/components/utils/FillInBlank/index.ts +6 -0
  25. package/i18n/en-US/components/utils/index.ts +2 -1
  26. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  27. package/i18n/en-US/shared/menu.ts +1 -0
  28. package/i18n/es-ES/components/content/blocks/feedback.ts +29 -0
  29. package/i18n/es-ES/components/content/blocks/image.ts +5 -0
  30. package/i18n/es-ES/components/content/blocks/index.ts +15 -0
  31. package/i18n/es-ES/components/content/blocks/tab.ts +4 -0
  32. package/i18n/es-ES/components/content/blocks/table.ts +4 -0
  33. package/i18n/es-ES/components/content/blocks/user_upload.ts +13 -0
  34. package/i18n/es-ES/components/content/blocks/video.ts +55 -0
  35. package/i18n/es-ES/components/content/index.ts +5 -0
  36. package/i18n/es-ES/components/index.ts +12 -0
  37. package/i18n/es-ES/components/navigation/ask_the_expert.ts +11 -0
  38. package/i18n/es-ES/components/navigation/image.ts +4 -0
  39. package/i18n/es-ES/components/navigation/index.ts +7 -0
  40. package/i18n/es-ES/components/navigation/user_upload.ts +3 -0
  41. package/i18n/es-ES/components/settings/clickable_icon.ts +10 -0
  42. package/i18n/es-ES/components/settings/image.ts +1 -0
  43. package/i18n/es-ES/components/settings/index.ts +13 -0
  44. package/i18n/es-ES/components/settings/text_editor.ts +7 -0
  45. package/i18n/es-ES/components/settings/user_upload.ts +11 -0
  46. package/i18n/es-ES/components/settings/video.ts +13 -0
  47. package/i18n/es-ES/components/utils/index.ts +5 -0
  48. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +18 -0
  49. package/i18n/es-ES/index.ts +16 -0
  50. package/i18n/es-ES/modules/index.ts +5 -0
  51. package/i18n/es-ES/pages/glossary.ts +7 -0
  52. package/i18n/es-ES/pages/index.ts +7 -0
  53. package/i18n/es-ES/pages/user_upload.ts +3 -0
  54. package/i18n/es-ES/shared/content_blocks.ts +20 -0
  55. package/i18n/es-ES/shared/index.ts +11 -0
  56. package/i18n/es-ES/shared/menu.ts +3 -0
  57. package/i18n/es-ES/shared/permission.ts +15 -0
  58. package/i18n/es-ES/shared/settings.ts +16 -0
  59. package/i18n/sv-SE/components/content/blocks/feedback.ts +29 -0
  60. package/i18n/sv-SE/components/content/blocks/image.ts +5 -0
  61. package/i18n/sv-SE/components/content/blocks/index.ts +15 -0
  62. package/i18n/sv-SE/components/content/blocks/tab.ts +4 -0
  63. package/i18n/sv-SE/components/content/blocks/table.ts +4 -0
  64. package/i18n/sv-SE/components/content/blocks/user_upload.ts +13 -0
  65. package/i18n/sv-SE/components/content/blocks/video.ts +53 -0
  66. package/i18n/sv-SE/components/content/index.ts +5 -0
  67. package/i18n/sv-SE/components/index.ts +12 -0
  68. package/i18n/sv-SE/components/navigation/ask_the_expert.ts +11 -0
  69. package/i18n/sv-SE/components/navigation/image.ts +4 -0
  70. package/i18n/sv-SE/components/navigation/index.ts +7 -0
  71. package/i18n/sv-SE/components/navigation/user_upload.ts +3 -0
  72. package/i18n/sv-SE/components/settings/clickable_icon.ts +10 -0
  73. package/i18n/sv-SE/components/settings/image.ts +1 -0
  74. package/i18n/sv-SE/components/settings/index.ts +13 -0
  75. package/i18n/sv-SE/components/settings/text_editor.ts +7 -0
  76. package/i18n/sv-SE/components/settings/user_upload.ts +11 -0
  77. package/i18n/sv-SE/components/settings/video.ts +13 -0
  78. package/i18n/sv-SE/components/utils/index.ts +5 -0
  79. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +18 -0
  80. package/i18n/sv-SE/index.ts +16 -0
  81. package/i18n/sv-SE/modules/index.ts +5 -0
  82. package/i18n/sv-SE/pages/glossary.ts +7 -0
  83. package/i18n/sv-SE/pages/index.ts +7 -0
  84. package/i18n/sv-SE/pages/user_upload.ts +3 -0
  85. package/i18n/sv-SE/shared/content_blocks.ts +20 -0
  86. package/i18n/sv-SE/shared/index.ts +11 -0
  87. package/i18n/sv-SE/shared/menu.ts +3 -0
  88. package/i18n/sv-SE/shared/permission.ts +15 -0
  89. package/i18n/sv-SE/shared/settings.ts +15 -0
  90. package/package.json +1 -1
  91. package/plugin.js +25 -0
package/README.md CHANGED
@@ -24,7 +24,7 @@ Link to Windward ui repo
24
24
  $ cd windward-ui
25
25
  $ npm install
26
26
  $ cd node_modules
27
- $ npm link @mindedge/windward-ui-plugin-core
27
+ $ npm link @windward/core
28
28
  $ npm run dev
29
29
  ```
30
30
 
@@ -61,6 +61,7 @@ Your Repos are linked at this point and you are ready to start developing windwa
61
61
  ```
62
62
  import UserUpload from '@/components/Content/Blocks/UserUpload.vue'
63
63
  ```
64
+
64
65
  4. To add a page use the below format in your `pages: []` in `plugin.js`
65
66
  ```javascript
66
67
  {
@@ -31,7 +31,7 @@
31
31
  outlined
32
32
  @click="item.active = !item.active"
33
33
  >
34
- <v-icon>{{ item.icon }}</v-icon>
34
+ <v-icon>{{ onHandleHtmlEntities(item.icon) }}</v-icon>
35
35
  </v-btn>
36
36
  </v-col>
37
37
  <v-col cols="10" v-if="item.active">
@@ -89,6 +89,15 @@ export default {
89
89
  displayText: false,
90
90
  }
91
91
  },
92
+ methods: {
93
+ onHandleHtmlEntities(str) {
94
+ let txt = document.createElement('textarea')
95
+
96
+ txt.innerHTML = str
97
+
98
+ return txt.value
99
+ },
100
+ },
92
101
  }
93
102
  </script>
94
103
  <style scoped>
@@ -13,6 +13,13 @@
13
13
  </h3>
14
14
  </v-row>
15
15
  <v-row class="pt-2">
16
+ <p>
17
+ {{
18
+ $t(
19
+ 'windward.core.components.content.blocks.feedback.likert_directions'
20
+ )
21
+ }}
22
+ </p>
16
23
  <p>
17
24
  {{
18
25
  $t(
@@ -24,9 +31,9 @@
24
31
  </v-container>
25
32
  <v-container v-if="doesFeedbackExist">
26
33
  <v-row>
27
- <h3>
28
- {{ block.metadata.config.definition.name }}
29
- </h3>
34
+ <h2>
35
+ {{ existingFeedback.survey_type }}
36
+ </h2>
30
37
  </v-row>
31
38
  <v-row class="pt-2">
32
39
  <p>
@@ -187,8 +194,8 @@ export default {
187
194
  courseUserId: '',
188
195
  valid: true,
189
196
  key: '0',
190
- existingFeedback: '',
191
197
  doesFeedbackExist: false,
198
+ existingFeedback: '',
192
199
  templates: '',
193
200
  chosenPreset: '',
194
201
  studentResponse: '',
@@ -271,6 +278,7 @@ export default {
271
278
  survey_snapshot:
272
279
  this.block.metadata.config.definition.metadata.definition,
273
280
  survey_question_answers: this.chosenPreset,
281
+ survey_type: this.block.metadata.config.definition.name,
274
282
  version: version,
275
283
  }
276
284
  let feedback = new SurveyResult(feedbackData).for(
@@ -4,27 +4,28 @@
4
4
  {{ value.body }}
5
5
  </p>
6
6
  <div v-if="!feedbackExist">
7
- <TextEditor v-model="value.response"></TextEditor>
7
+ <v-text-field
8
+ outlined
9
+ v-model="value.response"
10
+ :label="
11
+ $t('windward.core.components.content.blocks.feedback.enter')
12
+ "
13
+ ></v-text-field>
8
14
  </div>
9
15
  <div v-else>
10
16
  <div v-if="value.response">
11
- <TextViewer v-model="value.response" text-viewer></TextViewer>
17
+ <div>{{ value.response }}</div>
12
18
  </div>
13
19
  <div v-else>
14
- <TextViewer v-model="noResponse" text-viewer></TextViewer>
20
+ <div>{{ noResponse }}</div>
15
21
  </div>
16
22
  </div>
17
23
  </v-container>
18
24
  </template>
19
25
  <script>
20
- import TextEditor from '~/components/Text/TextEditor.vue'
21
- import TextViewer from '~/components/Text/TextViewer.vue'
22
26
  export default {
23
27
  name: 'FeedbackQuestionOpenResponse',
24
- components: {
25
- TextEditor,
26
- TextViewer,
27
- },
28
+ components: {},
28
29
  props: {
29
30
  value: { type: Object, required: true, default: '' },
30
31
  feedbackExist: { type: Boolean, required: false, default: false },
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <v-list-item @click="dialog = true">
3
+ <v-list-item-action>
4
+ <v-icon>{{ config.icon }}</v-icon>
5
+ </v-list-item-action>
6
+ <v-list-item-content>
7
+ <v-list-item-title>
8
+ {{ $t(config.i18n) }}
9
+ </v-list-item-title>
10
+ <Dialog v-model="dialog" color="primary" text :trigger="false">
11
+ <template #title>{{ $t(config.i18n) }}</template>
12
+ <template #form="{ on, attrs }">
13
+ <v-card flat v-bind="attrs" v-on="on">
14
+ <v-container fluid>
15
+ <v-row>
16
+ <v-col cols="12" class="pl-6">
17
+ <h3>
18
+ {{
19
+ $t(
20
+ 'windward.core.components.navigation.ask_the_expert.description'
21
+ )
22
+ }}
23
+ </h3>
24
+ </v-col>
25
+ <v-col
26
+ v-if="
27
+ $PermissionService.userHasAccessTo(
28
+ 'windward.global.course,windward.organization.course.contentBlock',
29
+ 'writable'
30
+ )
31
+ "
32
+ cols="12"
33
+ >
34
+ <v-col cols="12">
35
+ <h3 class="pb-4">
36
+ {{
37
+ $t(
38
+ 'windward.core.components.navigation.ask_the_expert.config'
39
+ )
40
+ }}
41
+ </h3>
42
+ </v-col>
43
+ <v-col cols="12">
44
+ <v-text-field
45
+ v-model="courseAndContentName"
46
+ disabled
47
+ outlined
48
+ :label="
49
+ $t(
50
+ 'windward.core.components.navigation.ask_the_expert.course_info'
51
+ )
52
+ "
53
+ ></v-text-field>
54
+ </v-col>
55
+ </v-col>
56
+ <v-col
57
+ v-if="
58
+ !$PermissionService.userHasAccessTo(
59
+ 'windward.global.course,windward.organization.course.contentBlock',
60
+ 'writable'
61
+ )
62
+ "
63
+ cols="12"
64
+ >
65
+ <v-col cols="12">
66
+ <v-text-field
67
+ v-model="subject"
68
+ outlined
69
+ :label="
70
+ $t(
71
+ 'windward.core.components.navigation.ask_the_expert.subject'
72
+ )
73
+ "
74
+ ></v-text-field>
75
+ </v-col>
76
+ <v-col cols="12">
77
+ <v-textarea v-model="body" outlined>
78
+ <template #label>
79
+ <div>
80
+ {{
81
+ $t(
82
+ 'windward.core.components.navigation.ask_the_expert.question'
83
+ )
84
+ }}
85
+ </div>
86
+ </template>
87
+ </v-textarea>
88
+ </v-col>
89
+ <v-col
90
+ cols="12"
91
+ class="pt-5 pb-5 d-flex flex-row-reverse"
92
+ >
93
+ <v-btn
94
+ class="primary"
95
+ :disabled="valid"
96
+ @click="onSubmit"
97
+ >{{
98
+ $t('shared.forms.submit')
99
+ }}</v-btn
100
+ >
101
+ </v-col>
102
+ </v-col>
103
+ </v-row>
104
+ </v-container>
105
+ </v-card>
106
+ </template>
107
+ </Dialog>
108
+ </v-list-item-content>
109
+ </v-list-item>
110
+ </template>
111
+
112
+ <script>
113
+ import { mapGetters } from 'vuex'
114
+ import AuthUserRepository from '~/models/repositories/AuthUserRepository'
115
+ import AskTheExpert from '~/models/AskTheExpert'
116
+
117
+ export default {
118
+ name: 'NavigationItemAskTheExpert',
119
+ components: {},
120
+ props: {
121
+ config: { type: Object, required: true },
122
+ },
123
+ data() {
124
+ return {
125
+ currentUser: new AuthUserRepository(this.$nuxt),
126
+ expert: '',
127
+ course: this.$ContentService.getCourse(),
128
+ content: this.$ContentService.get().content,
129
+ courseAndContentName: '',
130
+ body: '',
131
+ subject: '',
132
+ dialog: false,
133
+ }
134
+ },
135
+ computed: {
136
+ ...mapGetters({
137
+ enrollment: 'enrollment/get',
138
+ }),
139
+ valid() {
140
+ if (this.body === '' || this.subject === '') {
141
+ return true
142
+ } else {
143
+ return false
144
+ }
145
+ },
146
+ },
147
+ mounted() {
148
+ this.courseAndContentName = this.course.name + ': ' + this.content.name
149
+ },
150
+ methods: {
151
+ async onSubmit() {
152
+ const askTheExpertSubmission = new AskTheExpert({
153
+ body: this.body,
154
+ subject: this.subject,
155
+ currentUser: this.currentUser,
156
+ enrollment: this.enrollment,
157
+ content: this.content,
158
+ course: this.course,
159
+ courseAndContentName: this.courseAndContentName,
160
+ })
161
+ await askTheExpertSubmission.save()
162
+ if (askTheExpertSubmission) {
163
+ this.$dialog.success('Ask The Expert Email Sent Successfully')
164
+ this.body = ''
165
+ this.subject = ''
166
+ this.dialog = false
167
+ } else {
168
+ this.$dialog.error('Ask The Expert Email Failed')
169
+ }
170
+ },
171
+ },
172
+ }
173
+ </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-container>
4
- <v-col>
4
+ <v-col class="pa-0">
5
5
  <v-text-field
6
6
  v-model="block.metadata.config.title"
7
7
  :label="
@@ -18,7 +18,11 @@
18
18
  )
19
19
  "
20
20
  ></v-text-field>
21
- <v-btn color="primary" outlined @click="onAddElement"
21
+ <v-btn
22
+ color="primary"
23
+ outlined
24
+ @click="onAddElement"
25
+ class="btn-add"
22
26
  ><v-icon>mdi-plus</v-icon
23
27
  >{{ $t('shared.forms.add') }}</v-btn
24
28
  >
@@ -29,7 +33,7 @@
29
33
  :key="itemIndex"
30
34
  class="elevation-0"
31
35
  >
32
- <v-expansion-panel-header class="elevation-0">{{
36
+ <v-expansion-panel-header class="elevation-0 pa-0">{{
33
37
  'item ' + (itemIndex + 1)
34
38
  }}</v-expansion-panel-header>
35
39
  <v-expansion-panel-content
@@ -37,8 +41,6 @@
37
41
  :key="expansionPanelKey"
38
42
  >
39
43
  <v-text-field
40
- :counter="1"
41
- maxlength="1"
42
44
  v-model="
43
45
  block.metadata.config.items[itemIndex].icon
44
46
  "
@@ -186,4 +188,7 @@ export default {
186
188
  .v-progress-circular {
187
189
  margin: 1rem;
188
190
  }
191
+ .btn-add {
192
+ width: 100%;
193
+ }
189
194
  </style>
@@ -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>