2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
\r
5 * == BEGIN LICENSE ==
\r
7 * Licensed under the terms of any of the following licenses at your
\r
10 * - GNU General Public License Version 2 or later (the "GPL")
\r
11 * http://www.gnu.org/licenses/gpl.html
\r
13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
14 * http://www.gnu.org/licenses/lgpl.html
\r
16 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
17 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
21 * These are some Regular Expressions used by the editor.
\r
26 // This is the Regular expression used by the SetData method for the "'" entity.
\r
27 AposEntity : /'/gi ,
\r
29 // Used by the Styles combo to identify styles that can't be applied to text.
\r
30 ObjectElements : /^(?:IMG|TABLE|TR|TD|TH|INPUT|SELECT|TEXTAREA|HR|OBJECT|A|UL|OL|LI)$/i ,
\r
32 // List all named commands (commands that can be interpreted by the browser "execCommand" method.
\r
33 NamedCommands : /^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i ,
\r
35 BeforeBody : /(^[\s\S]*\<body[^\>]*\>)/i,
\r
36 AfterBody : /(\<\/body\>[\s\S]*$)/i,
\r
38 // Temporary text used to solve some browser specific limitations.
\r
39 ToReplace : /___fcktoreplace:([\w]+)/ig ,
\r
41 // Get the META http-equiv attribute from the tag.
\r
42 MetaHttpEquiv : /http-equiv\s*=\s*["']?([^"' ]+)/i ,
\r
44 HasBaseTag : /<base /i ,
\r
45 HasBodyTag : /<body[\s|>]/i ,
\r
47 HtmlOpener : /<html\s?[^>]*>/i ,
\r
48 HeadOpener : /<head\s?[^>]*>/i ,
\r
49 HeadCloser : /<\/head\s*>/i ,
\r
51 // Temporary classes (Tables without border, Anchors with content) used in IE
\r
52 FCK_Class : /\s*FCK__[^ ]*(?=\s+|$)/ ,
\r
54 // Validate element names (it must be in lowercase).
\r
55 ElementName : /(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/ ,
\r
57 // Used in conjunction with the FCKConfig.ForceSimpleAmpersand configuration option.
\r
58 ForceSimpleAmpersand : /___FCKAmp___/g ,
\r
60 // Get the closing parts of the tags with no closing tags, like <br/>... gets the "/>" part.
\r
61 SpaceNoClose : /\/>/g ,
\r
63 // Empty elements may be <p></p> or even a simple opening <p> (see #211).
\r
64 EmptyParagraph : /^<(p|div|address|h\d|center)(?=[ >])[^>]*>\s*(<\/\1>)?$/ ,
\r
66 EmptyOutParagraph : /^<(p|div|address|h\d|center)(?=[ >])[^>]*>(?:\s*| )(<\/\1>)?$/ ,
\r
70 GeckoEntitiesMarker : /#\?-\:/g ,
\r
72 // We look for the "src" and href attribute with the " or ' or without one of
\r
73 // them. We have to do all in one, otherwise we will have problems with URLs
\r
74 // like "thumbnail.php?src=someimage.jpg" (SF-BUG 1554141).
\r
75 ProtectUrlsImg : /<img(?=\s).*?\ssrc=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
\r
76 ProtectUrlsA : /<a(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
\r
77 ProtectUrlsArea : /<area(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
\r
79 Html4DocType : /HTML 4\.0 Transitional/i ,
\r
80 DocTypeTag : /<!DOCTYPE[^>]*>/i ,
\r
81 HtmlDocType : /DTD HTML/ ,
\r
83 // These regex are used to save the original event attributes in the HTML.
\r
84 TagsWithEvent : /<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g ,
\r
85 EventAttributes : /\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g,
\r
86 ProtectedEvents : /\s\w+_fckprotectedatt="([^"]+)"/g,
\r
88 StyleProperties : /\S+\s*:/g,
\r
90 // [a-zA-Z0-9:]+ seams to be more efficient than [\w:]+
\r
91 InvalidSelfCloseTags : /(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi,
\r
93 // All variables defined in a style attribute or style definition. The variable
\r
94 // name is returned with $2.
\r
95 StyleVariableAttName : /#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,
\r
97 RegExp : /^\/(.*)\/([gim]*)$/,
\r
99 HtmlTag : /<[^\s<>](?:"[^"]*"|'[^']*'|[^<])*>/
\r