psergus / ngWYSIWYG

true angular WYSIWYG
MIT License
63 stars 42 forks source link

Is it possible to modify the plugin to generate different HTML tags for styling? #17

Closed richardchou closed 9 years ago

richardchou commented 9 years ago

Hi, I don't really have an issue per say, but more of a question.

I noticed that the generated HTML with the text editor uses the <span style=""> tag when you edit text. I was wondering if there is a way to generate using some of the older tags instead, for example, when bolding, underline or italicizing text, use the older <b>, <i>, <u> tags, and for font color changes, generate the <font color=""> instead of using the span tag. I am using a parser in a different project that supports the older tags and but doesn't support span tags, and it would not be possible to rewrite the parser to support the span tags.

From what I have seen so far, I would have to use javascript's Document.execCommand() to do this somehow, but I haven't figured out where I would need to do this yet, and was hoping you could point me in the right direction.

psergus commented 9 years ago

Hi @richardchou, totally understood :+1: What you can do is you can comment $document.execCommand("styleWithCSS", 0, 0); in the 'wframe' directive (you can search for this command). It should produce the 'Old School' elements. Although, I should say it is not guaranteed for all browsers, but for majority. Please let me know if it helped.

richardchou commented 9 years ago

Hi @psergus - Thanks a bunch, I tried commenting that line out and it worked both in Firefox and Chrome. Looks like this question is resolved :+1: