Opened 18 years ago

Closed 18 years ago

#95 closed Bug (fixed)

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

Reported by: ic@… Owned by: Martin Kou
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 (14)

comment:1 Changed 18 years ago by Alfonso Martínez de Lizarrondo

It does work for me.

Are you using the Full page editing?

comment:2 Changed 18 years ago by ic@…

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

comment:3 Changed 18 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 18 years ago by Frederico Caldeira Knabben

Component: Server : ASPGeneral
Milestone: FCKeditor 2.5
Owner: Frederico Caldeira Knabben deleted

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 18 years ago by Frederico Caldeira Knabben

Keywords: IE Confirmed added

comment:6 Changed 18 years ago by kae

also confirmed for Firefox. FCKeditor 2.4.3, Firefox 2.0.0.5

comment:7 Changed 18 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 18 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 18 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

comment:10 Changed 18 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: assignedclosed

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

comment:11 Changed 18 years ago by kae

Resolution: fixed
Status: closedreopened

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 18 years ago by Martin Kou

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 18 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 18 years ago by Martin Kou

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy