(I hope posting in here is right... not sure...)
Link to script:
http://www.dynamicdrive.com/dynamici...iwyg/index.htm
I posted a thread about this to get some help, but no one seemed to have the answer.
So I played around a bit, and I've come up with a couple nice work-arounds for this script:
1. Setting it to always submit in html mode (not plain text).
2. Fixing the hyperlink popup so you don't get "http://http://yoururl...."
FORCE SUBMIT IN HTML MODE:
I hate that if you submit if you've selected "TextMode" it submits as text... not html.
Ex: a "<" will be submitted as "<", and when you display this on your next page, it's not html, but displaying the html as text, like you'd see "<b>" instead of getting bold text, etc.
So... this is a pretty simple workaround.
In your form tag, add this:
Code:
<form ... onSubmit="formatText('ViewText','YOURTEXTAREA');"
Replease "YOURTEXTAREA" with the name of your text area, as defined on your page and in your script.
If you have more than one text area, use this:
Code:
<form ... onSubmit="formatText('ViewText','YOURTEXTAREA');formatText('YOURTEXTAREA2','htmlaftertable');"
That will switch your text area back to html mode before submitting, and you're done.
You could probably add this to the submit button as well. I'm not sure what the pluses and minuses are for each method... one might be more compatible/secure than the other... so... you may want to look into that.
FIXING HYPERLINK POPUP:
When you open the hyperlink popup, you get two things:
1. A text field to type in your link.
and 2. Above that, a dropdown list to select what "type" of link.
Seems all good, but there's an issue.
For some reason, the "type" just ADDS that prefix to whatever link you type.
Ex: If you choose "http" as the type, and put "http://google.com" as your url in the text field, your resulting html will be "http://http://google.com"
The same goes with the "mailto" and "https" options.
You could just not put the http, and use www., but this still won't work for local links... you'd get something like "http://index.html".
So... by correcting this, it'll save you a trip to the code view each time you add a link.
How to fix:
1. Find your "openwysiwyg" director, with the .js file inside it. Go into the "popups" directory within that, and find "insert_hyperlink.html". Open that in notepad, dreamweaver, or whatever you like.
2. Look in the script, scroll down a bit, and find this part:
Code:
<td style="padding-bottom: 2px; width: 50px; font-family: arial, verdana, helvetica; font-size: 11px;">Type:</td>
<td style="padding-bottom: 2px;">
<select name="linkType" id="linkType" style="margin-right: 10px; font-size: 10px;">
<option value="http://">http:</option>
<option value="https://">https:</option>
<option value="mailto:">mailto:</option>
</select>
You really only need the select menu, but there's another change I wanted to make.
3. Replace that code with this:
Code:
<td style="padding-bottom: 2px; width: 50px; font-family: arial, verdana, helvetica; font-size: 11px;">Add:</td>
<td style="padding-bottom: 2px;">
<select name="linkType" id="linkType" style="margin-right: 10px; font-size: 10px;">
<option value="">(none)</option>
<option value="http://">http://</option>
<option value="mailto:">mailto://</option>
</select>
Change the parts in red:
The select menu changes so you can add nothing to the start of your url, so you don't have to remove the http:// when you paste, or you can use a local file. This is a good default.
Just in case, though, you can still have the http, mailto, (and other) choices there.
If you want to add your own:
<option value="RESULT">CHOICE</option>
where CHOICE is what's in the dropdown and RESULT is what is added to the beginning of the link.
Also, the change at the beginning to say "Add:" instead of "Type:" makes this make a WHOLE lot more sense.
Type seems to imply that it will format it the "right" way, not just ADD something to the beginning.
I hope this is useful for some people.
I also am slightly bothered by the <br> that is always inserted at the end (or close... before other closing tags, sometimes) of the block of text.
I don't know how to get rid of it.
However, I'm using php and you can always do what I'm doing:
PHP Code:
<?php
$textareaname = $_POST['textareaname'];
if ($textareaname == "<br>") $textareaname = "";
...
?>
...just checking if there was nothing entered. at least that way you won't get a worthless <br> by itself if the field was sent empty.
As for the <br> in general... no ideas. Wish someone who knew JS well would figure it out 
I'll play a bit more and see what I come up with.
Bookmarks