سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top