codevdesign 1.0.62 → 1.0.63

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.
@@ -17,32 +17,34 @@
17
17
  <script setup lang="ts">
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
19
 
20
- import { computed, ref, watch, nextTick } from 'vue'
21
- import Editor from '@tinymce/tinymce-vue'
20
+ import { computed, ref, watch, nextTick, defineAsyncComponent } from 'vue'
22
21
  import type { Editor as TinyMCEEditor } from 'tinymce'
23
22
 
24
- // Core / skins / thème
25
- import 'tinymce/tinymce.js'
26
- import 'tinymce/icons/default/icons.min.js'
27
- import 'tinymce/themes/silver/theme.min.js'
28
- import 'tinymce/models/dom/model.min.js'
29
- import 'tinymce/skins/ui/oxide/skin.js'
30
- import 'tinymce/skins/ui/oxide/content.js'
31
- import 'tinymce/skins/content/default/content.js'
32
-
33
- // Langue
34
- import 'tinymce-i18n/langs7/fr_FR'
35
-
36
- // Plugins
37
- import 'tinymce/plugins/autoresize/plugin.min.js'
38
- import 'tinymce/plugins/advlist/plugin.min.js'
39
- import 'tinymce/plugins/lists/plugin.min.js'
40
- import 'tinymce/plugins/link/plugin.min.js'
41
- import 'tinymce/plugins/autolink/plugin.min.js'
42
- import 'tinymce/plugins/fullscreen/plugin.min.js'
43
- import 'tinymce/plugins/table/plugin.min.js'
44
- import 'tinymce/plugins/image/plugin.min.js'
45
- import 'tinymce/plugins/code/plugin.min.js'
23
+ // TinyMCE chargé en chunk séparé (code-splitting)
24
+ const Editor = defineAsyncComponent(async () => {
25
+ // Le core doit s'initialiser en premier
26
+ await import('tinymce/tinymce.js')
27
+ // Tout le reste en parallèle
28
+ await Promise.all([
29
+ import('tinymce/icons/default/icons.min.js'),
30
+ import('tinymce/themes/silver/theme.min.js'),
31
+ import('tinymce/models/dom/model.min.js'),
32
+ import('tinymce/skins/ui/oxide/skin.js'),
33
+ import('tinymce/skins/ui/oxide/content.js'),
34
+ import('tinymce/skins/content/default/content.js'),
35
+ import('tinymce-i18n/langs7/fr_FR'),
36
+ import('tinymce/plugins/autoresize/plugin.min.js'),
37
+ import('tinymce/plugins/advlist/plugin.min.js'),
38
+ import('tinymce/plugins/lists/plugin.min.js'),
39
+ import('tinymce/plugins/link/plugin.min.js'),
40
+ import('tinymce/plugins/autolink/plugin.min.js'),
41
+ import('tinymce/plugins/fullscreen/plugin.min.js'),
42
+ import('tinymce/plugins/table/plugin.min.js'),
43
+ import('tinymce/plugins/image/plugin.min.js'),
44
+ import('tinymce/plugins/code/plugin.min.js'),
45
+ ])
46
+ return (await import('@tinymce/tinymce-vue')).default
47
+ })
46
48
 
47
49
  const openLink = (url?: string | null, target?: string | null) => {
48
50
  if (!url) return
@@ -95,8 +97,8 @@
95
97
  const editorReady = ref(true)
96
98
  const editorValue = ref<string>(props.modelValue)
97
99
  const _editor = ref<TinyMCEEditor | null>(null)
98
- const _reinitPending = ref(false)
99
- const _reinitLock = ref(false)
100
+ let _reinitPending = false
101
+ let _reinitLock = false
100
102
 
101
103
  const imageTailleMaxMo = computed<number>(() => {
102
104
  const n = Number(props.imageTailleMaximale)
@@ -166,10 +168,6 @@
166
168
  setup: (editor: TinyMCEEditor) => {
167
169
  _editor.value = editor
168
170
 
169
- editor.on('init', () => {
170
- // init ok
171
- })
172
-
173
171
  // liens cliquables
174
172
  editor.on('click', (e: any) => {
175
173
  const a = e.target?.closest?.('a')
@@ -306,17 +304,17 @@
306
304
 
307
305
  // --- Re-montage TinyMCE si props importantes changent ---
308
306
  const scheduleReinit = () => {
309
- if (_reinitPending.value) return
310
- _reinitPending.value = true
307
+ if (_reinitPending) return
308
+ _reinitPending = true
311
309
  queueMicrotask(async () => {
312
- _reinitPending.value = false
310
+ _reinitPending = false
313
311
  await reinitEditor()
314
312
  })
315
313
  }
316
314
 
317
315
  const reinitEditor = async () => {
318
- if (_reinitLock.value) return
319
- _reinitLock.value = true
316
+ if (_reinitLock) return
317
+ _reinitLock = true
320
318
  try {
321
319
  const ed = _editor.value as any
322
320
  if (ed && typeof ed.remove === 'function') {
@@ -332,7 +330,7 @@
332
330
  editorReady.value = true
333
331
  await nextTick()
334
332
  } finally {
335
- _reinitLock.value = false
333
+ _reinitLock = false
336
334
  }
337
335
  }
338
336
 
@@ -31,9 +31,6 @@ export default {
31
31
  clearCache: false,
32
32
 
33
33
  getAxios(): AxiosInstance {
34
- // Singleton + clearCache
35
- if (client && !this.clearCache) return client
36
-
37
34
  const appStore = useAppStore()
38
35
 
39
36
  const rawUrl = appStore.modeleCharger
@@ -49,7 +46,7 @@ export default {
49
46
  client = axios.create({
50
47
  baseURL: `${urlBase}/api`,
51
48
  withCredentials: true,
52
- timeout: 30_000,
49
+ timeout: 90_000,
53
50
  headers: {
54
51
  Accept: 'application/json',
55
52
  'Content-Type': 'application/json',
@@ -75,7 +72,8 @@ export default {
75
72
  (error: AxiosError<any>) => {
76
73
  const status = error.response?.status
77
74
  const payload = error.response?.data?.resultat ?? { message: error.message }
78
-
75
+ console.log("Status d'erreur : ", status)
76
+ console.log("Contenu d'erreur", payload)
79
77
  // 403 / 404
80
78
  if (status === 403 || status === 404) {
81
79
  try {
@@ -100,8 +98,7 @@ export default {
100
98
 
101
99
  // Remonter l’erreur normalisée dans appstore
102
100
  try {
103
- if (payload?.resultat) appStore.lancerErreur(payload)
104
- else if (payload) appStore.lancerErreur(payload)
101
+ if (payload) appStore.lancerErreur(payload)
105
102
  } catch {
106
103
  // no-op
107
104
  }
@@ -119,7 +119,7 @@ class RafraichisseurToken {
119
119
  // ajax vers le refresh
120
120
  let iframe = document.createElement('iframe')
121
121
  const url = this.getRefreshUrl(urlPortail)
122
- iframe.src = `${url}?urlRetour=${encodeURI(window.localStorage.href)}`
122
+ iframe.src = `${url}?urlRetour=${encodeURI(window.location.href)}`
123
123
  iframe.id = 'idRafrToken'
124
124
  iframe.style.display = 'none'
125
125
  document.body.appendChild(iframe)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codevdesign",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "description": "Composants Vuetify 3 pour les projets Codev",
5
5
  "files": [
6
6
  "./**/*.vue",