Insert Text with WYSWYG BBCode Editor

Jun 14, 2010 at 6:24 PM
Edited Jun 24, 2010 at 12:31 AM

Hi. Thanks for this great editor. I successfully installed on my forum script. But have problem when edit post. Text area is empty. How to convert all codes back to WYSIWYG? 1. Its working, but I have standard BBCode output. For example I cant see youtube link. For example: When I edit with standard editor (not WYSWYG BBCode Editor) I got following code: This is my function for youtube: [blackquote]function InsertYoutube() { if (editorVisible) { ifm.contentWindow.focus(); var mylink = prompt("Enter a URL:", "http://"); if ((mylink != null) && (mylink != "")) { if (isIE) { //IE var range = ifm.contentWindow.document.selection.createRange(); if (range.text == '') { range.pasteHTML("[youtube=" + mylink + "]"); } 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, "[youtube=" + mylink + "]"); else myeditor.execCommand("CreateLink", false, mylink); } else myeditor.execCommand("CreateLink", false, mylink); } } else { AddTag('[youtube=',']link[/url]'); } }[/blackquote] <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/-jzPqeNfQqg"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/video_link" type="application/x-shockwave-flash" wmode="transparent" width="425" height="344"></embed></object> But when I edit with WYSWYG I got only blank textarea. Other edits works fine - Bold, Links etc. (I have added smilies support and when edit post I see something like this: :D :) instead of smilie images - or bbcode [img]link_to_smilie.gif[/gif] ). 2. How can I get color code for colorpicker instead of rgb format? For example: [color=#code][/color] instead of [color=rgb(x,x,x)][/color] ? Thanks.

[EDIT] this wrapped text is not my fault :)

Jun 23, 2010 at 11:59 PM
Edited Jun 24, 2010 at 12:33 AM

I solve this above!

Have just another question:

How to insert from text from popup into textarea of Jibit WYSWYG editor?

Also, I have noticed bug when I copy/paste text. For example:

Text is: word1 another2 word3... when I copy/paste it and submit I got this:

word1another2 word3 (missing space bettween word1 and another2)


I edited some code forInsertYoutube function:

 

function InsertYoutube() {
    if (editorVisible) {
        ifm.contentWindow.focus();
        var mylink = prompt("Enter a URL:", "http://");
        if ((mylink != null) && (mylink != "")) {
            if (isIE) { //IE
                var range = ifm.contentWindow.document.selection.createRange();
                if (range.text == '') {
                    range.pasteHTML("[youtube=" + mylink + "]");
                }
                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, "[youtube=" + mylink + "]");
                else
                    myeditor.execCommand("CreateLink", false, mylink);
            }
            else
                myeditor.execCommand("CreateLink", false, mylink);
        }
    }
    else {
        AddTag('[youtube=',']link[/youtube]');
    }
}

Now you will be prompted for YT link.

 

Thanks in advance!

Jun 29, 2010 at 12:58 PM
ivan79 wrote:

I solve this above!

Have just another question:

How to insert from text from popup into textarea of Jibit WYSWYG editor?

Also, I have noticed bug when I copy/paste text. For example:

Text is: word1 another2 word3... when I copy/paste it and submit I got this:

word1another2 word3 (missing space bettween word1 and another2)


I have the same problem and I solved it like this :

function doCheck() {
	if (!editorVisible) {
        	ShowEditor();
	}
	content = myeditor.body.innerHTML;
	rep(/\n/gi," ");
	html2bbcode();
	document.getElementById(body_id).value = content;
	return true;
}
Jun 29, 2010 at 8:01 PM
Edited Jun 29, 2010 at 8:11 PM

I have tried your code and have same result.

Sometimes I got 2 words wrapped in same line. Example:

Original:

Hello world. Hello world.

Pasted:

Hello world. Helloworld.

(this is tested in FireFox).

EDIT:

I solve it. Just added:

    rep(/\&nbsp;/gi," ");
    rep(/\n/gi," ");

in function html2bbcode()

Coordinator
Nov 9, 2010 at 8:10 AM

thanks for the suggestions, all added to the vault. Thanks for the youtube tag as well, we'll add this a bit later.

Nov 5, 2011 at 2:02 AM

 

Same issue. I've WYSIWYG BBCode Editor v1.0.0.2 but it's not fixed yet.

I would like to copy/paste a huge list of items (>50) that are in two columns and find a way to align them nicely.

user656544455        |          60$
user51                    |          50$
user4545485           |          75$
...

I dunno what tags to use!

[col] [tb] ... are not working

1) When I use the "add table" in the menu, it gives me a nice table in the preview area but when I hit the "Generate the BBCode" button and then the "Load BBCode", it put all items on the same line and there is no more table!

2) If I copy/paste items that are in OpenOffice / Excel : same thing.

Please help!

Another thing, the code [HR] (to add a line) is removed when I reload the code. Why?

Wishlist:

- You should add a "add line" button / icon btw.
- A code "cleaner / inspector / checker" should be added to, to remove bad leftovers after an intense editing...

Thank you.