tneotia / html-editor-enhanced

A Flutter package that provides a WYSIWYG editor backed by flutter_inappwebview and the Summernote library.
https://pub.dev/packages/html_editor_enhanced
MIT License
269 stars 318 forks source link

[QUESTION] Project update #479

Open vadrian89 opened 7 months ago

vadrian89 commented 7 months ago

Hello, I was looking into the project because I want to help with it, as I am also using it in a project. What I want to do at the moment:

Afterwards I want to help:

Since this is your repo, I have a few questions:

graemep-nz commented 7 months ago

@tneotia

vadrian89 commented 7 months ago

Anyone has any ideea why is the editor seems larger than the parent widget? The height is given from LayoutBuilder and is set to: summernote editor, IFrameElement and set to a SizedBox containing the HtmlElementView.

LayoutBuilder(
              builder: (context, constraints) {
                final width = constraints.maxWidth;
                final height = constraints.maxHeight;
                _iframe.width = width.toString();
                _iframe.height = height.toString();
                _sendMessageToIframe("setHeight", height.toString());
                return SizedBox(
                  height: height,
                  width: width,
                  child: Directionality(
                    textDirection: TextDirection.ltr,
                    child: HtmlElementView(viewType: _viewId),
                  ),
                );
              },
            )

image

graemep-nz commented 7 months ago

print the values of maxWidth and maxHeight - they're probably infinity,

vadrian89 commented 7 months ago

No, they are not, already tested that. Here are outputs:

Builder constraints: BoxConstraints(0.0<=w<=1888.0, 0.0<=h<=866.0)
Received toIframe message from parent: {"view":"1703407396787","type":"toIframe","method":"setHeight","value":"866"}
Setting height: 866
Received toIframe message from parent: {"view":"1703407396787","type":"toIframe","method":"setWidth","value":"1888"}
Setting width: 1888
Builder constraints: BoxConstraints(0.0<=w<=1557.0, 0.0<=h<=691.0)
Received toIframe message from parent: {"view":"1703407396787","type":"toIframe","method":"setHeight","value":"691"}
Setting height: 691
Received toIframe message from parent: {"view":"1703407396787","type":"toIframe","method":"setWidth","value":"1557"}
Setting width: 1557
graemep-nz commented 7 months ago

I don't know what HtmlElementView is. What happens if you do this return SizedBox( height: height - 100, width: width - 100,

vadrian89 commented 7 months ago

It resized the box accordingly, but the editor keeps it's size.

image

graemep-nz commented 7 months ago

I'm not sure what you're doing. Maybe use flutter_widget_from_html (HtmlWidget) instead of the embedded thing. So is the idea of the embedded thing so the browser interprets the html meaning all tags etc. are supported. https://api.flutter.dev/flutter/widgets/HtmlElementView-class.html it says <The widget fills all available space, the parent of this object must provide bounded layout constraints.> Try ConstrainedBox instead of SizedBox.

vadrian89 commented 7 months ago

The summernote status bar seems to be is the issue. It's taking aditional 10 px, I will disable it for now.

Update, apparently the issue was caused by padding from the summernote editor.

vadrian89 commented 6 months ago

Since the owner of the repo didn't answer, I went ahead and made a new package to continue development there.

The package can be found at: https://pub.dev/packages/html_editor_plus While the repo: https://github.com/vadrian89/html-editor-plus

azeunkn0wn commented 6 months ago

Since the owner of the repo didn't answer, I went ahead and made a new package to continue development there.

The package can be found at: https://pub.dev/packages/html_editor_plus While the repo: https://github.com/vadrian89/html-editor-plus

Thank you. I'll migrate to your package soon.

tneotia commented 2 months ago

Hi, PRs are definitely accepted, only thing I ask is to make it easy as possible to review. PRs with mainly formatting changes become extremely difficult to review.

I am not as active but I try to take a look at my notifications every now and then so you can ask questions as well, no issues.