11/* 配置文件 */
2- // #ifdef MP-WEIXIN
3- const canIUse = wx . canIUse ( 'editor' ) ; // 高基础库标识,用于兼容
4- // #endif
5- module . exports = {
2+ var cfg = {
63 // 出错占位图
74 errorImg : null ,
85 // 过滤器函数
@@ -32,41 +29,15 @@ module.exports = {
3229 blankChar : makeMap ( ' ,\xA0,\t,\r,\n,\f' ) ,
3330 boolAttrs : makeMap ( 'allowfullscreen,autoplay,autostart,controls,ignore,loop,muted' ) ,
3431 // 块级标签,将被转为 div
35- blockTags : makeMap ( 'address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + (
36- // #ifdef MP-WEIXIN
37- canIUse ? '' :
38- // #endif
39- ',pre' ) ) ,
32+ blockTags : makeMap ( 'address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section' ) ,
4033 // 将被移除的标签
41- ignoreTags : makeMap (
42- 'area,base,canvas,frame,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'
43- // #ifdef MP-WEIXIN
44- + ( canIUse ? ',rp' : '' )
45- // #endif
46- // #ifndef APP-PLUS
47- + ',iframe'
48- // #endif
49- ) ,
34+ ignoreTags : makeMap ( 'area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr' ) ,
5035 // 只能被 rich-text 显示的标签
51- richOnlyTags : makeMap ( 'a,colgroup,fieldset,legend,table'
52- // #ifdef MP-WEIXIN
53- + ( canIUse ? ',bdi,bdo,caption,rt,ruby' : '' )
54- // #endif
55- ) ,
36+ richOnlyTags : makeMap ( 'a,colgroup,fieldset,legend,table' ) ,
5637 // 自闭合的标签
57- selfClosingTags : makeMap (
58- 'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
59- ) ,
38+ selfClosingTags : makeMap ( 'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr' ) ,
6039 // 信任的标签
61- trustTags : makeMap (
62- 'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
63- // #ifdef MP-WEIXIN
64- + ( canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '' )
65- // #endif
66- // #ifdef APP-PLUS
67- + ',embed,iframe'
68- // #endif
69- ) ,
40+ trustTags : makeMap ( 'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video' ) ,
7041 // 默认的标签样式
7142 userAgentStyles : {
7243 address : 'font-style:italic' ,
@@ -91,3 +62,19 @@ function makeMap(str) {
9162 map [ list [ i ] ] = true ;
9263 return map ;
9364}
65+
66+ // #ifdef MP-WEIXIN
67+ if ( wx . canIUse ( 'editor' ) ) {
68+ cfg . blockTags . pre = void 0 ;
69+ cfg . ignoreTags . rp = true ;
70+ Object . assign ( cfg . richOnlyTags , makeMap ( 'bdi,bdo,caption,rt,ruby' ) ) ;
71+ Object . assign ( cfg . trustTags , makeMap ( 'bdi,bdo,caption,pre,rt,ruby' ) ) ;
72+ }
73+ // #endif
74+
75+ // #ifdef APP-PLUS
76+ cfg . ignoreTags . iframe = void 0 ;
77+ Object . assign ( cfg . trustTags , makeMap ( 'embed,iframe' ) ) ;
78+ // #endif
79+
80+ module . exports = cfg ;
0 commit comments