@windward/core 0.2.0 → 0.2.2

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 (67) hide show
  1. package/components/Content/Blocks/Accordion.vue +25 -11
  2. package/components/Content/Blocks/BlockQuote.vue +3 -1
  3. package/components/Content/Blocks/ClickableIcons.vue +29 -27
  4. package/components/Content/Blocks/Email.vue +64 -24
  5. package/components/Content/Blocks/Feedback.vue +5 -13
  6. package/components/Content/Blocks/Image.vue +8 -1
  7. package/components/Content/Blocks/Math.vue +3 -1
  8. package/components/Content/Blocks/OpenResponseCollate.vue +1 -1
  9. package/components/Content/Blocks/ScenarioChoice.vue +3 -1
  10. package/components/Content/Blocks/Tab.vue +3 -1
  11. package/components/Content/Blocks/UserUpload.vue +5 -3
  12. package/components/Settings/AccordionSettings.vue +34 -11
  13. package/components/Settings/BlockQuoteSettings.vue +1 -1
  14. package/components/Settings/ClickableIconsSettings.vue +1 -1
  15. package/components/Settings/EmailSettings.vue +61 -19
  16. package/components/Settings/FeedbackSettings.vue +3 -1
  17. package/components/Settings/MathSettings.vue +6 -4
  18. package/components/Settings/ScenarioChoiceSettings.vue +57 -48
  19. package/components/Settings/TabSettings.vue +4 -2
  20. package/components/Settings/TextEditorSettings.vue +72 -30
  21. package/components/Settings/UserUploadSettings.vue +4 -4
  22. package/components/Settings/VideoSettings.vue +2 -2
  23. package/components/utils/ContentViewer.vue +2 -1
  24. package/components/utils/FillInBlank/FillInTheBlanksManager.vue +20 -24
  25. package/components/utils/MathExpressionEditor.vue +81 -85
  26. package/components/utils/MathLiveWrapper.vue +3 -1
  27. package/components/utils/TinyMCEWrapper.vue +91 -21
  28. package/components/utils/glossary/CourseGlossary.vue +45 -32
  29. package/components/utils/glossary/CourseGlossaryForm.vue +1 -0
  30. package/config/tinymce.config.ts +314 -0
  31. package/helpers/tinymce/plugin.ts +48 -27
  32. package/i18n/en-US/components/content/blocks/email.ts +2 -0
  33. package/i18n/en-US/components/settings/accordion.ts +2 -1
  34. package/i18n/en-US/components/settings/email.ts +1 -0
  35. package/i18n/en-US/components/settings/text_editor.ts +4 -1
  36. package/i18n/en-US/components/utils/math_expression_editor.ts +11 -0
  37. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  38. package/i18n/en-US/pages/index.ts +2 -0
  39. package/i18n/en-US/pages/plugins/error.ts +9 -0
  40. package/i18n/en-US/pages/plugins/index.ts +5 -0
  41. package/i18n/en-US/shared/settings.ts +1 -1
  42. package/i18n/es-ES/components/content/blocks/email.ts +2 -0
  43. package/i18n/es-ES/components/settings/accordion.ts +2 -1
  44. package/i18n/es-ES/components/settings/email.ts +1 -0
  45. package/i18n/es-ES/components/settings/text_editor.ts +4 -1
  46. package/i18n/es-ES/components/utils/math_expression_editor.ts +11 -0
  47. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  48. package/i18n/es-ES/pages/index.ts +2 -0
  49. package/i18n/es-ES/pages/plugins/error.ts +9 -0
  50. package/i18n/es-ES/pages/plugins/index.ts +5 -0
  51. package/i18n/sv-SE/components/content/blocks/email.ts +2 -0
  52. package/i18n/sv-SE/components/settings/accordion.ts +1 -0
  53. package/i18n/sv-SE/components/settings/email.ts +1 -0
  54. package/i18n/sv-SE/components/settings/text_editor.ts +4 -1
  55. package/i18n/sv-SE/components/utils/math_expression_editor.ts +11 -0
  56. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  57. package/i18n/sv-SE/pages/index.ts +2 -0
  58. package/i18n/sv-SE/pages/plugins/error.ts +8 -0
  59. package/i18n/sv-SE/pages/plugins/index.ts +5 -0
  60. package/package.json +1 -1
  61. package/pages/plugins/tinymce/_plugin.vue +79 -0
  62. package/plugin.js +10 -0
  63. package/test/Components/Settings/EmailSettings.spec.js +18 -2
  64. package/test/Pages/Plugins/TinyMce.spec.js +23 -0
  65. package/test/__mocks__/componentsMock.js +0 -12
  66. package/test/mocks.js +1 -0
  67. package/config/tinymce.config.js +0 -136
@@ -1,17 +1,20 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-expansion-panels
4
- v-model="block.metadata.config.currentAccordion"
4
+ v-model="selectedPanels"
5
5
  flat
6
6
  accordion
7
7
  focusable
8
- id="expansion-panel-setting"
8
+ class="expansion-panels-container"
9
9
  >
10
10
  <v-expansion-panel
11
11
  v-for="(item, itemIndex) in block.metadata.config.items"
12
12
  :key="itemIndex"
13
13
  >
14
- <v-expansion-panel-header class="header" color="primary">
14
+ <v-expansion-panel-header
15
+ class="expansion-panel-header"
16
+ color="primary"
17
+ >
15
18
  {{
16
19
  item.header === '' || item.header === null
17
20
  ? 'Item ' + (itemIndex + 1)
@@ -19,7 +22,7 @@
19
22
  }}
20
23
  </v-expansion-panel-header>
21
24
  <v-expansion-panel-content
22
- class="body"
25
+ class="expansion-panel-body"
23
26
  :key="expansionPanelKey"
24
27
  >
25
28
  <v-container>
@@ -74,19 +77,30 @@ export default {
74
77
  this.block.metadata.config.items = []
75
78
  this.block.metadata.config.items.push(defaultObject)
76
79
  }
77
- if (_.isEmpty(this.block.metadata.config.currentAccordion)) {
78
- this.block.metadata.config.currentAccordion = 0
80
+ if (_.isEmpty(this.block.metadata.config.selectedPanels)) {
81
+ this.block.metadata.config.selectedPanels = 0
79
82
  }
80
- this.block.body = 'accordion'
83
+ this.block.body = this.$t(
84
+ 'windward.core.shared.content_blocks.title.accordion'
85
+ )
81
86
  },
82
87
  data() {
83
88
  return {
84
89
  expansionPanelKey: '0',
85
90
  editingInContentItem: false,
91
+ selectedPanels: 0,
86
92
  }
87
93
  },
88
94
  watch: {
89
95
  value(newValue) {
96
+ if (
97
+ !this.render &&
98
+ this.selectedPanels !== newValue.metadata.config.selectedPanels
99
+ ) {
100
+ // update editing content block
101
+ this.selectedPanels = newValue.metadata.config.selectedPanels
102
+ this.expansionPanelKey = Crypto.id()
103
+ }
90
104
  const length = newValue.metadata.config.items.length
91
105
  let counter = 0
92
106
  newValue.metadata.config.items.forEach((element) => {
@@ -110,6 +124,7 @@ export default {
110
124
  this.block.metadata.config.items.forEach((element) => {
111
125
  element.expand = false
112
126
  })
127
+ this.selectedPanels = 0
113
128
  }
114
129
  },
115
130
  },
@@ -118,21 +133,20 @@ export default {
118
133
  this.block.metadata.config.items.forEach((element) => {
119
134
  element.expand = false
120
135
  })
121
- this.block.metadata.config.currentAccordion = null
122
136
  },
123
137
  },
124
138
  }
125
139
  </script>
126
140
 
127
141
  <style lang="scss" scoped>
128
- .header {
142
+ .expansion-panel-header {
129
143
  color: white;
130
144
  margin-top: 1px;
131
145
  }
132
- .body {
146
+ .expansion-panel-body {
133
147
  background: var(--v-surface-base);
134
148
  }
135
- #expansion-panel-setting {
149
+ .expansion-panels-container {
136
150
  z-index: 0;
137
151
  }
138
152
  </style>
@@ -70,7 +70,9 @@ export default {
70
70
  source_type: '',
71
71
  }
72
72
  }
73
- this.block.body = 'block quote'
73
+ this.block.body = this.$t(
74
+ 'windward.core.components.content.blocks.block_quote.body'
75
+ )
74
76
  },
75
77
  data() {
76
78
  return {
@@ -71,6 +71,35 @@ export default {
71
71
  TextViewer,
72
72
  },
73
73
  extends: BaseContentBlock,
74
+ beforeMount() {
75
+ // Apply the default config
76
+ this.block.body = this.$t(
77
+ 'windward.core.shared.content_blocks.title.clickable_icons'
78
+ )
79
+ if (_.isEmpty(this.block.metadata.config.items)) {
80
+ this.block.metadata.config.items = []
81
+ }
82
+ if (_.isEmpty(this.block.metadata.config.title)) {
83
+ this.block.metadata.config.title = ''
84
+ }
85
+ if (_.isEmpty(this.block.metadata.config.description)) {
86
+ this.block.metadata.config.description = ''
87
+ }
88
+ if (_.isEmpty(this.block.metadata.config.display)) {
89
+ this.block.metadata.config.display = {
90
+ show_title: false,
91
+ show_background: false,
92
+ round_icon: false,
93
+ italic_icon: false,
94
+ autocolor: true,
95
+ }
96
+ }
97
+ if (this.block.metadata.config.items.length) {
98
+ for (const index in this.block.metadata.config.items) {
99
+ this.block.metadata.config.items[index].active = false
100
+ }
101
+ }
102
+ },
74
103
  data() {
75
104
  return {}
76
105
  },
@@ -146,33 +175,6 @@ export default {
146
175
  }
147
176
  },
148
177
  },
149
- beforeMount() {
150
- // Apply the default config
151
- this.block.body = 'clickable icons'
152
- if (_.isEmpty(this.block.metadata.config.items)) {
153
- this.block.metadata.config.items = []
154
- }
155
- if (_.isEmpty(this.block.metadata.config.title)) {
156
- this.block.metadata.config.title = ''
157
- }
158
- if (_.isEmpty(this.block.metadata.config.description)) {
159
- this.block.metadata.config.description = ''
160
- }
161
- if (_.isEmpty(this.block.metadata.config.display)) {
162
- this.block.metadata.config.display = {
163
- show_title: false,
164
- show_background: false,
165
- round_icon: false,
166
- italic_icon: false,
167
- autocolor: true,
168
- }
169
- }
170
- if (this.block.metadata.config.items.length) {
171
- for (const index in this.block.metadata.config.items) {
172
- this.block.metadata.config.items[index].active = false
173
- }
174
- }
175
- },
176
178
  methods: {
177
179
  isIcon(str) {
178
180
  return str && _.isString(str) && str.indexOf('mdi-') === 0
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-container class="container-left-border">
2
+ <v-container>
3
3
  <v-row
4
4
  v-if="
5
5
  block.metadata.config.title ||
@@ -16,16 +16,20 @@
16
16
  </v-col>
17
17
  </v-row>
18
18
  <v-row>
19
- <v-expansion-panels v-model="selectedPanels" accordion>
19
+ <v-expansion-panels
20
+ v-model="selectedPanels"
21
+ :key="expansionPanelKey"
22
+ accordion
23
+ >
20
24
  <v-container
21
25
  class="pa-0 primary container-subject d-flex justify-center align-center"
22
26
  >
23
- <v-row class="d-flex pa-5">
27
+ <v-row class="d-flex ma-5">
24
28
  <v-col cols="6">
25
29
  {{
26
- block.metadata.config.subject
27
- ? block.metadata.config.subject
28
- : 'Subject'
30
+ $t(
31
+ 'windward.core.components.content.blocks.email.email'
32
+ )
29
33
  }}
30
34
  </v-col>
31
35
  <v-col
@@ -75,10 +79,10 @@
75
79
  >
76
80
  </v-col>
77
81
  <v-col
78
- xl="1"
79
- lg="3"
80
- md="11"
81
- sm="10"
82
+ xl="4"
83
+ lg="4"
84
+ md="5"
85
+ sm="5"
82
86
  xs="10"
83
87
  class="d-flex align-center"
84
88
  >
@@ -88,12 +92,16 @@
88
92
  </v-col>
89
93
  <v-col
90
94
  v-if="selectedPanels !== index"
91
- xl="10"
92
- lg="8"
95
+ xl="7"
96
+ lg="7"
97
+ md="6"
98
+ sm="5"
93
99
  class="d-flex align-center container-body-preview"
94
100
  >
95
101
  <div class="div-preview">
96
- {{ onRemoveTags(item.body) }}
102
+ {{
103
+ item.body ? onRemoveTags(item.body) : ''
104
+ }}
97
105
  </div>
98
106
  </v-col>
99
107
  </v-row>
@@ -127,18 +135,25 @@
127
135
  )
128
136
  }}: {{ item.cc }}
129
137
  </div>
138
+ <div class="div-details-cc">
139
+ {{
140
+ $t(
141
+ 'windward.core.components.content.blocks.email.subject'
142
+ )
143
+ }}: {{ item.subject }}
144
+ </div>
130
145
  </v-col>
131
146
  </v-row>
132
147
  <v-row>
133
148
  <v-col cols="1"></v-col>
134
149
  <v-col class="pl-4">
135
150
  <TextViewer
136
- v-if="!item.expand"
151
+ v-if="!item.tinymce_expand"
137
152
  v-model="item.body"
138
153
  text-viewer
139
154
  ></TextViewer>
140
155
  <TextEditor
141
- v-if="!render && item.expand"
156
+ v-if="!render && item.tinymce_expand"
142
157
  v-model="
143
158
  block.metadata.config.emails[index]
144
159
  .body
@@ -155,7 +170,7 @@
155
170
  >
156
171
  <v-row class="pt-4">
157
172
  <v-col cols="10" class="pa-0">
158
- <v-btn color="primary" outlined>
173
+ <v-btn color="primary" text>
159
174
  <v-icon>mdi-reply</v-icon>
160
175
  {{
161
176
  $t(
@@ -163,7 +178,7 @@
163
178
  )
164
179
  }}</v-btn
165
180
  >
166
- <v-btn color="primary" outlined>
181
+ <v-btn color="primary" text>
167
182
  <v-icon>mdi-reply-all</v-icon>
168
183
  {{
169
184
  $t(
@@ -171,7 +186,7 @@
171
186
  )
172
187
  }}</v-btn
173
188
  >
174
- <v-btn color="primary" outlined>
189
+ <v-btn color="primary" text>
175
190
  <v-icon>mdi-share</v-icon>
176
191
  {{
177
192
  $t(
@@ -199,6 +214,7 @@
199
214
  </template>
200
215
  <script>
201
216
  import _ from 'lodash'
217
+ import Crypto from '~/helpers/Crypto'
202
218
  import TextEditor from '~/components/Text/TextEditor'
203
219
  import TextViewer from '~/components/Text/TextViewer'
204
220
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
@@ -231,7 +247,12 @@ export default {
231
247
  if (_.isEmpty(this.block.metadata.config.activeEmail)) {
232
248
  this.block.metadata.config.activeEmail = 0
233
249
  }
234
- this.block.body = 'emails'
250
+ if (_.isEmpty(this.block.metadata.config.selectedPanels)) {
251
+ this.block.metadata.config.selectedPanels = 0
252
+ }
253
+ this.block.body = this.$t(
254
+ 'windward.core.components.content.blocks.email.title'
255
+ )
235
256
  },
236
257
  data() {
237
258
  return {
@@ -240,18 +261,34 @@ export default {
240
261
  }
241
262
  },
242
263
  watch: {
243
- render() {
244
- if (this.render) {
264
+ render(newValue) {
265
+ if (newValue) {
245
266
  this.block.metadata.config.emails.forEach((element) => {
246
- element.expand = false
267
+ element.tinymce_expand = false
247
268
  })
248
269
  this.selectedPanels =
249
270
  this.block.metadata.config.emails.length - 1
271
+ } else {
272
+ // when in editing mode first panel opens initially
273
+ this.selectedPanels = 0
274
+ }
275
+ },
276
+ value(newValue) {
277
+ if (
278
+ !this.render &&
279
+ this.selectedPanels !== newValue.metadata.config.selectedPanels
280
+ ) {
281
+ // update editing content block
282
+ this.selectedPanels = newValue.metadata.config.selectedPanels
283
+ this.expansionPanelKey = Crypto.id()
250
284
  }
251
285
  },
252
286
  },
253
287
  mounted() {
254
- this.selectedPanels = this.block.metadata.config.emails.length - 1
288
+ this.selectedPanels =
289
+ this.block.metadata.config.emails.length === 0
290
+ ? this.block.metadata.config.emails.length
291
+ : this.block.metadata.config.emails.length - 1
255
292
  },
256
293
  methods: {
257
294
  onRemoveTags(body) {
@@ -282,7 +319,7 @@ export default {
282
319
  .v-expansion-panel {
283
320
  border: 1px solid var(--v-primary-base);
284
321
  }
285
- @media only screen and (max-width: 1264px) {
322
+ @media only screen and (max-width: 800px) {
286
323
  .container-body-preview {
287
324
  display: none !important;
288
325
  }
@@ -297,4 +334,7 @@ export default {
297
334
  .container-header {
298
335
  width: 100%;
299
336
  }
337
+ .v-expansion-panels {
338
+ z-index: 0 !important;
339
+ }
300
340
  </style>
@@ -90,7 +90,8 @@
90
90
  v-if="render && !doesFeedbackExist"
91
91
  >
92
92
  <v-btn
93
- color="error"
93
+ color="primary"
94
+ outlined
94
95
  class="text-center mt-4 mr-2"
95
96
  @click="onReset()"
96
97
  >{{
@@ -186,7 +187,9 @@ export default {
186
187
  if (_.isEmpty(this.block.metadata.config.definition)) {
187
188
  this.block.metadata.config.definition = {}
188
189
  }
189
- this.block.body = 'feedback'
190
+ this.block.body = this.$t(
191
+ 'windward.core.components.content.blocks.feedback.feedback'
192
+ )
190
193
  },
191
194
  data() {
192
195
  return {
@@ -318,14 +321,3 @@ export default {
318
321
  },
319
322
  }
320
323
  </script>
321
- <style scoped>
322
- .question {
323
- font-weight: bold;
324
- }
325
- .radio-group {
326
- width: 100% !important;
327
- }
328
- .likert-radio {
329
- margin-left: 55px;
330
- }
331
- </style>
@@ -78,7 +78,7 @@
78
78
 
79
79
  <script>
80
80
  import _ from 'lodash'
81
- import DialogBox from '~/components/DialogBox'
81
+ import DialogBox from '~/components/DialogBox.vue'
82
82
  import TextViewer from '~/components/Text/TextViewer'
83
83
  import Crypto from '~/helpers/Crypto'
84
84
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
@@ -128,6 +128,10 @@ export default {
128
128
  },
129
129
  imageClass() {
130
130
  let imageClass = ''
131
+ // change cursor to pointer for images that open in larger modal
132
+ if (this.block.metadata.config.modal) {
133
+ imageClass += ' container-pointer'
134
+ }
131
135
  // If NOT hide background, inclide the extra class
132
136
  if (!_.get(this.block.metadata, 'config.hide_background', false)) {
133
137
  imageClass += ' img-white'
@@ -174,6 +178,9 @@ export default {
174
178
  text-align: center;
175
179
  margin-top: -175px;
176
180
  }
181
+ .container-pointer {
182
+ cursor: pointer;
183
+ }
177
184
  ::v-deep .v-skeleton-loader.v-skeleton-loader--is-loading {
178
185
  .v-skeleton-loader__image {
179
186
  height: 100%;
@@ -33,7 +33,9 @@ export default {
33
33
  this.block = {}
34
34
  }
35
35
  if (_.isEmpty(this.block.body)) {
36
- this.block.body = 'Math Editor'
36
+ this.block.body = this.$t(
37
+ 'windward.core.shared.content_blocks.title.math'
38
+ )
37
39
  }
38
40
  if (_.isEmpty(this.block.metadata)) {
39
41
  this.block.metadata = {}
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <div v-if="block.metadata.config.linked.length">
4
- <v-btn color="primary" block @click="onCollate">
4
+ <v-btn color="primary" outlined block @click="onCollate">
5
5
  <v-icon class="mr-3">mdi-file-word</v-icon>
6
6
  {{
7
7
  $t(
@@ -202,7 +202,9 @@ export default {
202
202
  },
203
203
  beforeMount() {
204
204
  // Apply the default config
205
- this.block.body = 'scenario choice'
205
+ this.block.body = this.$t(
206
+ 'windward.core.shared.content_blocks.title.scenario_choice'
207
+ )
206
208
  if (_.isEmpty(this.block.metadata.config.items)) {
207
209
  this.block.metadata.config.items = []
208
210
  }
@@ -49,7 +49,9 @@ export default {
49
49
  },
50
50
  extends: BaseContentBlock,
51
51
  beforeMount() {
52
- this.block.body = 'tab'
52
+ this.block.body = this.$t(
53
+ 'windward.core.shared.content_blocks.title.tab'
54
+ )
53
55
  if (_.isEmpty(this.block.metadata.config.items)) {
54
56
  const defaultObject = {
55
57
  tabHeader: '',
@@ -57,10 +57,10 @@
57
57
  "
58
58
  ></FileDropZone>
59
59
 
60
- <v-container class="primary lighten-1 text-center">
60
+ <v-container class="text-center">
61
61
  <v-btn
62
62
  :disabled="!canUpload || loading"
63
- color="success"
63
+ color="primary"
64
64
  class="text-center"
65
65
  @click="handleUpload"
66
66
  >
@@ -119,7 +119,9 @@ export default {
119
119
  this.block = {}
120
120
  }
121
121
  if (_.isEmpty(this.block.body)) {
122
- this.block.body = 'user uplaod'
122
+ this.block.body = this.$t(
123
+ 'windward.core.shared.content_blocks.title.user_upload'
124
+ )
123
125
  }
124
126
  if (_.isEmpty(this.block.metadata)) {
125
127
  this.block.metadata = {}
@@ -10,11 +10,9 @@
10
10
  </p>
11
11
  <SortableExpansionPanel
12
12
  v-model="block.metadata.config.items"
13
- v-bind:currentPanel.sync="
14
- block.metadata.config.currentAccordion
15
- "
16
13
  @click:close="onRemoveElement($event)"
17
14
  @change="onDragged"
15
+ @update:currentPanel="onUpdatePanel"
18
16
  >
19
17
  <template #header="{ item }">{{
20
18
  item.header
@@ -26,16 +24,17 @@
26
24
  <template #body="{ index }">
27
25
  <v-container :key="expansionPanelKey">
28
26
  <v-text-field
29
- outlined
30
- :autofocus="true"
31
27
  v-model="
32
28
  block.metadata.config.items[index].header
33
29
  "
30
+ :autofocus="true"
31
+ outlined
34
32
  :label="
35
33
  $t(
36
34
  'windward.core.shared.settings.title.title'
37
35
  )
38
36
  "
37
+ @focus="onTextAreaFocus"
39
38
  ></v-text-field>
40
39
  <v-btn
41
40
  @click="
@@ -43,12 +42,14 @@
43
42
  block.metadata.config.items[index]
44
43
  )
45
44
  "
45
+ text
46
46
  >
47
47
  <v-icon
48
48
  v-if="
49
49
  !block.metadata.config.items[index]
50
50
  .expand
51
51
  "
52
+ color="primary"
52
53
  >mdi-arrow-expand-all</v-icon
53
54
  >
54
55
  <v-icon
@@ -56,6 +57,7 @@
56
57
  block.metadata.config.items[index]
57
58
  .expand
58
59
  "
60
+ color="primary"
59
61
  >
60
62
  mdi-arrow-collapse-all
61
63
  </v-icon>
@@ -67,6 +69,11 @@
67
69
  v-model="
68
70
  block.metadata.config.items[index].content
69
71
  "
72
+ :label="
73
+ $t(
74
+ 'windward.core.components.settings.accordion.label'
75
+ )
76
+ "
70
77
  ></TextEditor>
71
78
  </v-container>
72
79
  </template>
@@ -131,11 +138,8 @@ export default {
131
138
  this.block.metadata.config.items = []
132
139
  this.block.metadata.config.items.push(defaultObject)
133
140
  }
134
- if (_.isEmpty(this.block.metadata.config.currentAccordion)) {
135
- this.block.metadata.config.currentAccordion = 0
136
- }
137
141
  this.block.body = this.$t(
138
- 'windward.core.components.settings.accordion.accordion'
142
+ 'windward.core.shared.content_blocks.title.accordion'
139
143
  )
140
144
  },
141
145
  data() {
@@ -150,8 +154,20 @@ export default {
150
154
  clearTimeout(this.debouncer)
151
155
  }
152
156
  },
153
-
157
+ mounted() {
158
+ this.block.metadata.config.selectedPanels = 0
159
+ },
154
160
  methods: {
161
+ onUpdatePanel($event) {
162
+ if ($event !== this.block.metadata.config.selectedPanels) {
163
+ //catch click event to open selected panel to edit
164
+ this.block.metadata.config.selectedPanels = $event
165
+ } else {
166
+ // if user clicks same panel again expansion panel closes
167
+ // setting selected to null will close content blocks expansion panels
168
+ this.block.metadata.config.selectedPanels = null
169
+ }
170
+ },
155
171
  onAddElement() {
156
172
  const default_item = {
157
173
  header: '',
@@ -159,7 +175,7 @@ export default {
159
175
  content: '',
160
176
  }
161
177
  this.block.metadata.config.items.push(default_item)
162
- this.block.metadata.config.currentAccordion =
178
+ this.block.metadata.config.selectedPanels =
163
179
  this.block.metadata.config.items.length - 1
164
180
  },
165
181
  onRemoveElement(index) {
@@ -173,6 +189,13 @@ export default {
173
189
  onDragged() {
174
190
  // need to remount body after dragged to update the content body on the element
175
191
  this.expansionPanelKey = Crypto.id()
192
+ //close all panels on drag, leaving them open confuses the tracking as indexes changes around
193
+ this.block.metadata.config.selectedPanels = null
194
+ },
195
+ onTextAreaFocus($event) {
196
+ // prevent focus error that is happening on text field because of last pass
197
+ $event.preventDefault()
198
+ $event.stopPropagation()
176
199
  },
177
200
  },
178
201
  }
@@ -117,7 +117,7 @@ export default {
117
117
  }
118
118
  }
119
119
  this.block.body = this.$t(
120
- 'windward.core.shared.settings.title.block_quote'
120
+ 'windward.core.components.content.blocks.block_quote.body'
121
121
  )
122
122
  },
123
123
  data() {
@@ -171,7 +171,7 @@ export default {
171
171
  this.block = {}
172
172
  }
173
173
  if (_.isEmpty(this.block.body)) {
174
- this.block.body = 'clickable icons'
174
+ this.block.body = this.$t('windward.core.shared.content_blocks.title.clickable_icons')
175
175
  }
176
176
  if (_.isEmpty(this.block.metadata)) {
177
177
  this.block.metadata = {}