wp/wp-includes/js/tinymce/plugins/media/plugin.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    45       hasAltSource: hasAltSource,
    45       hasAltSource: hasAltSource,
    46       hasPoster: hasPoster,
    46       hasPoster: hasPoster,
    47       hasDimensions: hasDimensions
    47       hasDimensions: hasDimensions
    48     };
    48     };
    49 
    49 
    50     var global$3 = tinymce.util.Tools.resolve('tinymce.html.SaxParser');
    50     var Cell = function (initial) {
    51 
    51       var value = initial;
    52     var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
    52       var get = function () {
       
    53         return value;
       
    54       };
       
    55       var set = function (v) {
       
    56         value = v;
       
    57       };
       
    58       var clone = function () {
       
    59         return Cell(get());
       
    60       };
       
    61       return {
       
    62         get: get,
       
    63         set: set,
       
    64         clone: clone
       
    65       };
       
    66     };
       
    67 
       
    68     var noop = function () {
       
    69     };
       
    70     var constant = function (value) {
       
    71       return function () {
       
    72         return value;
       
    73       };
       
    74     };
       
    75     var never = constant(false);
       
    76     var always = constant(true);
       
    77 
       
    78     var none = function () {
       
    79       return NONE;
       
    80     };
       
    81     var NONE = function () {
       
    82       var eq = function (o) {
       
    83         return o.isNone();
       
    84       };
       
    85       var call = function (thunk) {
       
    86         return thunk();
       
    87       };
       
    88       var id = function (n) {
       
    89         return n;
       
    90       };
       
    91       var me = {
       
    92         fold: function (n, s) {
       
    93           return n();
       
    94         },
       
    95         is: never,
       
    96         isSome: never,
       
    97         isNone: always,
       
    98         getOr: id,
       
    99         getOrThunk: call,
       
   100         getOrDie: function (msg) {
       
   101           throw new Error(msg || 'error: getOrDie called on none.');
       
   102         },
       
   103         getOrNull: constant(null),
       
   104         getOrUndefined: constant(undefined),
       
   105         or: id,
       
   106         orThunk: call,
       
   107         map: none,
       
   108         each: noop,
       
   109         bind: none,
       
   110         exists: never,
       
   111         forall: always,
       
   112         filter: none,
       
   113         equals: eq,
       
   114         equals_: eq,
       
   115         toArray: function () {
       
   116           return [];
       
   117         },
       
   118         toString: constant('none()')
       
   119       };
       
   120       if (Object.freeze) {
       
   121         Object.freeze(me);
       
   122       }
       
   123       return me;
       
   124     }();
       
   125     var some = function (a) {
       
   126       var constant_a = constant(a);
       
   127       var self = function () {
       
   128         return me;
       
   129       };
       
   130       var bind = function (f) {
       
   131         return f(a);
       
   132       };
       
   133       var me = {
       
   134         fold: function (n, s) {
       
   135           return s(a);
       
   136         },
       
   137         is: function (v) {
       
   138           return a === v;
       
   139         },
       
   140         isSome: always,
       
   141         isNone: never,
       
   142         getOr: constant_a,
       
   143         getOrThunk: constant_a,
       
   144         getOrDie: constant_a,
       
   145         getOrNull: constant_a,
       
   146         getOrUndefined: constant_a,
       
   147         or: self,
       
   148         orThunk: self,
       
   149         map: function (f) {
       
   150           return some(f(a));
       
   151         },
       
   152         each: function (f) {
       
   153           f(a);
       
   154         },
       
   155         bind: bind,
       
   156         exists: bind,
       
   157         forall: bind,
       
   158         filter: function (f) {
       
   159           return f(a) ? me : NONE;
       
   160         },
       
   161         toArray: function () {
       
   162           return [a];
       
   163         },
       
   164         toString: function () {
       
   165           return 'some(' + a + ')';
       
   166         },
       
   167         equals: function (o) {
       
   168           return o.is(a);
       
   169         },
       
   170         equals_: function (o, elementEq) {
       
   171           return o.fold(never, function (b) {
       
   172             return elementEq(a, b);
       
   173           });
       
   174         }
       
   175       };
       
   176       return me;
       
   177     };
       
   178     var from = function (value) {
       
   179       return value === null || value === undefined ? NONE : some(value);
       
   180     };
       
   181     var Option = {
       
   182       some: some,
       
   183       none: none,
       
   184       from: from
       
   185     };
       
   186 
       
   187     var hasOwnProperty = Object.hasOwnProperty;
       
   188     var get = function (obj, key) {
       
   189       return has(obj, key) ? Option.from(obj[key]) : Option.none();
       
   190     };
       
   191     var has = function (obj, key) {
       
   192       return hasOwnProperty.call(obj, key);
       
   193     };
       
   194 
       
   195     var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
       
   196 
       
   197     var global$4 = tinymce.util.Tools.resolve('tinymce.html.SaxParser');
    53 
   198 
    54     var getVideoScriptMatch = function (prefixes, src) {
   199     var getVideoScriptMatch = function (prefixes, src) {
    55       if (prefixes) {
   200       if (prefixes) {
    56         for (var i = 0; i < prefixes.length; i++) {
   201         for (var i = 0; i < prefixes.length; i++) {
    57           if (src.indexOf(prefixes[i].filter) !== -1) {
   202           if (src.indexOf(prefixes[i].filter) !== -1) {
    60         }
   205         }
    61       }
   206       }
    62     };
   207     };
    63     var VideoScript = { getVideoScriptMatch: getVideoScriptMatch };
   208     var VideoScript = { getVideoScriptMatch: getVideoScriptMatch };
    64 
   209 
       
   210     var DOM = global$3.DOM;
    65     var trimPx = function (value) {
   211     var trimPx = function (value) {
    66       return value.replace(/px$/, '');
   212       return value.replace(/px$/, '');
    67     };
   213     };
    68     var addPx = function (value) {
   214     var getEphoxEmbedData = function (attrs) {
    69       return /^[0-9.]+$/.test(value) ? value + 'px' : value;
   215       var style = attrs.map.style;
    70     };
   216       var styles = style ? DOM.parseStyle(style) : {};
    71     var getSize = function (name) {
   217       return {
    72       return function (elm) {
   218         type: 'ephox-embed-iri',
    73         return elm ? trimPx(elm.style[name]) : '';
   219         source1: attrs.map['data-ephox-embed-iri'],
    74       };
   220         source2: '',
    75     };
   221         poster: '',
    76     var setSize = function (name) {
   222         width: get(styles, 'max-width').map(trimPx).getOr(''),
    77       return function (elm, value) {
   223         height: get(styles, 'max-height').map(trimPx).getOr('')
    78         if (elm) {
   224       };
    79           elm.style[name] = addPx(value);
   225     };
    80         }
   226     var htmlToData = function (prefixes, html) {
    81       };
   227       var isEphoxEmbed = Cell(false);
    82     };
       
    83     var Size = {
       
    84       getMaxWidth: getSize('maxWidth'),
       
    85       getMaxHeight: getSize('maxHeight'),
       
    86       setMaxWidth: setSize('maxWidth'),
       
    87       setMaxHeight: setSize('maxHeight')
       
    88     };
       
    89 
       
    90     var DOM = global$4.DOM;
       
    91     var getEphoxEmbedIri = function (elm) {
       
    92       return DOM.getAttrib(elm, 'data-ephox-embed-iri');
       
    93     };
       
    94     var isEphoxEmbed = function (html) {
       
    95       var fragment = DOM.createFragment(html);
       
    96       return getEphoxEmbedIri(fragment.firstChild) !== '';
       
    97     };
       
    98     var htmlToDataSax = function (prefixes, html) {
       
    99       var data = {};
   228       var data = {};
   100       global$3({
   229       global$4({
   101         validate: false,
   230         validate: false,
   102         allow_conditional_comments: true,
   231         allow_conditional_comments: true,
   103         special: 'script,noscript',
   232         special: 'script,noscript',
   104         start: function (name, attrs) {
   233         start: function (name, attrs) {
   105           if (!data.source1 && name === 'param') {
   234           if (isEphoxEmbed.get()) ; else if (has(attrs.map, 'data-ephox-embed-iri')) {
   106             data.source1 = attrs.map.movie;
   235             isEphoxEmbed.set(true);
   107           }
   236             data = getEphoxEmbedData(attrs);
   108           if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') {
   237           } else {
   109             if (!data.type) {
   238             if (!data.source1 && name === 'param') {
   110               data.type = name;
   239               data.source1 = attrs.map.movie;
   111             }
   240             }
   112             data = global$2.extend(attrs.map, data);
   241             if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') {
   113           }
   242               if (!data.type) {
   114           if (name === 'script') {
   243                 data.type = name;
   115             var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src);
   244               }
   116             if (!videoScript) {
   245               data = global$2.extend(attrs.map, data);
   117               return;
   246             }
   118             }
   247             if (name === 'script') {
   119             data = {
   248               var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src);
   120               type: 'script',
   249               if (!videoScript) {
   121               source1: attrs.map.src,
   250                 return;
   122               width: videoScript.width,
   251               }
   123               height: videoScript.height
   252               data = {
   124             };
   253                 type: 'script',
   125           }
   254                 source1: attrs.map.src,
   126           if (name === 'source') {
   255                 width: videoScript.width,
   127             if (!data.source1) {
   256                 height: videoScript.height
   128               data.source1 = attrs.map.src;
   257               };
   129             } else if (!data.source2) {
   258             }
   130               data.source2 = attrs.map.src;
   259             if (name === 'source') {
   131             }
   260               if (!data.source1) {
   132           }
   261                 data.source1 = attrs.map.src;
   133           if (name === 'img' && !data.poster) {
   262               } else if (!data.source2) {
   134             data.poster = attrs.map.src;
   263                 data.source2 = attrs.map.src;
       
   264               }
       
   265             }
       
   266             if (name === 'img' && !data.poster) {
       
   267               data.poster = attrs.map.src;
       
   268             }
   135           }
   269           }
   136         }
   270         }
   137       }).parse(html);
   271       }).parse(html);
   138       data.source1 = data.source1 || data.src || data.data;
   272       data.source1 = data.source1 || data.src || data.data;
   139       data.source2 = data.source2 || '';
   273       data.source2 = data.source2 || '';
   140       data.poster = data.poster || '';
   274       data.poster = data.poster || '';
   141       return data;
   275       return data;
   142     };
       
   143     var ephoxEmbedHtmlToData = function (html) {
       
   144       var fragment = DOM.createFragment(html);
       
   145       var div = fragment.firstChild;
       
   146       return {
       
   147         type: 'ephox-embed-iri',
       
   148         source1: getEphoxEmbedIri(div),
       
   149         source2: '',
       
   150         poster: '',
       
   151         width: Size.getMaxWidth(div),
       
   152         height: Size.getMaxHeight(div)
       
   153       };
       
   154     };
       
   155     var htmlToData = function (prefixes, html) {
       
   156       return isEphoxEmbed(html) ? ephoxEmbedHtmlToData(html) : htmlToDataSax(prefixes, html);
       
   157     };
   276     };
   158     var HtmlToData = { htmlToData: htmlToData };
   277     var HtmlToData = { htmlToData: htmlToData };
   159 
   278 
   160     var global$5 = tinymce.util.Tools.resolve('tinymce.util.Promise');
   279     var global$5 = tinymce.util.Tools.resolve('tinymce.util.Promise');
   161 
   280 
   172       var mime = mimes[fileEnd];
   291       var mime = mimes[fileEnd];
   173       return mime ? mime : '';
   292       return mime ? mime : '';
   174     };
   293     };
   175     var Mime = { guess: guess };
   294     var Mime = { guess: guess };
   176 
   295 
   177     var global$6 = tinymce.util.Tools.resolve('tinymce.html.Writer');
   296     var global$6 = tinymce.util.Tools.resolve('tinymce.html.Schema');
   178 
   297 
   179     var global$7 = tinymce.util.Tools.resolve('tinymce.html.Schema');
   298     var global$7 = tinymce.util.Tools.resolve('tinymce.html.Writer');
   180 
   299 
   181     var DOM$1 = global$4.DOM;
   300     var DOM$1 = global$3.DOM;
       
   301     var addPx = function (value) {
       
   302       return /^[0-9.]+$/.test(value) ? value + 'px' : value;
       
   303     };
   182     var setAttributes = function (attrs, updatedAttrs) {
   304     var setAttributes = function (attrs, updatedAttrs) {
   183       var name;
   305       for (var name in updatedAttrs) {
   184       var i;
   306         var value = '' + updatedAttrs[name];
   185       var value;
       
   186       var attr;
       
   187       for (name in updatedAttrs) {
       
   188         value = '' + updatedAttrs[name];
       
   189         if (attrs.map[name]) {
   307         if (attrs.map[name]) {
   190           i = attrs.length;
   308           var i = attrs.length;
   191           while (i--) {
   309           while (i--) {
   192             attr = attrs[i];
   310             var attr = attrs[i];
   193             if (attr.name === name) {
   311             if (attr.name === name) {
   194               if (value) {
   312               if (value) {
   195                 attrs.map[name] = value;
   313                 attrs.map[name] = value;
   196                 attr.value = value;
   314                 attr.value = value;
   197               } else {
   315               } else {
   207           });
   325           });
   208           attrs.map[name] = value;
   326           attrs.map[name] = value;
   209         }
   327         }
   210       }
   328       }
   211     };
   329     };
   212     var normalizeHtml = function (html) {
   330     var updateEphoxEmbed = function (data, attrs) {
   213       var writer = global$6();
   331       var style = attrs.map.style;
   214       var parser = global$3(writer);
   332       var styleMap = style ? DOM$1.parseStyle(style) : {};
   215       parser.parse(html);
   333       styleMap['max-width'] = addPx(data.width);
   216       return writer.getContent();
   334       styleMap['max-height'] = addPx(data.height);
   217     };
   335       setAttributes(attrs, { style: DOM$1.serializeStyle(styleMap) });
   218     var updateHtmlSax = function (html, data, updateAll) {
   336     };
   219       var writer = global$6();
   337     var updateHtml = function (html, data, updateAll) {
       
   338       var writer = global$7();
       
   339       var isEphoxEmbed = Cell(false);
   220       var sourceCount = 0;
   340       var sourceCount = 0;
   221       var hasImage;
   341       var hasImage;
   222       global$3({
   342       global$4({
   223         validate: false,
   343         validate: false,
   224         allow_conditional_comments: true,
   344         allow_conditional_comments: true,
   225         special: 'script,noscript',
   345         special: 'script,noscript',
   226         comment: function (text) {
   346         comment: function (text) {
   227           writer.comment(text);
   347           writer.comment(text);
   231         },
   351         },
   232         text: function (text, raw) {
   352         text: function (text, raw) {
   233           writer.text(text, raw);
   353           writer.text(text, raw);
   234         },
   354         },
   235         start: function (name, attrs, empty) {
   355         start: function (name, attrs, empty) {
   236           switch (name) {
   356           if (isEphoxEmbed.get()) ; else if (has(attrs.map, 'data-ephox-embed-iri')) {
   237           case 'video':
   357             isEphoxEmbed.set(true);
   238           case 'object':
   358             updateEphoxEmbed(data, attrs);
   239           case 'embed':
   359           } else {
   240           case 'img':
   360             switch (name) {
   241           case 'iframe':
   361             case 'video':
   242             if (data.height !== undefined && data.width !== undefined) {
   362             case 'object':
   243               setAttributes(attrs, {
   363             case 'embed':
       
   364             case 'img':
       
   365             case 'iframe':
       
   366               if (data.height !== undefined && data.width !== undefined) {
       
   367                 setAttributes(attrs, {
       
   368                   width: data.width,
       
   369                   height: data.height
       
   370                 });
       
   371               }
       
   372               break;
       
   373             }
       
   374             if (updateAll) {
       
   375               switch (name) {
       
   376               case 'video':
       
   377                 setAttributes(attrs, {
       
   378                   poster: data.poster,
       
   379                   src: ''
       
   380                 });
       
   381                 if (data.source2) {
       
   382                   setAttributes(attrs, { src: '' });
       
   383                 }
       
   384                 break;
       
   385               case 'iframe':
       
   386                 setAttributes(attrs, { src: data.source1 });
       
   387                 break;
       
   388               case 'source':
       
   389                 sourceCount++;
       
   390                 if (sourceCount <= 2) {
       
   391                   setAttributes(attrs, {
       
   392                     src: data['source' + sourceCount],
       
   393                     type: data['source' + sourceCount + 'mime']
       
   394                   });
       
   395                   if (!data['source' + sourceCount]) {
       
   396                     return;
       
   397                   }
       
   398                 }
       
   399                 break;
       
   400               case 'img':
       
   401                 if (!data.poster) {
       
   402                   return;
       
   403                 }
       
   404                 hasImage = true;
       
   405                 break;
       
   406               }
       
   407             }
       
   408           }
       
   409           writer.start(name, attrs, empty);
       
   410         },
       
   411         end: function (name) {
       
   412           if (!isEphoxEmbed.get()) {
       
   413             if (name === 'video' && updateAll) {
       
   414               for (var index = 1; index <= 2; index++) {
       
   415                 if (data['source' + index]) {
       
   416                   var attrs = [];
       
   417                   attrs.map = {};
       
   418                   if (sourceCount < index) {
       
   419                     setAttributes(attrs, {
       
   420                       src: data['source' + index],
       
   421                       type: data['source' + index + 'mime']
       
   422                     });
       
   423                     writer.start('source', attrs, true);
       
   424                   }
       
   425                 }
       
   426               }
       
   427             }
       
   428             if (data.poster && name === 'object' && updateAll && !hasImage) {
       
   429               var imgAttrs = [];
       
   430               imgAttrs.map = {};
       
   431               setAttributes(imgAttrs, {
       
   432                 src: data.poster,
   244                 width: data.width,
   433                 width: data.width,
   245                 height: data.height
   434                 height: data.height
   246               });
   435               });
   247             }
   436               writer.start('img', imgAttrs, true);
   248             break;
   437             }
   249           }
       
   250           if (updateAll) {
       
   251             switch (name) {
       
   252             case 'video':
       
   253               setAttributes(attrs, {
       
   254                 poster: data.poster,
       
   255                 src: ''
       
   256               });
       
   257               if (data.source2) {
       
   258                 setAttributes(attrs, { src: '' });
       
   259               }
       
   260               break;
       
   261             case 'iframe':
       
   262               setAttributes(attrs, { src: data.source1 });
       
   263               break;
       
   264             case 'source':
       
   265               sourceCount++;
       
   266               if (sourceCount <= 2) {
       
   267                 setAttributes(attrs, {
       
   268                   src: data['source' + sourceCount],
       
   269                   type: data['source' + sourceCount + 'mime']
       
   270                 });
       
   271                 if (!data['source' + sourceCount]) {
       
   272                   return;
       
   273                 }
       
   274               }
       
   275               break;
       
   276             case 'img':
       
   277               if (!data.poster) {
       
   278                 return;
       
   279               }
       
   280               hasImage = true;
       
   281               break;
       
   282             }
       
   283           }
       
   284           writer.start(name, attrs, empty);
       
   285         },
       
   286         end: function (name) {
       
   287           if (name === 'video' && updateAll) {
       
   288             for (var index = 1; index <= 2; index++) {
       
   289               if (data['source' + index]) {
       
   290                 var attrs = [];
       
   291                 attrs.map = {};
       
   292                 if (sourceCount < index) {
       
   293                   setAttributes(attrs, {
       
   294                     src: data['source' + index],
       
   295                     type: data['source' + index + 'mime']
       
   296                   });
       
   297                   writer.start('source', attrs, true);
       
   298                 }
       
   299               }
       
   300             }
       
   301           }
       
   302           if (data.poster && name === 'object' && updateAll && !hasImage) {
       
   303             var imgAttrs = [];
       
   304             imgAttrs.map = {};
       
   305             setAttributes(imgAttrs, {
       
   306               src: data.poster,
       
   307               width: data.width,
       
   308               height: data.height
       
   309             });
       
   310             writer.start('img', imgAttrs, true);
       
   311           }
   438           }
   312           writer.end(name);
   439           writer.end(name);
   313         }
   440         }
   314       }, global$7({})).parse(html);
   441       }, global$6({})).parse(html);
   315       return writer.getContent();
   442       return writer.getContent();
   316     };
       
   317     var isEphoxEmbed$1 = function (html) {
       
   318       var fragment = DOM$1.createFragment(html);
       
   319       return DOM$1.getAttrib(fragment.firstChild, 'data-ephox-embed-iri') !== '';
       
   320     };
       
   321     var updateEphoxEmbed = function (html, data) {
       
   322       var fragment = DOM$1.createFragment(html);
       
   323       var div = fragment.firstChild;
       
   324       Size.setMaxWidth(div, data.width);
       
   325       Size.setMaxHeight(div, data.height);
       
   326       return normalizeHtml(div.outerHTML);
       
   327     };
       
   328     var updateHtml = function (html, data, updateAll) {
       
   329       return isEphoxEmbed$1(html) ? updateEphoxEmbed(html, data) : updateHtmlSax(html, data, updateAll);
       
   330     };
   443     };
   331     var UpdateHtml = { updateHtml: updateHtml };
   444     var UpdateHtml = { updateHtml: updateHtml };
   332 
   445 
   333     var urlPatterns = [
   446     var urlPatterns = [
   334       {
   447       {
   549     var Service = {
   662     var Service = {
   550       getEmbedHtml: getEmbedHtml,
   663       getEmbedHtml: getEmbedHtml,
   551       isCached: isCached
   664       isCached: isCached
   552     };
   665     };
   553 
   666 
       
   667     var trimPx$1 = function (value) {
       
   668       return value.replace(/px$/, '');
       
   669     };
       
   670     var addPx$1 = function (value) {
       
   671       return /^[0-9.]+$/.test(value) ? value + 'px' : value;
       
   672     };
       
   673     var getSize = function (name) {
       
   674       return function (elm) {
       
   675         return elm ? trimPx$1(elm.style[name]) : '';
       
   676       };
       
   677     };
       
   678     var setSize = function (name) {
       
   679       return function (elm, value) {
       
   680         if (elm) {
       
   681           elm.style[name] = addPx$1(value);
       
   682         }
       
   683       };
       
   684     };
       
   685     var Size = {
       
   686       getMaxWidth: getSize('maxWidth'),
       
   687       getMaxHeight: getSize('maxHeight'),
       
   688       setMaxWidth: setSize('maxWidth'),
       
   689       setMaxHeight: setSize('maxHeight')
       
   690     };
       
   691 
   554     var doSyncSize = function (widthCtrl, heightCtrl) {
   692     var doSyncSize = function (widthCtrl, heightCtrl) {
   555       widthCtrl.state.set('oldVal', widthCtrl.value());
   693       widthCtrl.state.set('oldVal', widthCtrl.value());
   556       heightCtrl.state.set('oldVal', heightCtrl.value());
   694       heightCtrl.state.set('oldVal', heightCtrl.value());
   557     };
   695     };
   558     var doSizeControls = function (win, f) {
   696     var doSizeControls = function (win, f) {
   823       });
   961       });
   824       SizeManager.syncSize(win);
   962       SizeManager.syncSize(win);
   825     };
   963     };
   826     var Dialog = { showDialog: showDialog };
   964     var Dialog = { showDialog: showDialog };
   827 
   965 
   828     var get = function (editor) {
   966     var get$1 = function (editor) {
   829       var showDialog = function () {
   967       var showDialog = function () {
   830         Dialog.showDialog(editor);
   968         Dialog.showDialog(editor);
   831       };
   969       };
   832       return { showDialog: showDialog };
   970       return { showDialog: showDialog };
   833     };
   971     };
   834     var Api = { get: get };
   972     var Api = { get: get$1 };
   835 
   973 
   836     var register = function (editor) {
   974     var register = function (editor) {
   837       var showDialog = function () {
   975       var showDialog = function () {
   838         Dialog.showDialog(editor);
   976         Dialog.showDialog(editor);
   839       };
   977       };
   845 
   983 
   846     var sanitize = function (editor, html) {
   984     var sanitize = function (editor, html) {
   847       if (Settings.shouldFilterHtml(editor) === false) {
   985       if (Settings.shouldFilterHtml(editor) === false) {
   848         return html;
   986         return html;
   849       }
   987       }
   850       var writer = global$6();
   988       var writer = global$7();
   851       var blocked;
   989       var blocked;
   852       global$3({
   990       global$4({
   853         validate: false,
   991         validate: false,
   854         allow_conditional_comments: false,
   992         allow_conditional_comments: false,
   855         special: 'script,noscript',
   993         special: 'script,noscript',
   856         comment: function (text) {
   994         comment: function (text) {
   857           writer.comment(text);
   995           writer.comment(text);
   862         text: function (text, raw) {
  1000         text: function (text, raw) {
   863           writer.text(text, raw);
  1001           writer.text(text, raw);
   864         },
  1002         },
   865         start: function (name, attrs, empty) {
  1003         start: function (name, attrs, empty) {
   866           blocked = true;
  1004           blocked = true;
   867           if (name === 'script' || name === 'noscript') {
  1005           if (name === 'script' || name === 'noscript' || name === 'svg') {
   868             return;
  1006             return;
   869           }
  1007           }
   870           for (var i = 0; i < attrs.length; i++) {
  1008           for (var i = attrs.length - 1; i >= 0; i--) {
   871             if (attrs[i].name.indexOf('on') === 0) {
  1009             var attrName = attrs[i].name;
   872               return;
  1010             if (attrName.indexOf('on') === 0) {
   873             }
  1011               delete attrs.map[attrName];
   874             if (attrs[i].name === 'style') {
  1012               attrs.splice(i, 1);
       
  1013             }
       
  1014             if (attrName === 'style') {
   875               attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
  1015               attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
   876             }
  1016             }
   877           }
  1017           }
   878           writer.start(name, attrs, empty);
  1018           writer.start(name, attrs, empty);
   879           blocked = false;
  1019           blocked = false;
   882           if (blocked) {
  1022           if (blocked) {
   883             return;
  1023             return;
   884           }
  1024           }
   885           writer.end(name);
  1025           writer.end(name);
   886         }
  1026         }
   887       }, global$7({})).parse(html);
  1027       }, global$6({})).parse(html);
   888       return writer.getContent();
  1028       return writer.getContent();
   889     };
  1029     };
   890     var Sanitize = { sanitize: sanitize };
  1030     var Sanitize = { sanitize: sanitize };
   891 
  1031 
   892     var createPlaceholderNode = function (editor, node) {
  1032     var createPlaceholderNode = function (editor, node) {