How to find selected text font size and name on a execCommand WYSIWYG editor
-
21-06-2021 - |
Domanda
I am making a WYSIWYG editor using execCommand()
and my own drag-and-drop javascript functions.
I want to be able to find the name and size of the selected text if applicable. How can I do this exactly?
Are there specific functions relating to execCommand()
to do this?
Soluzione
alert(iFrame.document.queryCommandValue("FontSize"));
OR
alert(iFrame.document.queryCommandValue("ForeColor"));
You can't do it with execCommand, as execCommand only returns true or false based on whether or not it succeeded. However, there are some problems with this apparently. I suggest reading up on
ContentEditable - Get current font color/size
Fore more information
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow