@fy-/fws-vue 2.3.34 → 2.3.35
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.
|
@@ -260,46 +260,31 @@ function focusInput() {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* Handle pasting text
|
|
263
|
+
* Handle pasting text - without debounce for direct response
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
function handlePaste(e: ClipboardEvent) {
|
|
266
266
|
if (!textInput.value || isMaxReached.value) return
|
|
267
267
|
|
|
268
268
|
// Prevent the default paste behavior
|
|
269
269
|
e.preventDefault()
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
// Get clipboard data
|
|
272
|
+
const clipboardData = e.clipboardData
|
|
272
273
|
if (!clipboardData) return
|
|
273
274
|
|
|
275
|
+
// Get the pasted text
|
|
274
276
|
const text = clipboardData.getData('text')
|
|
275
|
-
if (!text.trim()) return
|
|
276
|
-
|
|
277
|
-
// Replace all instances of separators with a standard comma
|
|
278
|
-
const pasteText = text.replace(getSeparatorRegex(true), ',')
|
|
279
|
-
|
|
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
|
-
}
|
|
277
|
+
if (!text || !text.trim()) return
|
|
297
278
|
|
|
298
|
-
// Process the
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
279
|
+
// Process the text (replace separator characters)
|
|
280
|
+
const pasteText = text.replace(/[,;]/g, ',')
|
|
281
|
+
|
|
282
|
+
// Simply set the content - the most reliable approach
|
|
283
|
+
textInput.value.textContent = pasteText
|
|
284
|
+
|
|
285
|
+
// Add tags immediately
|
|
286
|
+
addTag()
|
|
287
|
+
}
|
|
303
288
|
|
|
304
289
|
/**
|
|
305
290
|
* Handle keyboard navigation between tags - optimized with element lookup caching
|