@saooti/octopus-sdk 40.2.19 → 41.0.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.
Files changed (214) hide show
  1. package/index.ts +2 -1
  2. package/package.json +4 -3
  3. package/src/App.vue +71 -95
  4. package/src/components/composable/player/usePlayerLive.ts +13 -4
  5. package/src/components/composable/player/usePlayerLogic.ts +6 -6
  6. package/src/components/composable/player/usePlayerVast.ts +7 -7
  7. package/src/components/composable/podcasts/usePodcastView.ts +3 -3
  8. package/src/components/composable/route/useAdvancedParamInit.ts +1 -1
  9. package/src/components/composable/route/useRouteUpdateParams.ts +4 -4
  10. package/src/components/composable/route/useSimplePageParam.ts +15 -8
  11. package/src/components/composable/useInit.ts +2 -2
  12. package/src/components/composable/useMetaTitleWatch.ts +2 -2
  13. package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
  14. package/src/components/display/categories/CategoryChooser.vue +144 -145
  15. package/src/components/display/categories/CategoryFilter.vue +172 -198
  16. package/src/components/display/categories/CategoryList.vue +122 -147
  17. package/src/components/display/comments/CommentInput.vue +100 -122
  18. package/src/components/display/comments/CommentList.vue +169 -191
  19. package/src/components/display/comments/CommentName.vue +35 -45
  20. package/src/components/display/comments/CommentParentInfo.vue +28 -34
  21. package/src/components/display/comments/CommentPlayer.vue +38 -50
  22. package/src/components/display/comments/CommentSection.vue +85 -103
  23. package/src/components/display/comments/item/CommentBasicView.vue +48 -61
  24. package/src/components/display/comments/item/CommentItem.vue +104 -115
  25. package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
  26. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
  27. package/src/components/display/comments/like/LikeButton.vue +36 -41
  28. package/src/components/display/comments/like/LikeSection.vue +128 -136
  29. package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
  30. package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
  31. package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
  32. package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
  33. package/src/components/display/edit/EditBox.vue +9 -8
  34. package/src/components/display/edit/EditBoxRadio.vue +1 -5
  35. package/src/components/display/emission/EmissionInlineList.vue +82 -97
  36. package/src/components/display/emission/EmissionItem.vue +57 -69
  37. package/src/components/display/emission/EmissionList.vue +189 -218
  38. package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
  39. package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
  40. package/src/components/display/emission/EmissionPresentationList.vue +51 -61
  41. package/src/components/display/filter/AdvancedSearch.vue +151 -176
  42. package/src/components/display/filter/CategorySearchFilter.vue +43 -46
  43. package/src/components/display/filter/DateFilter.vue +76 -91
  44. package/src/components/display/filter/MonetizableFilter.vue +27 -30
  45. package/src/components/display/filter/ProductorSearch.vue +87 -90
  46. package/src/components/display/filter/RubriqueChoice.vue +58 -63
  47. package/src/components/display/filter/RubriqueFilter.vue +154 -169
  48. package/src/components/display/filter/SearchOrder.vue +35 -35
  49. package/src/components/display/list/ListPaginate.vue +72 -93
  50. package/src/components/display/list/PaginateParams.vue +36 -40
  51. package/src/components/display/list/PaginateSection.vue +113 -124
  52. package/src/components/display/list/SwiperList.vue +97 -109
  53. package/src/components/display/live/CountDown.vue +15 -9
  54. package/src/components/display/live/CountdownOctopus.vue +16 -10
  55. package/src/components/display/live/LiveHorizontalList.vue +95 -103
  56. package/src/components/display/live/LiveItem.vue +64 -73
  57. package/src/components/display/live/LiveList.vue +125 -137
  58. package/src/components/display/live/RadioCurrently.vue +66 -73
  59. package/src/components/display/live/RadioImage.vue +39 -50
  60. package/src/components/display/live/RadioItem.vue +9 -14
  61. package/src/components/display/live/RadioList.vue +39 -53
  62. package/src/components/display/live/RadioPlanning.vue +210 -222
  63. package/src/components/display/organisation/OrganisationChooser.vue +116 -122
  64. package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
  65. package/src/components/display/participant/ParticipantInlineList.vue +42 -58
  66. package/src/components/display/participant/ParticipantItem.vue +66 -74
  67. package/src/components/display/participant/ParticipantList.vue +116 -141
  68. package/src/components/display/playlist/PlaylistItem.vue +33 -46
  69. package/src/components/display/playlist/PlaylistList.vue +115 -144
  70. package/src/components/display/playlist/PodcastList.vue +90 -103
  71. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
  72. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
  73. package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
  74. package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
  75. package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
  76. package/src/components/display/podcasts/PodcastFilterList.vue +62 -56
  77. package/src/components/display/podcasts/PodcastImage.vue +96 -99
  78. package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
  79. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
  80. package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
  81. package/src/components/display/podcasts/PodcastItem.vue +48 -63
  82. package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
  83. package/src/components/display/podcasts/PodcastList.vue +182 -206
  84. package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
  85. package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
  86. package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
  87. package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
  88. package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
  89. package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
  90. package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
  91. package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
  92. package/src/components/display/podcasts/TagList.vue +48 -50
  93. package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
  94. package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
  95. package/src/components/display/rubriques/RubriqueList.vue +140 -160
  96. package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
  97. package/src/components/display/sharing/FormatSwitch.vue +16 -11
  98. package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
  99. package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
  100. package/src/components/display/sharing/PlayerParameters.vue +69 -71
  101. package/src/components/display/sharing/QrCode.vue +55 -67
  102. package/src/components/display/sharing/ShareAnonymous.vue +160 -178
  103. package/src/components/display/sharing/ShareDistribution.vue +103 -117
  104. package/src/components/display/sharing/ShareNewsletter.vue +154 -161
  105. package/src/components/display/sharing/SharePlayer.vue +273 -295
  106. package/src/components/display/sharing/SharePlayerColors.vue +25 -16
  107. package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
  108. package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
  109. package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
  110. package/src/components/display/sharing/SubscribeButtons.vue +184 -207
  111. package/src/components/display/studio/RecordingItemButton.vue +1 -4
  112. package/src/components/form/ClassicCheckbox.vue +26 -30
  113. package/src/components/form/ClassicContentEditable.vue +37 -33
  114. package/src/components/form/ClassicCopyButton.vue +40 -44
  115. package/src/components/form/ClassicDatePicker.vue +114 -114
  116. package/src/components/form/ClassicEmojiPicker.vue +20 -28
  117. package/src/components/form/ClassicInputText.vue +116 -120
  118. package/src/components/form/ClassicLoading.vue +7 -12
  119. package/src/components/form/ClassicMultiselect.vue +115 -117
  120. package/src/components/form/ClassicRadio.vue +21 -16
  121. package/src/components/form/ClassicRadioLabel.vue +23 -22
  122. package/src/components/form/ClassicSearch.vue +24 -19
  123. package/src/components/form/ClassicSelect.vue +47 -38
  124. package/src/components/form/ClassicWysiwyg.vue +116 -123
  125. package/src/components/icons/AmazonMusicIcon.vue +7 -10
  126. package/src/components/icons/ApplePodcastIcon.vue +7 -11
  127. package/src/components/icons/BlueSkyIcon.vue +8 -11
  128. package/src/components/icons/DeezerIcon.vue +8 -11
  129. package/src/components/icons/EditFtpIcon.vue +8 -11
  130. package/src/components/icons/IHeartIcon.vue +8 -11
  131. package/src/components/icons/PlayVideoIcon.vue +7 -10
  132. package/src/components/icons/PlayerFmIcon.vue +7 -10
  133. package/src/components/icons/PocketCastIcon.vue +8 -11
  134. package/src/components/icons/PodcastAddictIcon.vue +7 -10
  135. package/src/components/icons/RadiolineIcon.vue +8 -11
  136. package/src/components/icons/TuninIcon.vue +8 -11
  137. package/src/components/icons/XIcon.vue +7 -10
  138. package/src/components/misc/AcpmImage.vue +6 -7
  139. package/src/components/misc/ClassicAccordion.vue +26 -31
  140. package/src/components/misc/ClassicLazy.vue +86 -90
  141. package/src/components/misc/ClassicNav.vue +16 -20
  142. package/src/components/misc/ClassicPopover.vue +271 -282
  143. package/src/components/misc/ClassicSpinner.vue +5 -27
  144. package/src/components/misc/ErrorMessage.vue +11 -12
  145. package/src/components/misc/FooterGarSection.vue +33 -41
  146. package/src/components/misc/FooterSection.vue +94 -131
  147. package/src/components/misc/HomeDropdown.vue +83 -105
  148. package/src/components/misc/MobileMenu.vue +101 -111
  149. package/src/components/misc/ProgressBar.vue +53 -62
  150. package/src/components/misc/TopBar.vue +98 -120
  151. package/src/components/misc/TopBarMainContent.vue +114 -133
  152. package/src/components/misc/modal/ClassicModal.vue +40 -33
  153. package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
  154. package/src/components/misc/modal/ClipboardModal.vue +27 -30
  155. package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
  156. package/src/components/misc/modal/MessageModal.vue +50 -47
  157. package/src/components/misc/modal/NewsletterModal.vue +30 -31
  158. package/src/components/misc/modal/QrCodeModal.vue +21 -21
  159. package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
  160. package/src/components/misc/player/PlayerCompact.vue +6 -4
  161. package/src/components/misc/player/PlayerComponent.vue +8 -9
  162. package/src/components/misc/player/PlayerLarge.vue +9 -8
  163. package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
  164. package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
  165. package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
  166. package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
  167. package/src/components/misc/player/elements/PlayerImage.vue +51 -57
  168. package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
  169. package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
  170. package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
  171. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
  172. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
  173. package/src/components/misc/player/radio/RadioHistory.vue +80 -99
  174. package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
  175. package/src/components/misc/player/video/PlayerVideo.vue +27 -40
  176. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
  177. package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
  178. package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
  179. package/src/components/pages/CategoryPage.vue +28 -33
  180. package/src/components/pages/EmissionPage.vue +113 -132
  181. package/src/components/pages/EmissionsPage.vue +2 -0
  182. package/src/components/pages/Error403Page.vue +21 -20
  183. package/src/components/pages/HomePage.vue +91 -100
  184. package/src/components/pages/LivesPage.vue +35 -37
  185. package/src/components/pages/MapPage.vue +209 -241
  186. package/src/components/pages/PageLogout.vue +8 -11
  187. package/src/components/pages/PageNotFound.vue +9 -5
  188. package/src/components/pages/ParticipantPage.vue +96 -110
  189. package/src/components/pages/ParticipantsPage.vue +3 -0
  190. package/src/components/pages/PlaylistPage.vue +112 -117
  191. package/src/components/pages/PlaylistsPage.vue +9 -2
  192. package/src/components/pages/PodcastPage.vue +224 -238
  193. package/src/components/pages/PodcastsPage.vue +9 -2
  194. package/src/components/pages/RadioPage.vue +56 -70
  195. package/src/components/pages/RubriquePage.vue +7 -3
  196. package/src/components/pages/SearchPage.vue +31 -36
  197. package/src/components/pages/TagPage.vue +11 -9
  198. package/src/components/pages/VideoPage.vue +14 -11
  199. package/src/helper/displayHelper.ts +1 -1
  200. package/src/helper/loadScript.ts +4 -4
  201. package/src/i18n.ts +2 -2
  202. package/src/main.ts +1 -1
  203. package/src/router/router.ts +17 -4
  204. package/src/stores/AuthStore.ts +12 -12
  205. package/src/stores/FilterStore.ts +1 -1
  206. package/src/stores/VastStore.ts +2 -2
  207. package/src/stores/class/general/player.ts +1 -0
  208. package/public/css/fonts/icomoon.eot +0 -0
  209. package/public/css/fonts/icomoon.svg +0 -113
  210. package/public/css/fonts/icomoon.ttf +0 -0
  211. package/public/css/fonts/icomoon.woff +0 -0
  212. package/public/css/fonts/icomoon.woff2 +0 -0
  213. package/public/css/fonts/style.css +0 -352
  214. package/sonarqube-scanner.js +0 -10
@@ -7,33 +7,34 @@
7
7
  :options="options"
8
8
  :text-init="textInit"
9
9
  :is-column="isColumn"
10
- @update:text-init="$emit('update:textInit', $event)"
10
+ @update:text-init="onChange($event)"
11
11
  />
12
12
  </component>
13
13
  </template>
14
14
 
15
- <script lang="ts">
16
- import { defineComponent } from "vue";
15
+ <script setup lang="ts">
17
16
  import ClassicRadio from "./ClassicRadio.vue";
18
- export default defineComponent({
19
- name: "ClassicRadioLabel",
20
- components:{
21
- ClassicRadio
22
- },
23
17
 
24
- props: {
25
- idRadio: { default: "", type: String },
26
- isDisabled: { default: false, type: Boolean },
27
- options: {
28
- default: () => [],
29
- type: Array as () => Array<{ title: string; value: string | undefined }>,
30
- },
31
- textInit: { default: undefined, type: String },
32
- isColumn: { default: true, type: Boolean },
33
- radioLabel: { default: undefined, type: String },
34
- classLabel: { default: "form-label", type: String },
35
- typeTag: { default: "div", type: String },
18
+ //Props
19
+ defineProps({
20
+ idRadio: { default: "", type: String },
21
+ isDisabled: { default: false, type: Boolean },
22
+ options: {
23
+ default: () => [],
24
+ type: Array as () => Array<{ title: string; value: string | undefined }>,
36
25
  },
37
- emits: ["update:textInit"]
38
- });
26
+ textInit: { default: undefined, type: String },
27
+ isColumn: { default: true, type: Boolean },
28
+ radioLabel: { default: undefined, type: String },
29
+ classLabel: { default: "form-label", type: String },
30
+ typeTag: { default: "div", type: String },
31
+ })
32
+
33
+ //Emits
34
+ const emit = defineEmits(["update:textInit"]);
35
+
36
+ //Methods
37
+ function onChange(value:string){
38
+ emit('update:textInit', value)
39
+ }
39
40
  </script>
@@ -8,14 +8,14 @@
8
8
  class="search-input w-100 p-2"
9
9
  :placeholder="label"
10
10
  :autofocus="autofocus"
11
- @input="$emit('update:textInit', $event.target.value)"
11
+ @input="onChange($event.target.value)"
12
12
  />
13
13
  <label :for="idSearch" :title="label" />
14
14
  <button
15
15
  class="btn-transparent search-icon-container"
16
16
  :disabled="!textInit"
17
- :title="!textInit ? $t('Search') : $t('Clear search')"
18
- @click="$emit('update:textInit', '')"
17
+ :title="!textInit ? t('Search') : t('Clear search')"
18
+ @click="onChange('')"
19
19
  >
20
20
  <MagnifyIcon v-if="!textInit" />
21
21
  <WindowCloseIcon v-else />
@@ -23,25 +23,30 @@
23
23
  </div>
24
24
  </template>
25
25
 
26
- <script lang="ts">
26
+ <script setup lang="ts">
27
27
  import MagnifyIcon from "vue-material-design-icons/Magnify.vue";
28
28
  import WindowCloseIcon from "vue-material-design-icons/WindowClose.vue";
29
- import { defineComponent } from "vue";
30
- export default defineComponent({
31
- name: "ClassicSearch",
32
- components: {
33
- MagnifyIcon,
34
- WindowCloseIcon,
35
- },
36
- props: {
37
- idSearch: { default: "", type: String },
38
- label: { default: "", type: String },
39
- textInit: { default: "", type: String },
40
- autofocus: { default: false, type: Boolean },
41
- },
29
+ import { useI18n } from "vue-i18n";
30
+
31
+ //Props
32
+ defineProps({
33
+ idSearch: { default: "", type: String },
34
+ label: { default: "", type: String },
35
+ textInit: { default: "", type: String },
36
+ autofocus: { default: false, type: Boolean },
37
+ })
38
+
39
+ //Emits
40
+ const emit = defineEmits(["update:textInit"]);
41
+
42
+ //Composables
43
+ const { t } = useI18n();
44
+
45
+ //Methods
46
+ function onChange(value:string){
47
+ emit('update:textInit', value)
48
+ }
42
49
 
43
- emits: ["update:textInit"],
44
- });
45
50
  </script>
46
51
  <style lang="scss">
47
52
 
@@ -3,7 +3,7 @@
3
3
  <label v-show="displayLabel" :for="idSelect" :class="classLabel">{{
4
4
  label
5
5
  }}
6
- <AsteriskIcon v-if="displayRequired" :size="10" class="ms-1 mb-2" :title="$t('Mandatory input')"/></label>
6
+ <AsteriskIcon v-if="displayRequired" :size="10" class="ms-1 mb-2" :title="t('Mandatory input')"/></label>
7
7
  <select
8
8
  :id="idSelect"
9
9
  :value="textInit"
@@ -13,7 +13,7 @@
13
13
  :style="getFontFamily"
14
14
  :aria-label="label"
15
15
  :required="displayRequired"
16
- @change="$emit('update:textInit', $event.target.value)"
16
+ @change="onChange($event.target.value)"
17
17
  >
18
18
  <option v-if="placeholder" value="" disabled selected>{{ placeholder }}</option>
19
19
  <option
@@ -28,16 +28,14 @@
28
28
  </select>
29
29
  </div>
30
30
  </template>
31
- <script lang="ts">
31
+ <script setup lang="ts">
32
32
  import AsteriskIcon from "vue-material-design-icons/Asterisk.vue";
33
- import { defineComponent } from "vue";
34
- export default defineComponent({
35
- name: "ClassicSelect",
36
- components:{
37
- AsteriskIcon
38
- },
39
- props: {
40
- idSelect: { default: "", type: String },
33
+ import { computed } from "vue";
34
+ import { useI18n } from "vue-i18n";
35
+
36
+ //Props
37
+ const props = defineProps({
38
+ idSelect: { default: "", type: String },
41
39
  label: { default: "", type: String },
42
40
  displayLabel: { default: true, type: Boolean },
43
41
  transparent: { default: false, type: Boolean },
@@ -61,35 +59,46 @@ export default defineComponent({
61
59
  orderOptions: { default: true, type: Boolean},
62
60
  placeholder: { default: undefined, type: String},
63
61
  displayRequired: { default: false, type: Boolean },
64
- },
65
- emits: ["update:textInit"],
66
- computed: {
67
- getFontFamily(): string {
68
- const item = this.options.find((x) => {
69
- return this.textInit === x.value;
70
- });
71
- if (item?.fontFamily) {
72
- return "font-family:" + item.fontFamily;
73
- }
74
- return "";
75
- },
76
- optionsOrder(){
77
- const optionsOrdered = Array.from(this.options);
78
- if(this.orderOptions){
79
- optionsOrdered.sort((a,b) => {
80
- if(a.title > b.title){
81
- return 1;
82
- }
83
- return (b.title > a.title) ? -1 : 0
84
- });
85
- }
86
- if(this.topOption){
87
- optionsOrdered.unshift(this.topOption);
62
+ })
63
+
64
+
65
+ //Emits
66
+ const emit = defineEmits(["update:textInit"]);
67
+
68
+ //Composables
69
+ const { t } = useI18n();
70
+
71
+
72
+ //Computed
73
+ const getFontFamily = computed(() => {
74
+ const item = props.options.find((x) => {
75
+ return props.textInit === x.value;
76
+ });
77
+ if (item?.fontFamily) {
78
+ return "font-family:" + item.fontFamily;
79
+ }
80
+ return "";
81
+ });
82
+ const optionsOrder = computed(() => {
83
+ const optionsOrdered = Array.from(props.options);
84
+ if(props.orderOptions){
85
+ optionsOrdered.sort((a,b) => {
86
+ if(a.title > b.title){
87
+ return 1;
88
88
  }
89
- return optionsOrdered;
90
- }
91
- },
89
+ return (b.title > a.title) ? -1 : 0
90
+ });
91
+ }
92
+ if(props.topOption){
93
+ optionsOrdered.unshift(props.topOption);
94
+ }
95
+ return optionsOrdered;
92
96
  });
97
+
98
+ //Methods
99
+ function onChange(value:string){
100
+ emit('update:textInit', value)
101
+ }
93
102
  </script>
94
103
  <style lang="scss">
95
104
 
@@ -2,7 +2,7 @@
2
2
  <div class="wysiwyg-editor">
3
3
  <div v-if="editor" class="editor-menubar">
4
4
  <button
5
- :title="$t('Bold')"
5
+ :title="t('Bold')"
6
6
  data-selenium="Bold"
7
7
  :class="{ 'is-active': editor.isActive('bold') }"
8
8
  @click="editor.chain().focus().toggleBold().run()"
@@ -10,7 +10,7 @@
10
10
  <FormatBoldIcon />
11
11
  </button>
12
12
  <button
13
- :title="$t('Italic')"
13
+ :title="t('Italic')"
14
14
  data-selenium="Italic"
15
15
  :class="{ 'is-active': editor.isActive('italic') }"
16
16
  @click="editor.chain().focus().toggleItalic().run()"
@@ -18,7 +18,7 @@
18
18
  <FormatItalicIcon />
19
19
  </button>
20
20
  <button
21
- :title="$t('Underline')"
21
+ :title="t('Underline')"
22
22
  data-selenium="Underline"
23
23
  :class="{ 'is-active': editor.isActive('underline') }"
24
24
  @click="editor.chain().focus().toggleUnderline().run()"
@@ -26,7 +26,7 @@
26
26
  <FormatUnderlineIcon />
27
27
  </button>
28
28
  <button
29
- :title="$t('Link')"
29
+ :title="t('Link')"
30
30
  data-selenium="link"
31
31
  :class="{ 'is-active': editor.isActive('link') }"
32
32
  @click="setLink"
@@ -34,7 +34,7 @@
34
34
  <LinkVariantIcon />
35
35
  </button>
36
36
  <button
37
- :title="$t('Delete link')"
37
+ :title="t('Delete link')"
38
38
  data-selenium="unlink"
39
39
  :disabled="!editor.isActive('link')"
40
40
  @click="editor.chain().focus().unsetLink().run()"
@@ -42,7 +42,7 @@
42
42
  <LinkVariantOffIcon />
43
43
  </button>
44
44
  <button
45
- :title="$t('Heading3')"
45
+ :title="t('Heading3')"
46
46
  data-selenium="Heading3"
47
47
  :class="{ 'is-active': editor.isActive('heading', { level: 3 }) }"
48
48
  @click="editor.chain().focus().toggleHeading({ level: 3 }).run()"
@@ -50,7 +50,7 @@
50
50
  H3
51
51
  </button>
52
52
  <button
53
- :title="$t('Heading4')"
53
+ :title="t('Heading4')"
54
54
  data-selenium="Heading4"
55
55
  :class="{ 'is-active': editor.isActive('heading', { level: 4 }) }"
56
56
  @click="editor.chain().focus().toggleHeading({ level: 4 }).run()"
@@ -58,7 +58,7 @@
58
58
  H4
59
59
  </button>
60
60
  <button
61
- :title="$t('Line break')"
61
+ :title="t('Line break')"
62
62
  data-selenium="lineBreak"
63
63
  @click="editor.chain().focus().setHardBreak().run()"
64
64
  >
@@ -66,7 +66,7 @@
66
66
  </button>
67
67
 
68
68
  <button
69
- :title="$t('UnorderedList')"
69
+ :title="t('UnorderedList')"
70
70
  data-selenium="UnorderedList"
71
71
  :class="{ 'is-active': editor.isActive('bulletList') }"
72
72
  @click="editor.chain().focus().toggleBulletList().run()"
@@ -74,7 +74,7 @@
74
74
  <FormatListBulletedIcon />
75
75
  </button>
76
76
  <button
77
- :title="$t('List')"
77
+ :title="t('List')"
78
78
  data-selenium="List"
79
79
  :class="{ 'is-active': editor.isActive('orderedList') }"
80
80
  @click="editor.chain().focus().toggleOrderedList().run()"
@@ -82,7 +82,7 @@
82
82
  <FormatListNumberedIcon />
83
83
  </button>
84
84
  <button
85
- :title="$t('Display HTML')"
85
+ :title="t('Display HTML')"
86
86
  data-selenium="Display-HTML"
87
87
  class="html-button"
88
88
  :class="{ 'is-active': isHtmlDisplay }"
@@ -111,7 +111,7 @@
111
111
  </div>
112
112
  </template>
113
113
 
114
- <script lang="ts">
114
+ <script setup lang="ts">
115
115
  import FormatBoldIcon from "vue-material-design-icons/FormatBold.vue";
116
116
  import FormatItalicIcon from "vue-material-design-icons/FormatItalic.vue";
117
117
  import FormatUnderlineIcon from "vue-material-design-icons/FormatUnderline.vue";
@@ -126,121 +126,114 @@ import Underline from "@tiptap/extension-underline";
126
126
  import TextStyle from "@tiptap/extension-text-style";
127
127
  import Link from "@tiptap/extension-link";
128
128
  import HardBreak from "@tiptap/extension-hard-break";
129
- import { defineComponent } from "vue";
130
- export default defineComponent({
131
- name: "ClassicWysiwyg",
132
- components: {
133
- EditorContent,
134
- FormatBoldIcon,
135
- FormatItalicIcon,
136
- FormatUnderlineIcon,
137
- LinkVariantIcon,
138
- LinkVariantOffIcon,
139
- KeyboardReturnIcon,
140
- FormatListBulletedIcon,
141
- FormatListNumberedIcon,
142
- },
129
+ import { onMounted, onUnmounted, Ref, ref, watch } from "vue";
130
+ import { useI18n } from "vue-i18n";
143
131
 
144
- props: {
145
- content: { default: undefined, type: String },
146
- errorDescription: { default: false, type: Boolean },
147
- isDisabled: { default: false, type: Boolean },
148
- },
149
- emits: ["update:content"],
150
- data() {
151
- return {
152
- isHtmlDisplay: false as boolean,
153
- html: this.content as string,
154
- editor: null as Editor | null,
155
- };
156
- },
157
- watch: {
158
- content(): void {
159
- if (this.content === this.html) {
160
- return;
161
- }
162
- this.initContent();
163
- },
164
- isDisabled(): void {
165
- if (this.editor) {
166
- this.editor.setOptions({
167
- editable: true !== this.isDisabled,
168
- });
169
- }
170
- },
171
- },
132
+ //Props
133
+ const props = defineProps({
134
+ content: { default: undefined, type: String },
135
+ errorDescription: { default: false, type: Boolean },
136
+ isDisabled: { default: false, type: Boolean },
137
+ })
172
138
 
173
- mounted() {
174
- this.editor = new Editor({
175
- extensions: [
176
- StarterKit,
177
- Underline,
178
- TextStyle,
179
- Link.configure({
180
- openOnClick: false,
181
- }),
182
- HardBreak,
183
- ],
184
- content: "",
185
- editable: true !== this.isDisabled,
186
- onUpdate: this.updateHtml,
187
- });
188
- this.initContent();
189
- },
190
- beforeUnmount() {
191
- if (this.editor) {
192
- this.editor.destroy();
193
- }
194
- },
139
+ //Emits
140
+ const emit = defineEmits(["update:content"]);
195
141
 
196
- methods: {
197
- initContent(): void {
198
- if (undefined !== this.content && this.editor && !this.editor.isFocused) {
199
- this.editor.commands.setContent(this.content);
200
- this.html = this.editor.getHTML();
201
- }
202
- },
203
- updateHtml(): void {
204
- if (!this.editor) {return}
205
- const plainText= this.editor.getText();
206
- const regexHtml = /<(a|b|h3|h4|em|i|li|ol|p|strong|ul|u|br|span).*?/i
207
- if(regexHtml.test(plainText)){
208
- this.editor.commands.setContent(plainText);
209
- }
210
- this.html = this.editor.getHTML().trim();
211
- const htmlHeart = this.html.substring(3, this.html.length - 4);
212
- if (
213
- this.html.startsWith("<p>") &&
214
- this.html.endsWith("</p>") &&
215
- !regexHtml.test(htmlHeart)
216
- ) {
217
- this.html = htmlHeart;
218
- }
219
- this.html = this.html.replaceAll("&nbsp;", " ");
220
- this.$emit("update:content", this.html);
221
- },
222
- setLink() {
223
- if (!this.editor) {
224
- return;
225
- }
226
- const previousUrl = this.editor.getAttributes("link").href;
227
- const url = window.prompt("URL", previousUrl);
228
- if (!url) {
229
- return;
230
- }
231
- if ("" === url) {
232
- this.editor.chain().focus().extendMarkRange("link").unsetLink().run();
233
- return;
234
- }
235
- this.editor
236
- .chain()
237
- .focus()
238
- .extendMarkRange("link")
239
- .setLink({ href: url })
240
- .run();
241
- },
242
- },
142
+ //Data
143
+ const isHtmlDisplay = ref(false);
144
+ const html = ref(props.content);
145
+ const editor: Ref<Editor | null> = ref(null);
146
+
147
+ //Composables
148
+ const { t } = useI18n();
149
+
150
+
151
+ //Watch
152
+ watch(()=>props.content,() => {
153
+ if (props.content === html.value) {
154
+ return;
155
+ }
156
+ initContent();
243
157
  });
158
+ watch(()=>props.isDisabled,() => {
159
+ if (editor.value) {
160
+ editor.value.setOptions({
161
+ editable: true !== props.isDisabled,
162
+ });
163
+ }
164
+ });
165
+
166
+
167
+ onMounted(()=>{
168
+ editor.value = new Editor({
169
+ extensions: [
170
+ StarterKit,
171
+ Underline,
172
+ TextStyle,
173
+ Link.configure({
174
+ openOnClick: false,
175
+ }),
176
+ HardBreak,
177
+ ],
178
+ content: "",
179
+ editable: true !== props.isDisabled,
180
+ onUpdate: updateHtml,
181
+ });
182
+ initContent();
183
+ })
184
+
185
+ onUnmounted(()=>{
186
+ if (editor.value) {
187
+ editor.value.destroy();
188
+ }
189
+ })
190
+
191
+ //Methods
192
+ function initContent(): void {
193
+ if (undefined !== props.content && editor.value && !editor.value.isFocused) {
194
+ editor.value.commands.setContent(props.content);
195
+ html.value = editor.value.getHTML();
196
+ }
197
+ }
198
+ function updateHtml(): void {
199
+ if (!editor.value) {return}
200
+ const plainText= editor.value.getText();
201
+ const regexHtml = /<(a|b|h3|h4|em|i|li|ol|p|strong|ul|u|br|span).*?/i
202
+ if(regexHtml.test(plainText)){
203
+ editor.value.commands.setContent(plainText);
204
+ }
205
+ html.value = editor.value.getHTML().trim();
206
+ const htmlHeart = html.value.substring(3, html.value.length - 4);
207
+ if (
208
+ html.value.startsWith("<p>") &&
209
+ html.value.endsWith("</p>") &&
210
+ !regexHtml.test(htmlHeart)
211
+ ) {
212
+ html.value = htmlHeart;
213
+ }
214
+ html.value = html.value.replaceAll("&nbsp;", " ");
215
+ emit("update:content", html.value);
216
+ }
217
+ function setLink() {
218
+ if (!editor.value) {
219
+ return;
220
+ }
221
+ const previousUrl = editor.value.getAttributes("link").href;
222
+ const url = window.prompt("URL", previousUrl);
223
+ if (!url) {
224
+ return;
225
+ }
226
+ if ("" === url) {
227
+ editor.value.chain().focus().extendMarkRange("link").unsetLink().run();
228
+ return;
229
+ }
230
+ editor.value
231
+ .chain()
232
+ .focus()
233
+ .extendMarkRange("link")
234
+ .setLink({ href: url })
235
+ .run();
236
+ }
244
237
  </script>
245
238
  <style lang="scss">
246
239
 
@@ -81,14 +81,11 @@
81
81
  </span>
82
82
  </template>
83
83
 
84
- <script lang="ts">
85
- import { defineComponent } from "vue";
86
- export default defineComponent({
87
- name: "AmazonMusicIcon",
88
- props: {
89
- size: { default: 24, type: Number },
90
- title: { default: undefined, type: String },
91
- fillColor: { default: "currentColor", type: String },
92
- },
93
- });
84
+ <script setup lang="ts">
85
+ //Props
86
+ defineProps({
87
+ size: { default: 24, type: Number },
88
+ title: { default: undefined, type: String },
89
+ fillColor: { default: "currentColor", type: String },
90
+ })
94
91
  </script>
@@ -28,15 +28,11 @@
28
28
  </svg>
29
29
  </span>
30
30
  </template>
31
-
32
- <script lang="ts">
33
- import { defineComponent } from "vue";
34
- export default defineComponent({
35
- name: "ApplePodcastIcon",
36
- props: {
37
- size: { default: 24, type: Number },
38
- title: { default: undefined, type: String },
39
- fillColor: { default: "currentColor", type: String },
40
- },
41
- });
31
+ <script setup lang="ts">
32
+ //Props
33
+ defineProps({
34
+ size: { default: 24, type: Number },
35
+ title: { default: undefined, type: String },
36
+ fillColor: { default: "currentColor", type: String },
37
+ })
42
38
  </script>
@@ -18,15 +18,12 @@
18
18
  </span>
19
19
  </template>
20
20
 
21
- <script lang="ts">
22
- import { defineComponent } from "vue";
23
- export default defineComponent({
24
- name: "BlueSkyIcon",
25
- props: {
26
- size: { default: 24, type: Number },
27
- title: { default: undefined, type: String },
28
- fillColor: { default: "currentColor", type: String },
29
- },
30
- });
31
- </script>
21
+ <script setup lang="ts">
22
+ //Props
23
+ defineProps({
24
+ size: { default: 24, type: Number },
25
+ title: { default: undefined, type: String },
26
+ fillColor: { default: "currentColor", type: String },
27
+ })
28
+ </script>
32
29
 
@@ -18,14 +18,11 @@
18
18
  </span>
19
19
  </template>
20
20
 
21
- <script lang="ts">
22
- import { defineComponent } from "vue";
23
- export default defineComponent({
24
- name: "DeezerIcon",
25
- props: {
26
- size: { default: 24, type: Number },
27
- title: { default: undefined, type: String },
28
- fillColor: { default: "currentColor", type: String },
29
- },
30
- });
31
- </script>
21
+ <script setup lang="ts">
22
+ //Props
23
+ defineProps({
24
+ size: { default: 24, type: Number },
25
+ title: { default: undefined, type: String },
26
+ fillColor: { default: "currentColor", type: String },
27
+ })
28
+ </script>