CatHood0 / flutter_quill_delta_from_html

Convert easily HTML inputs content to Quill Delta format
https://pub.dev/packages/flutter_quill_delta_from_html
MIT License
3 stars 18 forks source link

<video> with <source> child #1

Closed Nightbl927 closed 4 months ago

Nightbl927 commented 4 months ago

Existing code accounts for the 'src' attribute in the <video> tag but not if the <video> tag has a child <source>. I have seen both versions of the <video> tag usage.

https://www.geeksforgeeks.org/html5-video/

I would submit a PR but I am not as familiar with using github in that manner yet.

  @override
  List<Operation> videoToOp(dom.Element element) {
    final String src = element.attributes['src'] ?? '';
    final String source_src = element.firstChild?.attributes['src'] ?? '';

    if (src.isNotEmpty) {
      return [
        Operation.insert('\n'),
        Operation.insert({'video': src})
      ];
    }
    else if(source_src.isNotEmpty) {
      return [
        Operation.insert('\n'),
        Operation.insert({'video': source_src})
      ];
    }

    return [];
  }

If you don't mind, I would like to contribute to your project as I am working on something that utlizes HTML to Delta.

CatHood0 commented 4 months ago

Excellent, do the PR when you can and I'll be sure to test this functionality. While implementing <video> to Operation, I thought about this, however inadvertently it seems I didn't.

Thanks in advance for the effort!

CatHood0 commented 4 months ago

At the current version (1.2.3) this is already implemented