Open dave0111 opened 3 months ago
I'm curious about this too!
I set the format to .plainText to prevent image pasting, and it worked. However, we also support iPads. so users can drag and drop images into the text editor on these devices.
RichTextEditor(text: $vm.attributedText, context: context, format: .plainText) {
$0.setRichTextColor(.foreground, to: UIColor.textOnSurfaceBackground)
$0.imageConfiguration = RichTextImageConfiguration(pasteConfiguration: .disabled, dropConfiguration: .disabled,maxImageSize: (width: RichTextImageAttachmentSize.points(0), height: RichTextImageAttachmentSize.points(0)))
}
If there is another way to prevent drag drop, please let me know!
Hi @dave0111 and @carminchameleon
Setting the paste configuration should work, so this may have gotten lost when rewriting the action handling earlier in 2024.
I'm busy work other projects atm, but will happily merge any fix for this.
I'm trying to disable the possibility to past an image in RichTextEditor but can't get it to work.
So far, I've been trying to use imageConfiguration, that, from what I could understand, should work like this
However, it still allows me to paste images.
This doesn't work either:
Am I doing something wrong? Because I couldn't find any other way of preventing the user from inserting an image