Skip to content

Commit

Permalink
Item2618: Merge to trunk (fix __caret span tinymce artifact)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x00@6134 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Jan 24, 2010
1 parent 261bd45 commit 20fd86d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,16 @@ sub cleanNode {
delete $this->{attrs}->{$a};
}
}

# Sometimes (rarely!) there's a <span id='__caret'> </span>, an artifact of
# one of the strategies TinyMCE uses to recover lost cursor positioning, see
# Item2618 where this can break TML tables. #SMELL: TMCE specific
if ( ( $this->{tag} eq 'span' ) && ( defined $this->{attrs}->{id} ) &&
( $this->{attrs}->{id} eq '__caret' ) ) {
$this->{tag} = q{};
$this->{attrs} = {};
$this->{nodeType} = 0; #PROCESSING_INSTRUCTION_NODE
}
}

######################################################
Expand Down
12 changes: 12 additions & 0 deletions WysiwygPlugin/test/unit/WysiwygPlugin/ExtendedTranslatorTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,18 @@ DOT
tml => '<img src="%PUBURLPATH%">',
html => '<div class="WYSIWYG_PROTECTED">&lt;img&nbsp;src="%PUBURLPATH%"&gt;</div>'
},
{
name => 'Item2618_ExtraneousCaretMarkerInTables',
exec => $HTML2TML | $ROUNDTRIP,
html => <<'HERE',
<table border="0"> <tbody>
<tr> <td>Foo</td> <span id="__caret"> </span> <td>a</td> </tr>
</tbody> </table>
HERE
tml => <<'HERE',
| Foo | a |
HERE
},
];

sub gen_compare_tests {
Expand Down

0 comments on commit 20fd86d

Please sign in to comment.