I'm making my own WYSYWIG. I use execCommand and I have a problem with it.
There is a lot of tutorials on how to make a WYSIWYG.
When I change the font size or font type, my script generates code with tag. is outdated.
This is a very simple WYSIWYG like many you can find in tutorials. There is an iframe with onload function:
function loadIframe()
{
document.getElementById('text-iframe').contentWindow.document.designMode = 'on';
}
And some buttons with onclick functions used to format the text.
This is the function I use for changing the font size:
function changeFontsize()
{
var size = document.getElementById('fontsizeSelect').value;
document.getElementById('text-iframe').contentWindow.document.execCommand('FontSize', false, size);
}
Other functions are pretty similar and use the same execCommand method, so I think I don't have to show them to you.
The code my WYSIWYG generates looks like this:
<font color="red" face="Verdana" size="5">test</font>
And my question is: How to make my WYSIWYG generate a modern code proper with HTML5? As it should be coded now, not with outdated tags.