1 | /* |
---|
2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
4 | * |
---|
5 | * == BEGIN LICENSE == |
---|
6 | * |
---|
7 | * Licensed under the terms of any of the following licenses at your |
---|
8 | * choice: |
---|
9 | * |
---|
10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
11 | * http://www.gnu.org/licenses/gpl.html |
---|
12 | * |
---|
13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
14 | * http://www.gnu.org/licenses/lgpl.html |
---|
15 | * |
---|
16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
18 | * |
---|
19 | * == END LICENSE == |
---|
20 | * |
---|
21 | * These are some Regular Expresions used by the editor. |
---|
22 | */ |
---|
23 | |
---|
24 | var FCKRegexLib = |
---|
25 | { |
---|
26 | // This is the Regular expression used by the SetHTML method for the "'" entity. |
---|
27 | AposEntity : /'/gi , |
---|
28 | |
---|
29 | // Used by the Styles combo to identify styles that can't be applied to text. |
---|
30 | ObjectElements : /^(?:IMG|TABLE|TR|TD|TH|INPUT|SELECT|TEXTAREA|HR|OBJECT|A|UL|OL|LI)$/i , |
---|
31 | |
---|
32 | // List all named commands (commands that can be interpreted by the browser "execCommand" method. |
---|
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 , |
---|
34 | |
---|
35 | BodyContents : /([\s\S]*\<body[^\>]*\>)([\s\S]*)(\<\/body\>[\s\S]*)/i , |
---|
36 | |
---|
37 | // Temporary text used to solve some browser specific limitations. |
---|
38 | ToReplace : /___fcktoreplace:([\w]+)/ig , |
---|
39 | |
---|
40 | // Get the META http-equiv attribute from the tag. |
---|
41 | MetaHttpEquiv : /http-equiv\s*=\s*["']?([^"' ]+)/i , |
---|
42 | |
---|
43 | HasBaseTag : /<base /i , |
---|
44 | |
---|
45 | HtmlOpener : /<html\s?[^>]*>/i , |
---|
46 | HeadOpener : /<head\s?[^>]*>/i , |
---|
47 | HeadCloser : /<\/head\s*>/i , |
---|
48 | |
---|
49 | // Temporary classes (Tables without border, Anchors with content) used in IE |
---|
50 | FCK_Class : /(\s*FCK__[A-Za-z]*\s*)/ , |
---|
51 | |
---|
52 | // Validate element names (it must be in lowercase). |
---|
53 | ElementName : /(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/ , |
---|
54 | |
---|
55 | // Used in conjuction with the FCKConfig.ForceSimpleAmpersand configuration option. |
---|
56 | ForceSimpleAmpersand : /___FCKAmp___/g , |
---|
57 | |
---|
58 | // Get the closing parts of the tags with no closing tags, like <br/>... gets the "/>" part. |
---|
59 | SpaceNoClose : /\/>/g , |
---|
60 | |
---|
61 | // Empty elements may be <p></p> or even a simple opening <p> (see #211). |
---|
62 | EmptyParagraph : /^<([^ >]+)[^>]*>\s*(<\/\1>)?$/ , |
---|
63 | |
---|
64 | EmptyOutParagraph : /^<([^ >]+)[^>]*>(?:\s*| )(<\/\1>)?$/ , |
---|
65 | |
---|
66 | TagBody : /></ , |
---|
67 | |
---|
68 | StrongOpener : /<STRONG([ \>])/gi , |
---|
69 | StrongCloser : /<\/STRONG>/gi , |
---|
70 | EmOpener : /<EM([ \>])/gi , |
---|
71 | EmCloser : /<\/EM>/gi , |
---|
72 | //AbbrOpener : /<ABBR([ \>])/gi , |
---|
73 | //AbbrCloser : /<\/ABBR>/gi , |
---|
74 | |
---|
75 | GeckoEntitiesMarker : /#\?-\:/g , |
---|
76 | |
---|
77 | // We look for the "src" and href attribute with the " or ' or whithout one of |
---|
78 | // them. We have to do all in one, otherwhise we will have problems with URLs |
---|
79 | // like "thumbnail.php?src=someimage.jpg" (SF-BUG 1554141). |
---|
80 | ProtectUrlsImg : /<img(?=\s).*?\ssrc=((?:("|').*?\2)|(?:[^"'][^ >]+))/gi , |
---|
81 | ProtectUrlsA : /<a(?=\s).*?\shref=((?:("|').*?\2)|(?:[^"'][^ >]+))/gi , |
---|
82 | |
---|
83 | Html4DocType : /HTML 4\.0 Transitional/i , |
---|
84 | DocTypeTag : /<!DOCTYPE[^>]*>/i , |
---|
85 | |
---|
86 | // These regex are used to save the original event attributes in the HTML. |
---|
87 | TagsWithEvent : /<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g , |
---|
88 | EventAttributes : /\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g, |
---|
89 | ProtectedEvents : /\s\w+_fckprotectedatt="([^"]+)"/g, |
---|
90 | |
---|
91 | StyleProperties : /\S+\s*:/g, |
---|
92 | |
---|
93 | // [a-zA-Z0-9:]+ seams to be more efficient than [\w:]+ |
---|
94 | InvalidSelfCloseTags : /(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi |
---|
95 | } ; |
---|