Hi — thanks for creating this great module!

Unfortunately it conflicts with the WYSIWYG module's javascript — not sure why. If I remove the following line from the end of my page HTML, this module works perfectly:

<script type="text/javascript" src="/sites/all/modules/wysiwyg/wysiwyg.js?L"></script>

The above is added to my markup via the <?php print $closure ?> in my page.tpl.php.

Something in the wysiwyg module must be breaking yours - I wonder if you could add some js in at the very end after the wysiwyg js, to get yours going again?

Jeff

Comments

jeff h’s picture

Hmm, after more testing, it appears that this is the case only in Safari (tested in OS X, Safari 4 beta). Works fine in Firefox.

Jeff

mattyoung’s picture

Status: Active » Postponed (maintainer needs more info)

Let me know if you find something to fix here.

mattyoung’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No further information received. Mark close.

siromega’s picture

Version: 6.x-1.10 » 6.x-1.x-dev
Status: Closed (fixed) » Active

I have more information as to this issue.

D6.13
WYSIWYG 6.x-2.0 w/ FCKEditor 2.6.4
Syntax Highlighter (the one you gave me from the other bug I filed)

The bug does not happen in FF 3.5, but does occur in IE7, Chrome 2 and Safari 4. One example of where this will break is below..

wysiwyg.js line 195

  for (var i in classes) {
    if (jQuery.isFunction(i) || typeof(i) == "object" || i == "indexOf") 
      continue;
    if (classes[i].substr(0, 8) == 'wysiwyg-') {
      var parts = classes[i].split('-');
      var value = parts.slice(2).join('-');
      params[parts[1]] = value;
    }
  }

The issue is that the Syntax Highlighter JS is attaching a method to Array.Prototype (line 1534 of non-minified shCore.js from here). This is interfering with a number of things in the WYSIWYG JS code. In the code above, the for (var i in classes) will return 0...array.length-1 as well as the string "indexOf" because the function has been added to the array prototype. This will occur several places throughout the WYSIWYG code, and possibly in the chosen editor code (in my case, FCKEdtior).

I guess the solution would be to patch Syntax Highlighter JS to remove adding indexOf to the array prototype. No idea how easy/hard that would be though. I will hopefully spend a little time on this today to see what I can get figured out...

Update: I proposed a patch to the Syntax Highlighter JS to move the offending indexOf function from the array prototype to sh.utils.

mattyoung’s picture

Ah, the for(.. in ..) to iterate for array, it will always give you more than you expect.

It's great you got this figure out. This is probably why syntaxhighlighter broke IMCE also.

I'm leaving this as 'active'. Hopefully Alex will fix this in the js library.

Please keep me updated to this issue.

Thanks!

mattyoung’s picture

And have you reported your finding to http://alexgorbatchev.com/forums/?

wgrunberg’s picture

@siromega could you (or anybody else) post a patched version of the syntaxhighlight JS library? I tried applying the proposed patch by hand without success.

wgrunberg’s picture

Status: Active » Closed (fixed)

The Syntax Highlighter JS library has been adapted:
http://alexgorbatchev.com/wiki/SyntaxHighlighter:Changes:2.1.364 Issue #63