Skip to content

Commit

Permalink
Fixed #19537: embedded objects no longer display name
Browse files Browse the repository at this point in the history
  • Loading branch information
dpobel committed Aug 8, 2012
1 parent b305e9a commit 201c7c3
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions design/standard/javascript/themes/ez/editor_template.js
Expand Up @@ -242,23 +242,6 @@
{
var body = ed.getBody();

// Replace the content of the embed tags that are just there for oe preview
// by 'ezembed'. This is to avoid that the ez xml parsers in some cases
// duplicates the embed tag and to avoid that TinyMCE strips too much the HTML code
// see http://issues.ez.no/18264
jQuery.each( body.getElementsByTagName('div'), function( i, node )
{
if ( node && node.className.indexOf('ezoeItemNonEditable') !== -1 )
$(node).html('ezembed');
});
jQuery.each( body.getElementsByTagName('span'), function( i, node )
{
if ( node && node.className.indexOf('ezoeItemNonEditable') !== -1 )
$(node).html('ezembed');
else if ( node && node.className.indexOf('ezoeItemTempSpan') !== -1 && node.innerHTML.indexOf(' ') === 0 )
node.firstChild.replaceData( 0, 1, ' ' );
});

// @todo: Might not be needed anymore now that we don't use save handler and overwrite html
// Fix link cleanup issues in IE 6 / 7 (it adds the current url before the anchor and invalid urls)
var currenthost = document.location.protocol + '//' + document.location.host;
Expand All @@ -270,6 +253,29 @@
}
});

// eZ: custom cleanup code to only affect the content of the textarea,
// not the visible text in the editor
ed.onSaveContent.add(function(ed, o) {
var $f = $('<div>' + o.content + '</div>', null);

// Replace the content of the embed tags that are just there for oe preview
// by 'ezembed'. This is to avoid that the ez xml parsers in some cases
// duplicates the embed tag and to avoid that TinyMCE strips too much the HTML code
// see http://issues.ez.no/18264
$f.find('div.ezoeItemNonEditable').each(function(i, node) {
$(node).html('ezembed');
});

$f.find('span').each(function(i, node) {
if ( node && node.className.indexOf('ezoeItemNonEditable') !== -1 )
$(node).html('ezembed');
else if ( node && node.className.indexOf('ezoeItemTempSpan') !== -1 && node.innerHTML.indexOf('&nbsp;') === 0 )
node.firstChild.replaceData( 0, 1, ' ' );
});

o.content = $f.html();
});

// eZ: Support several editor content css files using custom ez setting
if ( s.theme_ez_editor_css )
{
Expand Down

0 comments on commit 201c7c3

Please sign in to comment.