Ticket #95 (closed Bug: fixed)

Opened 8 years ago

Last modified 7 years ago

Content page broken with tag <META ...>.

Reported by: ic@… Owned by: martinkou
Priority: Normal Milestone: FCKeditor 2.5 Beta
Component: General Version: FCKeditor 2.4
Keywords: IE, Confirmed Cc:

Description

After a html insertion in "source" mode, and switch between "wysiwyg", "source" mode, content is broken: Insert HTML:

<html>
<head>
<meta http-equiv="Content-Typ!" content="text/html; charset=windows-1251">
<title>Title</title>
</head>
<body>
Some text.
</body>
</html>

After switch between "wysiwyg", "source" mode:

<p>
<meta content="text/html; charset=windows-1251" http-equiv="Content-Typ!" /></p>

Browser IE 6.0.

Change History

comment:1 Changed 8 years ago by alfonsoml

It does work for me.

Are you using the Full page editing?

comment:2 Changed 8 years ago by ic@…

Sometimes, users load content (copy-paste) in FCKEditor "source" mode, from source IE :(.

comment:3 Changed 8 years ago by ic

With oFCKeditor.Config.FullPage = true, removed "<link rel="stylesheet" ..>" after "<META...>" before:

<html>
    <head>
        <title>Title</title>
<meta http-equiv="Content-Typ!" content="text/html; charset=windows-1251">
<link href="/style/style_ie.css" rel="stylesheet" type="text/css">
   </head>
    <body>
        Some text.
    </body>
</html>

after:

<html>
    <head>
        <title>Title</title>
        <meta content="text/html; charset=windows-1251" http-equiv="Content-Typ!" />
    </head>
    <body>
        Some text.
    </body>
</html>

Sample 2, "<link rel="stylesheet" ..>" before "<META...>" before

<html>
    <head>
        <link href="/style/style_ie.css" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Typ!" content="text/html; charset=windows-1251">
        <title>Title</title>
    </head>
    <body>
        Some text.
    </body>
</html>

after:

<html>
    <head>
        <title>Title</title>
        <link href="/style/style_ie.css" type="text/css" rel="stylesheet" />
        <meta content="text/html; charset=windows-1251" http-equiv="Content-Typ!" />
    </head>
    <body>
        Some text.
    </body>
</html>

All OK!!!

comment:4 Changed 8 years ago by fredck

  • Owner fredck deleted
  • Component changed from Server : ASP to General
  • Milestone set to FCKeditor 2.5

Confirmed with IE as described by ic. Ok with Firefox.

When FullPage=true, it only happens if <link> is after <meta> and if <meta> doesn't have the self-closing slash (like <meta />).

Other than that, we shouldn't really care about <meta> and <styles> if not in FullPage. If users don't know what they are doing, they will have unwanted results, and in this case the missing of the <style> is note critical.

comment:5 Changed 8 years ago by fredck

  • Keywords IE, Confirmed added

comment:6 Changed 7 years ago by kae

also confirmed for Firefox. FCKeditor 2.4.3, Firefox 2.0.0.5

comment:7 Changed 7 years ago by kae

I dug into this (for firefox) and noticed the regexp for protecting <meta> tags was not working. the relevant line is in fck.js, in ProtectedTags(): oRegex = new RegExp( '<((' + sTags + ')(?=\s|>)[\s\S]*?)/?>', 'gi' ) ;

not sure what that's supposed to do, but this does the trick for me: oRegex = new RegExp( '<((' + sTags + ')[>]*)/?>', 'gi' ) ;

on a meta such as this: <meta blah="blah" /> it converts to this: <FCK:meta blah="blah" / />

works for me!

comment:8 Changed 7 years ago by kae

huh... will try that again...

was:

oRegex = new RegExp( '<((' + sTags + ')(?=\s|>)[\s\S]*?)/?>', 'gi' ) ;

is now:

oRegex = new RegExp( '<((' + sTags + ')[^>]*)/?>', 'gi' ) ;

comment:9 Changed 7 years ago by martinkou

  • Status changed from new to assigned
  • Owner set to martinkou

comment:10 Changed 7 years ago by fredck

  • Status changed from assigned to closed
  • Resolution set to fixed

I cannot reproduce this one anymore. I think it has been fixed with [219].

comment:11 Changed 7 years ago by kae

  • Status changed from closed to reopened
  • Resolution fixed deleted

Please reopen this - the bug is still there. As a demonstration, here is some code that shows that original meta is not protected with the "<FCK:" prefix

<html>
    <head>
        <script type="text/javascript"><!--
        var text='<'+'meta test="test" />';
        var sTags='META';
        var oRegex=new RegExp('<(('+sTags+')(?=\s|>)[\s\S]*?)/?>','gi');
        var NewReg=new RegExp('<(('+sTags+')[^>]*?)/?>','gi');
        alert(
            "original text:\n "+text+
            "\n\nusing old regexp:\n "+text.replace(oRegex,'<FCK:$1 />')+
            "\n\nusing new regexp:\n "+text.replace(NewReg,'<FCK:$1 />'));
        --></script>
    </head>
    <body>
    </body>
</html>

comment:12 Changed 7 years ago by martinkou

The bug you mentioned was fixed in [321]. The problem with the old regular expression was that the character class symbols were improperly escaped. The expression we're using in 2.4.3 and in the SVN is this:

oRegex = new RegExp( '<((' + sTags + ')(?=\\s|>|/)[\\s\\S]*?)/?>', 'gi' ) ;

Substituting the expression currently in our code releases to your test case:

<html>
    <head>
        <script type="text/javascript"><!--
        var text='<'+'meta test="test" />';
        var sTags='META';
        var oRegex=new RegExp('<(('+sTags+')(?=\\s|>)[\\s\\S]*?)/?>','gi');
        var NewReg=new RegExp('<(('+sTags+')[^>]*?)/?>','gi');
        alert(
            "original text:\n "+text+
            "\n\nusing old regexp:\n "+text.replace(oRegex,'<FCK:$1 />')+
            "\n\nusing new regexp:\n "+text.replace(NewReg,'<FCK:$1 />'));
        --></script>
    </head>
    <body>
    </body>
</html>

Both expressions resulted in the correct <FCK:meta ...> tag instead of the unprotected <meta ...> tag.

comment:13 Changed 7 years ago by kae

ah! gotcha. sorry about that - I missed the double backslashes.

I don't have the option here to close the bug again, so I'll leave that to you.

comment:14 Changed 7 years ago by martinkou

  • Status changed from reopened to closed
  • Resolution set to fixed

Ok, so the issue is fixed. I'm closing the ticket.

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy