@fy-/fws-vue 2.3.32 → 2.3.34

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.
@@ -265,18 +265,40 @@ function focusInput() {
265
265
  const handlePaste = useDebounceFn((e: ClipboardEvent) => {
266
266
  if (!textInput.value || isMaxReached.value) return
267
267
 
268
+ // Prevent the default paste behavior
269
+ e.preventDefault()
270
+
268
271
  const clipboardData = e.clipboardData ?? (window as any).clipboardData
269
272
  if (!clipboardData) return
270
273
 
271
274
  const text = clipboardData.getData('text')
272
275
  if (!text.trim()) return
273
276
 
277
+ // Replace all instances of separators with a standard comma
274
278
  const pasteText = text.replace(getSeparatorRegex(true), ',')
275
279
 
276
- // Set the text content directly, rather than appending
277
- textInput.value.textContent = pasteText
278
- e.preventDefault()
279
- addTag()
280
+ // Insert the text at the cursor position
281
+ const selection = window.getSelection()
282
+ if (selection && selection.rangeCount > 0) {
283
+ const range = selection.getRangeAt(0)
284
+ range.deleteContents()
285
+ range.insertNode(document.createTextNode(pasteText))
286
+
287
+ // Set cursor position to the end of the inserted text
288
+ range.setStartAfter(range.endContainer)
289
+ range.collapse(true)
290
+ selection.removeAllRanges()
291
+ selection.addRange(range)
292
+ }
293
+ else {
294
+ // Fallback if no selection: just set the content
295
+ textInput.value.textContent = pasteText
296
+ }
297
+
298
+ // Process the tags after a short delay to ensure DOM is updated
299
+ setTimeout(() => {
300
+ addTag()
301
+ }, 10)
280
302
  }, 50)
281
303
 
282
304
  /**
@@ -46,8 +46,8 @@ function processImageUrl(image: string | undefined, imageType: string | undefine
46
46
  }
47
47
 
48
48
  // Helper function to normalize image type
49
- function normalizeImageType(imageType: string | undefined): 'image/jpeg' | 'image/gif' | 'image/png' | false {
50
- if (!imageType) return false
49
+ function normalizeImageType(imageType: string | undefined): 'image/jpeg' | 'image/gif' | 'image/png' | null {
50
+ if (!imageType) return null
51
51
 
52
52
  const type = imageType.includes('image/') ? imageType : `image/${imageType}`
53
53
  if (type === 'image/jpeg' || type === 'image/gif' || type === 'image/png') {
@@ -72,7 +72,10 @@ export function useSeo(seoData: Ref<LazyHead>, initial: boolean = false) {
72
72
  // Memoize common values
73
73
  const localeForOg = computed(() => currentLocale?.replace('-', '_'))
74
74
  const imageUrl = computed(() => processImageUrl(seoData.value.image, seoData.value.imageType))
75
- const imageType = computed(() => normalizeImageType(seoData.value.imageType))
75
+ const imageType = computed(() => {
76
+ const type = normalizeImageType(seoData.value.imageType)
77
+ return type === null ? undefined : type
78
+ })
76
79
  const imageAlt = computed(() => seoData.value.image ? seoData.value.title : undefined)
77
80
 
78
81
  useHead({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "2.3.32",
3
+ "version": "2.3.34",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/fy-to/FWJS#readme",