Closed dave0111 closed 1 month 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.
Ping @dave0111 and @carminchameleon
I don't know if you're still using RTK, but if you do, I just released a 1.1
that only sets the initial image configuration if it hasn't been manually set before.
I think this should fix this problem, since the configuration could otherwise be overwritten when the view is first set up.
I'll close this now, but please try it out and let me know if it works. Otherwise, I'll reopen this and keep investigating.
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