mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-04 23:03:45 -04:00
Enforce text length limits in editor paste handling, adjust API request size limit, and crop excessive content in LLM profile extraction
This commit is contained in:
@@ -178,6 +178,18 @@ export function useTextEditor(props: {
|
||||
return true // Prevent image in text/html from getting pasted again
|
||||
}
|
||||
|
||||
if (max) {
|
||||
event.preventDefault()
|
||||
const text = event.clipboardData?.getData('text/plain') ?? ''
|
||||
const currentLength = editor.getText().length
|
||||
const available = Math.max(0, max - currentLength)
|
||||
if (available > 0 && text.length > 0) {
|
||||
const croppedText = text.slice(0, available)
|
||||
editor.commands.insertContent(croppedText)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Otherwise, use default paste handler
|
||||
},
|
||||
handleDrop(_view, event, _slice, moved) {
|
||||
|
||||
Reference in New Issue
Block a user