diff --git a/syntaxhighlighter_insert_wysiwyg/plugins/syntaxhighlighter_insert_wysiwyg/syntaxhighlighter_insert_wysiwyg.js b/syntaxhighlighter_insert_wysiwyg/plugins/syntaxhighlighter_insert_wysiwyg/syntaxhighlighter_insert_wysiwyg.js index fa24014..ed83167 100644 --- a/syntaxhighlighter_insert_wysiwyg/plugins/syntaxhighlighter_insert_wysiwyg/syntaxhighlighter_insert_wysiwyg.js +++ b/syntaxhighlighter_insert_wysiwyg/plugins/syntaxhighlighter_insert_wysiwyg/syntaxhighlighter_insert_wysiwyg.js @@ -33,6 +33,22 @@ Drupal.wysiwyg.plugins.syntaxhighlighter_insert_wysiwyg = { Drupal.wysiwyg.plugins.syntaxhighlighter_insert_wysiwyg.insert_form(data, settings, instanceId); }, + convertSpecialCharToHtml: function (data) { + + var chartohtml = { + + "'": ''', + '"': '"', + '&': '&', + '<': '<', + '>': '>' + + }; + + return data.replace(/['"&<>]/g, function(thespchar) { return chartohtml[thespchar]; }); + }, + + insert_form: function (data, settings, instanceId) { Drupal.syntaxhighlighterinsert.hideDescriptions(); @@ -86,6 +102,11 @@ Drupal.wysiwyg.plugins.syntaxhighlighter_insert_wysiwyg = { content += 'toolbar: ' + new Boolean(toolbar).toString() + '; '; content += 'codetag" '; if (title.length) content += 'title="' + title + '" '; + + + if (brush == 'xml' || Boolean(htmlscript).toString() == 'true' ) + code=Drupal.wysiwyg.plugins.syntaxhighlighter_insert_wysiwyg.convertSpecialCharToHtml(code); + content += ' id="shinsert-current-tag"> ' + code + ' '; Drupal.wysiwyg.plugins.syntaxhighlighter_insert_wysiwyg.insertIntoEditor(content, editor_id); jQuery(this).dialog("close");