Jump to content

Jitbit WYSWYG BBCode Editor


Matty999555

Recommended Posts

Fixed the Mail function:

function doMail() {
    if (editorVisible) {
        ifm.contentWindow.focus();
        var mylink = prompt("Enter an Email:", "");
        var mylink = "mailto:" + mylink;
        if ((mylink != null) && (mylink != "")) {
            if (isIE) { //IE
                var range = ifm.contentWindow.document.selection.createRange();
                if (range.text == '') {
                    range.pasteHTML("<a href='" + mylink + "'>" + mylink + "</a>");
                }
                else
                    myeditor.execCommand("CreateLink", false, mylink);
            }
            else if (window.getSelection) { //FF
                var userSelection = ifm.contentWindow.getSelection().getRangeAt(0);
                if(userSelection.toString().length==0)
                    myeditor.execCommand('inserthtml', false, "<a href='" + mylink + "'>" + mylink + "</a>");
                else
                    myeditor.execCommand("CreateLink", false, mylink);
            }
            else
                myeditor.execCommand("CreateLink", false, mylink);
        }
    }
    else {
        AddTag('[url=mailto:',']click here[/url]');
    }
}

 

Link to comment
Share on other sites

Fixed Text Size:

function doSize() {
    if (editorVisible) {
        ifm.contentWindow.focus();
        var mylink = prompt("Enter a text-size:", "14px");
        if ((mylink != null) && (mylink != "")) {
            if (isIE) { //IE
                var range = ifm.contentWindow.document.selection.createRange();
                if (range.text == '') {
                    range.pasteHTML("<span style=\"font-size: " + mylink + ";\"></span>");
                }
                else
                    myeditor.execCommand('inserthtml', false, "<span style=\"font-size: " + mylink + ";\">" + range.text + "</span>");
            }
            else if (window.getSelection) { //FF
                var userSelection = ifm.contentWindow.getSelection().getRangeAt(0);
                if(userSelection.toString().length==0)
                    myeditor.execCommand('inserthtml', false, "<span style=\"font-size: " + mylink + ";\">" + userSelection.toString() + "</span>");
                else
                    myeditor.execCommand('inserthtml', false, "<span style=\"font-size: " + mylink + ";\">" + userSelection.toString() + "</span>");
            }
            else
                myeditor.execCommand('inserthtml', false, "<span style=\"font-size: " + mylink + ";\">" + userSelection.toString() + "</span>");
        }
    }
    else {
        AddTag('[size=]','[/size]');
    }
}

 

Link to comment
Share on other sites

The Quote doesn't work while in wysiwyg mode

function doQuote() {
    if (editorVisible) {
        ifm.contentWindow.focus();
        if (isIE) { //IE
            var range = ifm.contentWindow.document.selection.createRange();
            if (range.text == '') {
                range.pasteHTML("<blockquote></blockquote>");
            }
            else
                myeditor.execCommand('inserthtml', false, "<blockquote>" + range.text + "</blockquote>");
        }
        else if (window.getSelection) { //FF
            var userSelection = ifm.contentWindow.getSelection().getRangeAt(0);
            if(userSelection.toString().length==0)
                myeditor.execCommand('inserthtml', false, "<blockquote>" + userSelection.toString() + "</blockquote>");
            else
                myeditor.execCommand('inserthtml', false, "<blockquote>" + userSelection.toString() + "</blockquote>");
        }
        else
            myeditor.execCommand('inserthtml', false, "<blockquote>" + userSelection.toString() + "</blockquote>");
    }
    else {
        AddTag('[quote]', '[/quote]');
    }
}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.