superlistapp / super_editor

A Flutter toolkit for building document editors and readers
https://superlist.com/SuperEditor/
MIT License
1.66k stars 244 forks source link

Support and import and export of HTML code #1

Open slightfoot opened 3 years ago

slightfoot commented 3 years ago

EDIT: This ticket was filed early in the project lifecycle because we assumed HTML would be an important interchange format for super_editor. At this time, we haven't identified any specific requirements among customers that require HTML instead of markdown (which we already support). Therefore, I'm marking this ticket as parked.

matthew-carroll commented 3 years ago

@bk-one @salihgueler let's figure out where this ticket belongs in terms of priority

bk-one commented 3 years ago

not important right now

hillelcoren commented 3 years ago

Sorry to hear it, FWIW it's important to us...

bk-one commented 3 years ago

Let's aim then for the next release? We do only add markdown right now, but happy to reevaluate after we released 0.1 in the coming weeks

hillelcoren commented 3 years ago

That would be awesome, thank you!

hillelcoren commented 3 years ago

That said if there's support for markdown I believe it's backwards/forward convertible to HTML so it should work for us as is

salihgueler commented 3 years ago

@hillelcoren please check serializeDocumentToMarkdown and deserializeMarkdownToDocument functions for Markdown implementation.

matthew-carroll commented 3 years ago

@hillelcoren have you or anyone on your team tried out the editor? I was generally aware of your interest in the editor but wasn't aware that you were keeping an eye on it. Can you say a little bit about your timeline for adoption and list your MVP features for the editor?

hillelcoren commented 3 years ago

I've actually jus started working on it, if the editor is ready we'd go live with it immediately. We were going to use HTML but if markdown is ready that could work for us, our main use case is to generate HTML based emails.

matthew-carroll commented 3 years ago

We won't know if it's ready until you tell us it's ready :)

I would recommend trying to integrate it and then filing issues for any bugs you come across, or MVP feature requests. As you file issue, it would also be helpful to see any visual designs or screenshots of that part of your product in action so that we can glean surrounding context.

hillelcoren commented 3 years ago

I spent a few hours this morning working on it, here are my notes.

super_editor/lib/src/default_editor/document_interaction.dart:639:31: Error: A value of type 'bool' 
can't be returned from a function with return type 'KeyEventResult'.
 - 'KeyEventResult' is from 'package:flutter/src/widgets/focus_manager.dart' 
 ('../flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
      onKey: (node, event) => true,
                              ^

Happy to create a separate issue if needed...

matthew-carroll commented 3 years ago

@hillelcoren I think a separate issue would be good. Let's keep this issue tracking HTML support.

When you file a new issue, can you include the code that causes the error, and include the platform you're running on and the flutter --version info?

matthew-carroll commented 3 years ago

@hillelcoren can you outline your requirements for HTML (de)serialization? It looks like this ticket was filed as an empty placeholder, so we'll need to figure out what the specific deliverable is before we can work on this.

hillelcoren commented 3 years ago

Our main use case initially is to provide a WYSIWYG editor for HTML emails. We'd like to support basic formatting (bold, italic, font size, etc) but don't need to support complex layouts. Note: markdown would also work.

In the future we'd like to support something closer to this: https://grapesjs.com

Thanks for your work on the project, it's already pretty impressive!

matthew-carroll commented 3 years ago

@hillelcoren if markdown will work for you then that would make more sense because we already support markdown.

grapejs looks to be a full-blown application that goes far beyond document layouts. You may be able to use some of the building blocks from super_editor in building such a tool, but general layout definitely goes beyond the goals of document layout and editing.

Until we hear otherwise from a customer, I'm going to consider this ticket as being on-hold because there doesn't appear to be anyone that truly needs this behavior at this time.

sabetAI commented 3 years ago

Hi @matthew-carroll, for my use-case I'm parsing and pre-processing html documents, and currently rendering them in a ListView with HtmlWidgets. HtmlWidget currently doesn't support selectable text, so it would be convenient if I can render directly using super_editor.

matthew-carroll commented 3 years ago

Hi @sabetAI. I have a couple questions about your use-case:

sabetAI commented 3 years ago

Hi @matthew-carroll,

matthew-carroll commented 3 years ago

@sabetAI yeah, my guess is that you can do HTML -> markdown without issue. Please post back after you get a chance to try that and let us know if it works for your needs.

I can't remember for sure, but I think the markdown package that we're already including may offer HTML-to-markdown translation.

britannio commented 3 years ago

I've got a basic implementation with test coverage, it's probably worth completing https://github.com/superlistapp/super_editor/issues/86 before integrating it in the repo though as it depends on the html package. image

bugrevealingbme commented 2 years ago

I think this issue should be explained better. How can I keep this document suitable for api. SuperEditor export not explained

matthew-carroll commented 2 years ago

@bugrevealingbme can you please rephrase your comment as a specific question?