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 is not working #56

Open
ghost opened this issue Dec 3, 2018 · 13 comments
Open

HTML Render is not working #56

ghost opened this issue Dec 3, 2018 · 13 comments

Comments

@ghost
Copy link

ghost commented Dec 3, 2018

Hey,

I have data which are coming from database. I am giving content in variable of ngModel. but html is not displaying as actual it is. (HTML tags are not working)

HTML.txt

Please let me help for that.

@onaluf
Copy link
Owner

onaluf commented Dec 3, 2018

Your HTML contain table, which is not supported at the moment. Everything you pass into the ngModel is parsed and only supported features are then rendered in the editor. This is by design. If you want to add support for table you can sub-class fate-html-parser.service.ts.

Ideally you should also add custom control in the ui for editing tables but that is not required as long as you're OK with the users not being able to create table by themselves.

Eventually support for table will come but this has a low priority for me at the moment.

@Void-0
Copy link

Void-0 commented Dec 11, 2018

On the subject of HTML parsing, what's the difference between the fate-html-parser.service and the fate-parser.service ?
My guess is that example-custom-html-parser.service parses the HTML present in the ngModel as in the example is parsed and replaced by a in the input (editable div). The example-custom-parser.service is then parsing the "content" of the input and thus rendering the span as well as its contents (icons etc.) inside the input. I'm really not sure I got this right.
Also, why do we need two separate services for that ? Is there no way to only use one ?
PS: great component by the way. :)

@onaluf
Copy link
Owner

onaluf commented Dec 11, 2018

Thanks @Void-0. Yes, you are right: he idea behind the two parser is that the representation of the HTML inside of the editor and the text in the ngModel may be different.

In fact there is no reason for the ngModel to contain HTML at all. I have a plan to release a markdown version of the parser... that way you would be able to edit markdown text in a wysiwyg manner. By default at the moment both are HTML so that's why they hierarchically related.

@jacobbeasley
Copy link

Hey, is it just me or is the html parser missing the br tag?

@onaluf
Copy link
Owner

onaluf commented Jun 5, 2019

@jacobbeasley Yes you're right <br> should be supported... At the moment the editor instead uses <p> to format line-break.

For the sake of consistency, what should be done is to convert the markup to this. I'll try to fix this as soon as possible.

@jacobbeasley
Copy link

Great! Thanks!

@jacobbeasley
Copy link

Awesome, thanks! Say, saw you wrote a book on jQuery game development! Awesome stuff!

@onaluf
Copy link
Owner

onaluf commented Jun 5, 2019

Thanks ! It's a bit outdated now :)

@onaluf
Copy link
Owner

onaluf commented Jun 20, 2019

@jacobbeasley I've released 1.9.3 that should fix your issue. Tell me if it works for you when you get the time to test it!

@RicardoJBarrios
Copy link

Hello.

I've installed this version. Only tried the material version, but now there is no way to create a p tag, even clicking the "p" button. Always use div instead.

@onaluf
Copy link
Owner

onaluf commented Jan 1, 2020

@RicardoJBarrios Yes that's an expected (but maybe confusing) behaviour. In order to have the HTML code generated to be consistent the editor always uses div instead of p to render paragraphs. On top of that this icon is not used to insert a paragraph but to remove the h1-6 or list formatting.

If you want to insert a paragraph you can just press return. Maybe the UI is confusing here and maybe it would be good to have a simple option to use p everywhere instead of div (you can do that now by using your own parse but it's a bit cumbersome).

What would you want to see there ?

@FriesBureau
Copy link

FriesBureau commented Feb 25, 2020

Hi
I also only tried the material version, and the "p" tag is not inserted after pressing "enter".

@onaluf
Copy link
Owner

onaluf commented Feb 25, 2020

At the moment the editor is only using div to handle paragraphs and explicit line breaks. What I mean by

If you want to insert a paragraph you can just press return

Was that pressing enter will start a new paragraph, at the moment this is marked up as a div. I have a few opened defect and I will try to add an option to always use p instead of div.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants