Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1135
WebHTMLEditor - Set font-size programatically at current caret location
posted

Good day All!!!

Happy new year to All!!!!

I am currently using the WebHTMLEditor for a project, but due to certain requirements, I have to code all the editor functions (bold, italic, subscript, etc) myself using image buttons (essentially, my WebHTMLEditor has no buttons of its own). I can mimic all the functions (bold, cut, copy, paste, etc) using the iged_act(command) command available to me, but I am unsure on how to do this for the font-size (font type is not important, the users are limited as to how "creative" they can be when editing the text). I found a post here stating the "document.execCommand('fontsize', value);" command is the one to use, but this only works when you select text and then change the size. Also, I can't change the size after I've changed it once?

Is there another way I can change the font size, so that when I change the size, all the new text I type will be re-sized immediately?


Thanks loads y'all!!!!!!!



Parents
No Data
Reply
  • 1135
    Verified Answer
    posted

    Think I've found what I need:

    function resizeText(newSize) {

    var editor = iged_getById('myEditor');
    if (editor) {
    editor._format('fontsize', parseInt(newSize)); //newSize is parameter passed to function

    }

    }

Children
No Data