Re: WYSYWYG BBCode Editor

1. My mod will only allow certain elements/attributes.
2. How many users will make a 10000 x 10000 red box with the word "Whoops" on it?

27 (edited by jacobswell 2005-06-30 00:25)

Re: WYSYWYG BBCode Editor

when the wysiwyg mode is changed to html mode widgeditor does change that nasty div code to simple div code, but it does not when html to wysiwyg. so just adding some code will solve this problem.

change the code

widgEditor.prototype.updateWidgInput = function()
{
    if (this.wysiwyg)
    {
        /* Convert spans to semantics in Mozilla */
        if (!this.IE)
        {
            this.convertSPANs(true);
        }
        
        this.paragraphise();        
        this.cleanSource();
    }
    else
    {
        this.theInput.value = this.theTextarea.value;
    }

    return true;
}

to this code

widgEditor.prototype.updateWidgInput = function()
{
    if (this.wysiwyg)
    {
        /* Convert spans to semantics in Mozilla */
        if (!this.IE)
        {
            this.convertSPANs(true);
        }
        
        this.paragraphise();        
        this.cleanSource();
    }
    else
    {
        this.theInput.value = this.theTextarea.value;
        /* added by Jacobswell {{{ */
        this.cleanSource(); /* }}} */
    }

    return true;
}

but I don't think that will remove other nasty codes at all.

Re: WYSYWYG BBCode Editor

I think the best way is disable the html mode.

Re: WYSYWYG BBCode Editor

It's hard to turn a HTML editor into a BBCode editor. So, why not allow certain HTML in posts? And, some people don't know perfect XHTML 1.0 Strict.

(If I allowed all HTML in posts, some maluser could use a Pocket PCor a browser with JavaScript disabled or something or even the HTML Source editor to add malicious JavaScript that installs spyware or something.)

No offense.

Re: WYSYWYG BBCode Editor

why not just convert the html you want into bbcode, then clean up the rest and save it as a normal post?

Re: WYSYWYG BBCode Editor

When a user edits the post, I have to convert it back into HTML. Besides, there would be 3 (at least) additional steps to add extra BBCodes.

Re: WYSYWYG BBCode Editor

there is no problem AT ALL converting bbcode to html for editing posts... thats what parser.php does already

Re: WYSYWYG BBCode Editor

Yeah, but to get it to render in the editor is the problem.

Re: WYSYWYG BBCode Editor

what about making a live preview box? it would be alot easier than WYSIWYG bbcode but still cool

edit: i've just been playing around with this, and its pretty easy to make the preview box appear and parse the bbcode using regexes in the javascript as the user types. and if they don't have javascript the manual preview still works

Re: WYSYWYG BBCode Editor

The editor would be the preview box. Also, TinyMCE can have a preview button (you just have to enable it in some JavaScript) to preview the post.

Re: WYSYWYG BBCode Editor

when people have right to write a html code, there will be a script problem. as I said, the best way you do is make a wysiwyg editor whose html mode is disabled. and when people post by pressing submit button, there should be a code checker which will get rid of harmful and unwanted tags and a parser whose job is changing htm code to bbcode.

or you can change the parser.php so that when we post an article the html code will NOT be changed to bbcode, rather saved as it is. then we only need a code checker, and the time in loading a post to web browser will be reduced.

but I don't think it is useful. because if we only use this kind of forum, we just use a few tags and bbcode does deal with those. further why punbb uses bbcode is because of the security problem. it is not easy to make a html code checker.

finally TinyMCE is not tiny. it's heavy to use, I think.