liquid_feedback_frontend

diff static/wysihtml/advanced.js @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/static/wysihtml/advanced.js	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -0,0 +1,558 @@
     1.4 +/**
     1.5 + * Full HTML5 compatibility rule set
     1.6 + * These rules define which tags and CSS classes are supported and which tags should be specially treated.
     1.7 + *
     1.8 + * Examples based on this rule set:
     1.9 + *
    1.10 + *    <a href="http://foobar.com">foo</a>
    1.11 + *    ... becomes ...
    1.12 + *    <a href="http://foobar.com" target="_blank" rel="nofollow">foo</a>
    1.13 + *
    1.14 + *    <img align="left" src="http://foobar.com/image.png">
    1.15 + *    ... becomes ...
    1.16 + *    <img class="wysiwyg-float-left" src="http://foobar.com/image.png" alt="">
    1.17 + *
    1.18 + *    <div>foo<script>alert(document.cookie)</script></div>
    1.19 + *    ... becomes ...
    1.20 + *    <div>foo</div>
    1.21 + *
    1.22 + *    <marquee>foo</marquee>
    1.23 + *    ... becomes ...
    1.24 + *    <span>foo</span>
    1.25 + *
    1.26 + *    foo <br clear="both"> bar
    1.27 + *    ... becomes ...
    1.28 + *    foo <br class="wysiwyg-clear-both"> bar
    1.29 + *
    1.30 + *    <div>hello <iframe src="http://google.com"></iframe></div>
    1.31 + *    ... becomes ...
    1.32 + *    <div>hello </div>
    1.33 + *
    1.34 + *    <center>hello</center>
    1.35 + *    ... becomes ...
    1.36 + *    <div class="wysiwyg-text-align-center">hello</div>
    1.37 + */
    1.38 +var wysihtmlParserRules = {
    1.39 +    /**
    1.40 +     * CSS Class white-list
    1.41 +     * Following CSS classes won't be removed when parsed by the wysihtml HTML parser
    1.42 +     */
    1.43 +    "classes": {
    1.44 +        "wysiwyg-clear-both": 1,
    1.45 +        "wysiwyg-clear-left": 1,
    1.46 +        "wysiwyg-clear-right": 1,
    1.47 +        "wysiwyg-color-aqua": 1,
    1.48 +        "wysiwyg-color-black": 1,
    1.49 +        "wysiwyg-color-blue": 1,
    1.50 +        "wysiwyg-color-fuchsia": 1,
    1.51 +        "wysiwyg-color-gray": 1,
    1.52 +        "wysiwyg-color-green": 1,
    1.53 +        "wysiwyg-color-lime": 1,
    1.54 +        "wysiwyg-color-maroon": 1,
    1.55 +        "wysiwyg-color-navy": 1,
    1.56 +        "wysiwyg-color-olive": 1,
    1.57 +        "wysiwyg-color-purple": 1,
    1.58 +        "wysiwyg-color-red": 1,
    1.59 +        "wysiwyg-color-silver": 1,
    1.60 +        "wysiwyg-color-teal": 1,
    1.61 +        "wysiwyg-color-white": 1,
    1.62 +        "wysiwyg-color-yellow": 1,
    1.63 +        "wysiwyg-float-left": 1,
    1.64 +        "wysiwyg-float-right": 1,
    1.65 +        "wysiwyg-font-size-large": 1,
    1.66 +        "wysiwyg-font-size-larger": 1,
    1.67 +        "wysiwyg-font-size-medium": 1,
    1.68 +        "wysiwyg-font-size-small": 1,
    1.69 +        "wysiwyg-font-size-smaller": 1,
    1.70 +        "wysiwyg-font-size-x-large": 1,
    1.71 +        "wysiwyg-font-size-x-small": 1,
    1.72 +        "wysiwyg-font-size-xx-large": 1,
    1.73 +        "wysiwyg-font-size-xx-small": 1,
    1.74 +        "wysiwyg-text-align-center": 1,
    1.75 +        "wysiwyg-text-align-justify": 1,
    1.76 +        "wysiwyg-text-align-left": 1,
    1.77 +        "wysiwyg-text-align-right": 1
    1.78 +    },
    1.79 +    /**
    1.80 +     * Tag list
    1.81 +     *
    1.82 +     * The following options are available:
    1.83 +     *
    1.84 +     *    - add_class:        converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
    1.85 +     *                        The following methods are implemented in wysihtml.dom.parse:
    1.86 +     *                          - align_text:  converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
    1.87 +     *                            <p align="center">foo</p> ... becomes ... <p class="wysiwyg-text-align-center">foo</p>
    1.88 +     *                          - clear_br:    converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
    1.89 +     *                            <br clear="all"> ... becomes ... <br class="wysiwyg-clear-both">
    1.90 +     *                          - align_img:    converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
    1.91 +     *
    1.92 +     *    - add_style:        converts and deletes the given HTML4 attribute (align) via the given method to a css style
    1.93 +     *                        The following methods are implemented in wysihtml.dom.parse:
    1.94 +     *                          - align_text:  converts align attribute values (right/left/center) to their corresponding css style)
    1.95 +     *                            <p align="center">foo</p> ... becomes ... <p style="text-align:center">foo</p>
    1.96 +     *
    1.97 +     *    - remove:             removes the element and its content
    1.98 +     *
    1.99 +     *    - unwrap              removes element but leaves content
   1.100 +     *
   1.101 +     *    - rename_tag:         renames the element to the given tag
   1.102 +     *
   1.103 +     *    - set_class:          adds the given class to the element (note: make sure that the class is in the "classes" white list above)
   1.104 +     *
   1.105 +     *    - set_attributes:     sets/overrides the given attributes
   1.106 +     *
   1.107 +     *    - check_attributes:   checks the given HTML attribute via the given method
   1.108 +     *                            - url:            allows only valid urls (starting with http:// or https://)
   1.109 +     *                            - src:            allows something like "/foobar.jpg", "http://google.com", ...
   1.110 +     *                            - href:           allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
   1.111 +     *                            - alt:            strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
   1.112 +     *                            - numbers:        ensures that the attribute only contains numeric (integer) characters (no float values or units)
   1.113 +     *                            - dimension:      for with/height attributes where floating point numbrs and percentages are allowed
   1.114 +     *                            - any:            allows anything to pass 
   1.115 +     */
   1.116 +    "tags": {
   1.117 +        "tr": {
   1.118 +            "add_class": {
   1.119 +                "align": "align_text"
   1.120 +            }
   1.121 +        },
   1.122 +        "strike": {
   1.123 +            "remove": 1
   1.124 +        },
   1.125 +        "form": {
   1.126 +            "rename_tag": "div"
   1.127 +        },
   1.128 +        "rt": {
   1.129 +            "rename_tag": "span"
   1.130 +        },
   1.131 +        "code": {},
   1.132 +        "acronym": {
   1.133 +            "rename_tag": "span"
   1.134 +        },
   1.135 +        "br": {
   1.136 +            "add_class": {
   1.137 +                "clear": "clear_br"
   1.138 +            }
   1.139 +        },
   1.140 +        "details": {
   1.141 +            "rename_tag": "div"
   1.142 +        },
   1.143 +        "h4": {
   1.144 +            "add_class": {
   1.145 +                "align": "align_text"
   1.146 +            }
   1.147 +        },
   1.148 +        "em": {},
   1.149 +        "title": {
   1.150 +            "remove": 1
   1.151 +        },
   1.152 +        "multicol": {
   1.153 +            "rename_tag": "div"
   1.154 +        },
   1.155 +        "figure": {
   1.156 +            "rename_tag": "div"
   1.157 +        },
   1.158 +        "xmp": {
   1.159 +            "rename_tag": "span"
   1.160 +        },
   1.161 +        "small": {
   1.162 +            "rename_tag": "span",
   1.163 +            "set_class": "wysiwyg-font-size-smaller"
   1.164 +        },
   1.165 +        "area": {
   1.166 +            "remove": 1
   1.167 +        },
   1.168 +        "time": {
   1.169 +            "rename_tag": "span"
   1.170 +        },
   1.171 +        "dir": {
   1.172 +            "rename_tag": "ul"
   1.173 +        },
   1.174 +        "bdi": {
   1.175 +            "rename_tag": "span"
   1.176 +        },
   1.177 +        "command": {
   1.178 +            "remove": 1
   1.179 +        },
   1.180 +        "ul": {},
   1.181 +        "progress": {
   1.182 +            "rename_tag": "span"
   1.183 +        },
   1.184 +        "dfn": {
   1.185 +            "rename_tag": "span"
   1.186 +        },
   1.187 +        "iframe": {
   1.188 +            "remove": 1
   1.189 +        },
   1.190 +        "figcaption": {
   1.191 +            "rename_tag": "div"
   1.192 +        },
   1.193 +        "a": {
   1.194 +            "check_attributes": {
   1.195 +                "target": "any",
   1.196 +                "href": "url" // if you compiled master manually then change this from 'url' to 'href'
   1.197 +            },
   1.198 +            "set_attributes": {
   1.199 +                "rel": "nofollow"
   1.200 +            }
   1.201 +        },
   1.202 +        "img": {
   1.203 +            "check_attributes": {
   1.204 +                "width": "dimension",
   1.205 +                "alt": "alt",
   1.206 +                "src": "url", // if you compiled master manually then change this from 'url' to 'src'
   1.207 +                "height": "dimension"
   1.208 +            },
   1.209 +            "add_class": {
   1.210 +                "align": "align_img"
   1.211 +            }
   1.212 +        },
   1.213 +        "rb": {
   1.214 +            "rename_tag": "span"
   1.215 +        },
   1.216 +        "footer": {
   1.217 +            "rename_tag": "div"
   1.218 +        },
   1.219 +        "noframes": {
   1.220 +            "remove": 1
   1.221 +        },
   1.222 +        "abbr": {
   1.223 +            "rename_tag": "span"
   1.224 +        },
   1.225 +        "u": {},
   1.226 +        "bgsound": {
   1.227 +            "remove": 1
   1.228 +        },
   1.229 +        "address": {
   1.230 +            "rename_tag": "div"
   1.231 +        },
   1.232 +        "basefont": {
   1.233 +            "remove": 1
   1.234 +        },
   1.235 +        "nav": {
   1.236 +            "rename_tag": "div"
   1.237 +        },
   1.238 +        "h1": {
   1.239 +            "add_class": {
   1.240 +                "align": "align_text"
   1.241 +            }
   1.242 +        },
   1.243 +        "head": {
   1.244 +            "remove": 1
   1.245 +        },
   1.246 +        "tbody": {
   1.247 +            "add_class": {
   1.248 +                "align": "align_text"
   1.249 +            }
   1.250 +        },
   1.251 +        "dd": {
   1.252 +            "rename_tag": "div"
   1.253 +        },
   1.254 +        "s": {
   1.255 +            "rename_tag": "span"
   1.256 +        },
   1.257 +        "li": {},
   1.258 +        "td": {
   1.259 +            "check_attributes": {
   1.260 +                "rowspan": "numbers",
   1.261 +                "colspan": "numbers"
   1.262 +            },
   1.263 +            "add_class": {
   1.264 +                "align": "align_text"
   1.265 +            }
   1.266 +        },
   1.267 +        "object": {
   1.268 +            "remove": 1
   1.269 +        },
   1.270 +        "div": {
   1.271 +            "add_class": {
   1.272 +                "align": "align_text"
   1.273 +            }
   1.274 +        },
   1.275 +        "option": {
   1.276 +            "rename_tag": "span"
   1.277 +        },
   1.278 +        "select": {
   1.279 +            "rename_tag": "span"
   1.280 +        },
   1.281 +        "i": {},
   1.282 +        "track": {
   1.283 +            "remove": 1
   1.284 +        },
   1.285 +        "wbr": {
   1.286 +            "remove": 1
   1.287 +        },
   1.288 +        "fieldset": {
   1.289 +            "rename_tag": "div"
   1.290 +        },
   1.291 +        "big": {
   1.292 +            "rename_tag": "span",
   1.293 +            "set_class": "wysiwyg-font-size-larger"
   1.294 +        },
   1.295 +        "button": {
   1.296 +            "rename_tag": "span"
   1.297 +        },
   1.298 +        "noscript": {
   1.299 +            "remove": 1
   1.300 +        },
   1.301 +        "svg": {
   1.302 +            "remove": 1
   1.303 +        },
   1.304 +        "input": {
   1.305 +            "remove": 1
   1.306 +        },
   1.307 +        "table": {},
   1.308 +        "keygen": {
   1.309 +            "remove": 1
   1.310 +        },
   1.311 +        "h5": {
   1.312 +            "add_class": {
   1.313 +                "align": "align_text"
   1.314 +            }
   1.315 +        },
   1.316 +        "meta": {
   1.317 +            "remove": 1
   1.318 +        },
   1.319 +        "map": {
   1.320 +            "rename_tag": "div"
   1.321 +        },
   1.322 +        "isindex": {
   1.323 +            "remove": 1
   1.324 +        },
   1.325 +        "mark": {
   1.326 +            "rename_tag": "span"
   1.327 +        },
   1.328 +        "caption": {
   1.329 +            "add_class": {
   1.330 +                "align": "align_text"
   1.331 +            }
   1.332 +        },
   1.333 +        "tfoot": {
   1.334 +            "add_class": {
   1.335 +                "align": "align_text"
   1.336 +            }
   1.337 +        },
   1.338 +        "base": {
   1.339 +            "remove": 1
   1.340 +        },
   1.341 +        "video": {
   1.342 +            "remove": 1
   1.343 +        },
   1.344 +        "strong": {},
   1.345 +        "canvas": {
   1.346 +            "remove": 1
   1.347 +        },
   1.348 +        "output": {
   1.349 +            "rename_tag": "span"
   1.350 +        },
   1.351 +        "marquee": {
   1.352 +            "rename_tag": "span"
   1.353 +        },
   1.354 +        "b": {},
   1.355 +        "q": {
   1.356 +            "check_attributes": {
   1.357 +                "cite": "url"
   1.358 +            }
   1.359 +        },
   1.360 +        "applet": {
   1.361 +            "remove": 1
   1.362 +        },
   1.363 +        "span": {},
   1.364 +        "rp": {
   1.365 +            "rename_tag": "span"
   1.366 +        },
   1.367 +        "spacer": {
   1.368 +            "remove": 1
   1.369 +        },
   1.370 +        "source": {
   1.371 +            "remove": 1
   1.372 +        },
   1.373 +        "aside": {
   1.374 +            "rename_tag": "div"
   1.375 +        },
   1.376 +        "frame": {
   1.377 +            "remove": 1
   1.378 +        },
   1.379 +        "section": {
   1.380 +            "rename_tag": "div"
   1.381 +        },
   1.382 +        "body": {
   1.383 +            "rename_tag": "div"
   1.384 +        },
   1.385 +        "ol": {},
   1.386 +        "nobr": {
   1.387 +            "rename_tag": "span"
   1.388 +        },
   1.389 +        "html": {
   1.390 +            "rename_tag": "div"
   1.391 +        },
   1.392 +        "summary": {
   1.393 +            "rename_tag": "span"
   1.394 +        },
   1.395 +        "var": {
   1.396 +            "rename_tag": "span"
   1.397 +        },
   1.398 +        "del": {
   1.399 +            "remove": 1
   1.400 +        },
   1.401 +        "blockquote": {
   1.402 +            "check_attributes": {
   1.403 +                "cite": "url"
   1.404 +            }
   1.405 +        },
   1.406 +        "style": {
   1.407 +            "remove": 1
   1.408 +        },
   1.409 +        "device": {
   1.410 +            "remove": 1
   1.411 +        },
   1.412 +        "meter": {
   1.413 +            "rename_tag": "span"
   1.414 +        },
   1.415 +        "h3": {
   1.416 +            "add_class": {
   1.417 +                "align": "align_text"
   1.418 +            }
   1.419 +        },
   1.420 +        "textarea": {
   1.421 +            "rename_tag": "span"
   1.422 +        },
   1.423 +        "embed": {
   1.424 +            "remove": 1
   1.425 +        },
   1.426 +        "hgroup": {
   1.427 +            "rename_tag": "div"
   1.428 +        },
   1.429 +        "font": {
   1.430 +            "rename_tag": "span",
   1.431 +            "add_class": {
   1.432 +                "size": "size_font"
   1.433 +            }
   1.434 +        },
   1.435 +        "tt": {
   1.436 +            "rename_tag": "span"
   1.437 +        },
   1.438 +        "noembed": {
   1.439 +            "remove": 1
   1.440 +        },
   1.441 +        "thead": {
   1.442 +            "add_class": {
   1.443 +                "align": "align_text"
   1.444 +            }
   1.445 +        },
   1.446 +        "blink": {
   1.447 +            "rename_tag": "span"
   1.448 +        },
   1.449 +        "plaintext": {
   1.450 +            "rename_tag": "span"
   1.451 +        },
   1.452 +        "xml": {
   1.453 +            "remove": 1
   1.454 +        },
   1.455 +        "h6": {
   1.456 +            "add_class": {
   1.457 +                "align": "align_text"
   1.458 +            }
   1.459 +        },
   1.460 +        "param": {
   1.461 +            "remove": 1
   1.462 +        },
   1.463 +        "th": {
   1.464 +            "check_attributes": {
   1.465 +                "rowspan": "numbers",
   1.466 +                "colspan": "numbers"
   1.467 +            },
   1.468 +            "add_class": {
   1.469 +                "align": "align_text"
   1.470 +            }
   1.471 +        },
   1.472 +        "legend": {
   1.473 +            "rename_tag": "span"
   1.474 +        },
   1.475 +        "hr": {},
   1.476 +        "label": {
   1.477 +            "rename_tag": "span"
   1.478 +        },
   1.479 +        "dl": {
   1.480 +            "rename_tag": "div"
   1.481 +        },
   1.482 +        "kbd": {
   1.483 +            "rename_tag": "span"
   1.484 +        },
   1.485 +        "listing": {
   1.486 +            "rename_tag": "div"
   1.487 +        },
   1.488 +        "dt": {
   1.489 +            "rename_tag": "span"
   1.490 +        },
   1.491 +        "nextid": {
   1.492 +            "remove": 1
   1.493 +        },
   1.494 +        "pre": {},
   1.495 +        "center": {
   1.496 +            "rename_tag": "div",
   1.497 +            "set_class": "wysiwyg-text-align-center"
   1.498 +        },
   1.499 +        "audio": {
   1.500 +            "remove": 1
   1.501 +        },
   1.502 +        "datalist": {
   1.503 +            "rename_tag": "span"
   1.504 +        },
   1.505 +        "samp": {
   1.506 +            "rename_tag": "span"
   1.507 +        },
   1.508 +        "col": {
   1.509 +            "remove": 1
   1.510 +        },
   1.511 +        "article": {
   1.512 +            "rename_tag": "div"
   1.513 +        },
   1.514 +        "cite": {},
   1.515 +        "link": {
   1.516 +            "remove": 1
   1.517 +        },
   1.518 +        "script": {
   1.519 +            "remove": 1
   1.520 +        },
   1.521 +        "bdo": {
   1.522 +            "rename_tag": "span"
   1.523 +        },
   1.524 +        "menu": {
   1.525 +            "rename_tag": "ul"
   1.526 +        },
   1.527 +        "colgroup": {
   1.528 +            "remove": 1
   1.529 +        },
   1.530 +        "ruby": {
   1.531 +            "rename_tag": "span"
   1.532 +        },
   1.533 +        "h2": {
   1.534 +            "add_class": {
   1.535 +                "align": "align_text"
   1.536 +            }
   1.537 +        },
   1.538 +        "ins": {
   1.539 +            "rename_tag": "span"
   1.540 +        },
   1.541 +        "p": {
   1.542 +            "add_class": {
   1.543 +                "align": "align_text"
   1.544 +            }
   1.545 +        },
   1.546 +        "sub": {},
   1.547 +        "comment": {
   1.548 +            "remove": 1
   1.549 +        },
   1.550 +        "frameset": {
   1.551 +            "remove": 1
   1.552 +        },
   1.553 +        "optgroup": {
   1.554 +            "rename_tag": "span"
   1.555 +        },
   1.556 +        "header": {
   1.557 +            "rename_tag": "div"
   1.558 +        },
   1.559 +        "sup": {}
   1.560 +    }
   1.561 +};

Impressum / About Us