Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html render issue with sup and sub #1947

Closed
1 task done
the-best-is-best opened this issue Jun 24, 2024 · 7 comments
Closed
1 task done

Html render issue with sup and sub #1947

the-best-is-best opened this issue Jun 24, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@the-best-is-best
Copy link

Is there an existing issue for this?

Flutter Quill version

No response

Steps to reproduce

1 - convert data to html and save it
2- return data from html

Expected results

Screenshot_1719219662

Actual results

Screenshot_1719219545

Code sample

controller = QuillController(
document: Document.fromHtml(
bloc.questions!.question[bloc.currentQuestion].name),
selection: const TextSelection.collapsed(offset: 0));

and json name: "

Question 72
H2O

",

Screenshots or Video

No response

Logs

No response

@the-best-is-best the-best-is-best added the bug Something isn't working label Jun 24, 2024
@AtlasAutocode
Copy link
Collaborator

The sub- and super-script issue was addressed in version 9.4 - can you update and verify?

If you must be on an earlier version, then you will need to use special open-type fonts that implement scripting.
The only font I know that implements this is Apple's SF font which can only be used on Apple devices (and only implements for numbers and lower-case English letters!)

@the-best-is-best
Copy link
Author

I already tested it with the last Version in android not ios and html not supported styling and sup and sub not correct sup need to make text in top not only with small text

@AtlasAutocode
Copy link
Collaborator

I erroneously assumed that the problem was with rendering sub- and super-scripts in the editor.

The problem appears to be in the html package (published by the dart language team) used to parse html.
It does not seem to recognize the sup and sub html tokens.

@AtlasAutocode
Copy link
Collaborator

The current code used to import HTML uses html2md which converts html to Markdown and then to Quill Delta.
Since there is no markdown code for sub- and super-script these styles will be ignored.
The only way to solve this problem would be to rewrite the html converter to convert directly to Delta (or json?)
Same answer as Issue 1917

@the-best-is-best
Copy link
Author

I don't understand but I need to convert it to an html element with all styles

@AtlasAutocode
Copy link
Collaborator

Yes, I understand what you are trying to do. What you are trying to do is a good and simple idea.
What I am telling you is that the current html converter cannot do what you want and cannot be modified to 'fix' the problem.
The only way would be for you to rewrite the html converter code module so that all html styles are converted.
The only other way will be for you to use json rather than html to set the editor content. That would retain all styles.

I am suggesting a work around.
Change:

1 - convert data to html and save it
2- return data from html

To:

1 - convert data to json and save it
2- return data from json

@singerdmx
Copy link
Owner

@AtlasAutocode thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants