You are not logged in.
On my system, people are allowed to enter javascript functions into the editor along with the html. But when they do so, the body of the javascript dissapears.
Example, the textarea looks like this:
<textarea id="fieldValue" name="fieldValue" rows="20" cols="80">
<script language="Javascript">var foo = 'bar';</script>
</textarea>
When this is loaded into xinha, the editor displays (in html view mode):
<script language="Javascript"></script>
The body of the script is gone!
I also tried replacing all "<" with "<", etc.. and it doesn't help this problem.
If I enter javascript in the html view mode then flip back and forth between html and wysiwyg views, the code within the script tags will dissapear, as above.
Is there an option that I need to set to allow entry of javascript?
Is this just not handled by the editor?
Or, is it a bug?
Here's the version I'm using:
$LastChangedDate: 2005-02-19 19:28:39 +1300 (Sat, 19 Feb 2005) $
$LastChangedRevision: 22 $
$LastChangedBy: gogo $
Any hints would be greatly appreciated!
Thanks
-Ben
Offline
PS: The problem occurs in IE (6.0.2600.1106). It seems (so far) to work better in Firefox (1.0.6).
I use firefox. Unfortunately my users mostly use IE...
Offline
We do not currently support javascript (or any other language) in the HTML being edited.
Xinha is (for now) an HTML editor, not a programming environment
James Sleeman
Offline
On my system I have supported JavaScript and even PHP with HTMLArea3 for some time, and now do with Xinha. I'm starting to look at smarty support, too... Tickets 253 and 287 both completely stop IE from stripping the contents of script tags. One issue that remains however, is that document.write statements actually do write, and they write again each time the user views source.
I found a workaround for this that would not be a good solution if your users are actually typing in JavaScript, as opposed to it being inserted by a plugin, or already being in the content. I use a regular expresssion to search the content for "javascript" prior to loading, and replace it with "freezescript." Upon submission, "freezescript" is returned to javascript. While it is freezescript, the browser preserves and ignores the code.
Offline
Thanks guys.
James, I understand your position But I can't ignore javascript. It's my fault, I should have tested javascript before comitting to xinha. But maybe you can add this to the FAQ...
Anyway, my situation right now is that it would be a pretty big deal to switch editors, as I just switched editors to start using xinha...
So I have to try to fix the problem. Looking at those tickets I'm starting to understand the problem and the essence of the solution (I have not really looked too much at the xinha internals until now). But I have to wade through the comments and try to understand the solution code, it looks like I have to patch the patch with unspecified code from another patch...
mharris, if you could clarify the current state of things it would be greatly appreciated.
Or, can I get your already patched code? Then I can diff it and see what's going on.
Meanwhile, this problem has actually become the second (but still very important) xinha problem on my list, the first (slightly more imporant) problem is now making it work with IE5 for OS X. Debugging javascript in IE5 is really not fun... Anyway, it seems that the IE5/mac regex parser has some issues and it's choking on several (so far) regex's in xinha. I'm just now starting to look at this to see if I can rewrite these regex's such that all the browsers will accept them. If you have any info on this issue then please let me know...
Thanks again
-Ben
Offline
problem is now making it work with IE5 for OS X
AFAIK, IE5 on Mac does not support contentEditable, so it's just not going to work, at all, ever.
As far as JS in the editor goes, what is required to support it is for "shielded" code, a-la Dreamweaver. It's slated for after V1.0, unless somebody comes up with it as a plugin before then, in which case we can just include it straight off (no new features in the core before 1.0, but new plugins are always welcome).
James Sleeman
Offline
Ok thanks.
A bit of confusion on the IE version issue.. it turns out that contentEditable is supported in "IE5".. versions 5.5 and later.
But the newest version of IE for mac is 5.3
Bummer.
The upside of this is that I don't have to rewrite all those regex's for greedy matching
Offline
Ben,
I uploaded a current htmlarea.js file with the patch to support JavaScript in ticket 287. I also supplied the code I am using to prevent javascript from executing in the editor. The only bug I am aware of is that onLoad events are removed from the body tag. You can download the file and try it out (but not in Mac IE!). I'm pretty happy with it.
After testing the regex based code in ticket 253, I found that in its current form it would not work properly with JavaScript because it breaks the formatting in the script node, causing errors.
Have fun!
Mike
Offline