RichTextKit icon indicating copy to clipboard operation
RichTextKit copied to clipboard

Resize textView with text height

Open slh-ideaflow opened this issue 1 year ago • 7 comments

Hi @danielsaidi , I added this change so the text views in our application would resize according to the height of the contained text. I expect you would want this to be optional, but overall would you consider merging it to the main? I appreciate your project a lot and I think there's a good chance my coworkers and I will be contributing a lot to our fork, and I think it would be ideal if we could stay in sync with the core project as much as possible. Let me know your thoughts!

slh-ideaflow avatar Aug 15 '24 04:08 slh-ideaflow

Thanks @slh-ideaflow for the PR. I was having some issues because the RichTextViewer was not adapting the heigth when placed in a List and these changes solve that.

I hope @danielsaidi can review it and merge into main

robjperez avatar Aug 19 '24 22:08 robjperez

Hi guys,

Sorry for the late reply, I've been very busy with other projects.

Thank you so much for looking into this! It would be amazing, although as you say, the behavior should be opt-in.

I'll take a look at this and see if I can merge it and add configurations for it. 👍

danielsaidi avatar Aug 22 '24 13:08 danielsaidi

I haven't forgotten this, but have been busy with other things.

It's on top of my todo list once the other critical things I'm focusing on are done.

danielsaidi avatar Sep 02 '24 11:09 danielsaidi

@slh-ideaflow I've tried your solution for my view in a List. It works great at first glance, but if the RichTextEditor is redrawn after some time, it loses its size. For some reason, the textView size becomes zero for any consecutive draw. I'm not a master of the SwiftUI layout system, so maybe this is expected behavior. Anyway, I tried changing the code according to the solution from here, and now it works for my case.

SubvertDev avatar Sep 24 '24 11:09 SubvertDev

@SubvertDev I finally got that implementation working for myself too. I'll add a comment there about an adjustment to it which I found helpful.

slh-ideaflow avatar Sep 25 '24 21:09 slh-ideaflow

That's great! Feel free to share any findings here as well, for when I get around to it.

danielsaidi avatar Oct 03 '24 08:10 danielsaidi

@slh-ideaflow Would merging this PR in its current state expose it to the flaw @SubvertDev mentioned?

danielsaidi avatar Oct 08 '24 20:10 danielsaidi

@slh-ideaflow ?

danielsaidi avatar Jan 02 '25 09:01 danielsaidi

I think we can close this -- the solution I landed on was here:

https://github.com/danielsaidi/RichTextKit/issues/33#issuecomment-2375315414

slh-ideaflow avatar Jan 06 '25 19:01 slh-ideaflow

Perfect, thank you!

danielsaidi avatar Jan 07 '25 07:01 danielsaidi