@windward/core 0.28.0 → 0.29.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## Release [0.29.0] - 2026-03-11
4
+
5
+ * Merged in feature/LE-2319-preselect-cc-transcript-language (pull request #491)
6
+ * Merged in bugfix/LE-2292-clickable-icon-instructions-fiel (pull request #490)
7
+ * Merged release/0.29.0 into bugfix/LE-2292-clickable-icon-instructions-fiel
8
+ * Merged in feature/LE-2076-matching-game-allow-rich-text-ed (pull request #489)
9
+ * Merged in bugfix/LE-2292-clickable-icon-instructions-fiel (pull request #486)
10
+
11
+
3
12
  ## Release [0.28.0] - 2026-02-18
4
13
 
5
14
  * Merged in feature/LE-2250/open-response-feedback-2 (pull request #485)
@@ -237,9 +237,6 @@ export default {
237
237
  )
238
238
  if (_.isEmpty(this.block.metadata.config.items)) {
239
239
  this.block.metadata.config.items = []
240
- this.block.metadata.config.description = this.$t(
241
- 'windward.core.components.settings.clickable_icon.information'
242
- )
243
240
  }
244
241
  if (_.isEmpty(this.block.metadata.config.title)) {
245
242
  this.block.metadata.config.title = this.$t(
@@ -249,9 +246,6 @@ export default {
249
246
  if (!_.isBoolean(this.block.metadata.config.display_title)) {
250
247
  this.$set(this.block.metadata.config, 'display_title', true)
251
248
  }
252
- if (_.isEmpty(this.block.metadata.config.description)) {
253
- this.block.metadata.config.description = ''
254
- }
255
249
  if (_.isEmpty(this.block.metadata.config.display)) {
256
250
  this.block.metadata.config.display = {
257
251
  show_title: true,
@@ -439,14 +439,15 @@ export default {
439
439
  }
440
440
  }
441
441
 
442
- // 4. Sort tracks: course source language first
442
+ // 4. Sort tracks: current course locale first (target language on translated
443
+ // courses, source language on non-translated courses).
443
444
  allTracks.sort((a, b) => {
444
- if (a.srclang === this.courseSourceLocale) return -1
445
- if (b.srclang === this.courseSourceLocale) return 1
445
+ if (this.srclangMatchesLocale(a.srclang, this.courseCurrentLocale)) return -1
446
+ if (this.srclangMatchesLocale(b.srclang, this.courseCurrentLocale)) return 1
446
447
  return 0
447
448
  })
448
449
 
449
- // 5. Set default on first track (should be source language)
450
+ // 5. Set default on first track (target language for translated courses)
450
451
  if (allTracks.length > 0) {
451
452
  allTracks[0].default = true
452
453
  }
@@ -766,10 +767,25 @@ export default {
766
767
  const langBase = langLower.split('-')[0]
767
768
 
768
769
  // Check if the full language code or its base is in allowedCaptionLocales
769
- return this.allowedCaptionLocales.has(langLower) ||
770
+ return this.allowedCaptionLocales.has(langLower) ||
770
771
  this.allowedCaptionLocales.has(langBase)
771
772
  },
772
773
 
774
+ /**
775
+ * Check whether a srclang code refers to the same language as a locale code.
776
+ * Handles case differences ("PT-BR" vs "pt-br") and DeepL short codes
777
+ * ("ES" matching "es-ES").
778
+ * @param {string} srclang - Track srclang (e.g. "PT-BR", "ES")
779
+ * @param {string} locale - Locale code to match against (e.g. "pt-br", "es-es")
780
+ * @returns {boolean}
781
+ */
782
+ srclangMatchesLocale(srclang, locale) {
783
+ if (!srclang || !locale) return false
784
+ const a = srclang.toLowerCase()
785
+ const b = locale.toLowerCase()
786
+ return a === b || a.split('-')[0] === b.split('-')[0]
787
+ },
788
+
773
789
  /**
774
790
  * Check if the given text has words, omitting HTML tags and HTML entities
775
791
  * @param {string} text - The text to check
@@ -300,10 +300,15 @@ export default {
300
300
  'windward.core.components.settings.clickable_icon.clickable_icon_title'
301
301
  )
302
302
  }
303
- if (_.isEmpty(this.block.metadata.config.instructions)) {
303
+ if (
304
+ _.isEmpty(this.block.metadata.config.instructions) &&
305
+ !this.block.metadata.config.__isInitialized
306
+ ) {
304
307
  this.block.metadata.config.instructions = this.$t(
305
308
  'windward.core.components.settings.clickable_icon.instructions'
306
309
  )
310
+ // save state of initialization so we can allow user to set inputs to empty
311
+ this.$set(this.block.metadata.config, '__isInitialized', true)
307
312
  }
308
313
  if (!_.isBoolean(this.block.metadata.config.display_title)) {
309
314
  this.$set(this.block.metadata.config, 'display_title', true)
@@ -156,6 +156,7 @@ export default {
156
156
  showGlossary: { type: Boolean, required: false, default: false },
157
157
  render: { type: Boolean, required: false, default: false },
158
158
  hideTextEditor: { type: Boolean, required: false, default: false },
159
+ defaultAlignment: { type: String, required: false, default: null },
159
160
  },
160
161
  data() {
161
162
  return {
@@ -165,7 +166,13 @@ export default {
165
166
  paused: false,
166
167
  isRevising: false,
167
168
  rephraseToneIndex: 0,
168
- toneSequence: ['neutral', 'conversational', 'formal', 'succinct', 'encouraging'],
169
+ toneSequence: [
170
+ 'neutral',
171
+ 'conversational',
172
+ 'formal',
173
+ 'succinct',
174
+ 'encouraging',
175
+ ],
169
176
  }
170
177
  },
171
178
 
@@ -356,6 +363,15 @@ export default {
356
363
  value: 'windward-table-subject-report',
357
364
  },
358
365
  ],
366
+ init_instance_callback: (editor) => {
367
+ if (this.defaultAlignment) {
368
+ editor.execCommand(
369
+ 'mceToggleFormat',
370
+ false,
371
+ this.defaultAlignment
372
+ )
373
+ }
374
+ },
359
375
  setup: () => {
360
376
  // Here we can add plugin
361
377
  getTinymce().PluginManager.add(
@@ -579,9 +595,10 @@ export default {
579
595
  return null
580
596
  }
581
597
 
582
- const tone = this.toneSequence[
583
- this.rephraseToneIndex % this.toneSequence.length
584
- ]
598
+ const tone =
599
+ this.toneSequence[
600
+ this.rephraseToneIndex % this.toneSequence.length
601
+ ]
585
602
  this.rephraseToneIndex =
586
603
  (this.rephraseToneIndex + 1) % this.toneSequence.length
587
604
 
@@ -748,12 +765,12 @@ export default {
748
765
  }
749
766
 
750
767
  // Wrap response with temporary markers so we can reselect inserted content
751
- const startId = `ww-revise-start-${this.seed}-${Date.now()}-${Math.random()
752
- .toString(36)
753
- .slice(2)}`
754
- const endId = `ww-revise-end-${this.seed}-${Date.now()}-${Math.random()
755
- .toString(36)
756
- .slice(2)}`
768
+ const startId = `ww-revise-start-${
769
+ this.seed
770
+ }-${Date.now()}-${Math.random().toString(36).slice(2)}`
771
+ const endId = `ww-revise-end-${
772
+ this.seed
773
+ }-${Date.now()}-${Math.random().toString(36).slice(2)}`
757
774
  const wrappedHtml =
758
775
  `<span id="${startId}" data-ww-revise="s"></span>` +
759
776
  responseData.html +
@@ -769,7 +786,10 @@ export default {
769
786
  if (startEl && endEl) {
770
787
  const selectRange = editor.dom.createRng()
771
788
  // Select everything between markers
772
- if (selectRange.setStartAfter && selectRange.setEndBefore) {
789
+ if (
790
+ selectRange.setStartAfter &&
791
+ selectRange.setEndBefore
792
+ ) {
773
793
  selectRange.setStartAfter(startEl)
774
794
  selectRange.setEndBefore(endEl)
775
795
  } else {
@@ -787,15 +807,19 @@ export default {
787
807
  }
788
808
  const startIndex = childIndex(startEl) + 1
789
809
  const endIndex = childIndex(endEl)
790
- selectRange.setStart(startParent, startIndex)
810
+ selectRange.setStart(
811
+ startParent,
812
+ startIndex
813
+ )
791
814
  selectRange.setEnd(endParent, endIndex)
792
815
  }
793
816
  editor.selection.setRng(selectRange)
794
817
 
795
818
  // Remove markers after selection is set
796
- if (startEl.parentNode) startEl.parentNode.removeChild(startEl)
797
- if (endEl.parentNode) endEl.parentNode.removeChild(endEl)
798
-
819
+ if (startEl.parentNode)
820
+ startEl.parentNode.removeChild(startEl)
821
+ if (endEl.parentNode)
822
+ endEl.parentNode.removeChild(endEl)
799
823
  }
800
824
  } catch (_e) {
801
825
  // Ignore selection restoration errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {