config.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <<<<<<< HEAD
  2. /* 配置文件 */
  3. var cfg = {
  4. // 出错占位图
  5. errorImg: null,
  6. // 过滤器函数
  7. filter: null,
  8. // 代码高亮函数
  9. highlight: null,
  10. // 文本处理函数
  11. onText: null,
  12. // 实体编码列表
  13. entities: {
  14. quot: '"',
  15. apos: "'",
  16. semi: ';',
  17. nbsp: '\xA0',
  18. ensp: '\u2002',
  19. emsp: '\u2003',
  20. ndash: '–',
  21. mdash: '—',
  22. middot: '·',
  23. lsquo: '‘',
  24. rsquo: '’',
  25. ldquo: '“',
  26. rdquo: '”',
  27. bull: '•',
  28. hellip: '…'
  29. },
  30. blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
  31. boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
  32. // 块级标签,将被转为 div
  33. blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
  34. // 将被移除的标签
  35. ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
  36. // 只能被 rich-text 显示的标签
  37. richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'),
  38. // 自闭合的标签
  39. selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
  40. // 信任的标签
  41. 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'),
  42. // 默认的标签样式
  43. userAgentStyles: {
  44. address: 'font-style:italic',
  45. big: 'display:inline;font-size:1.2em',
  46. blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
  47. caption: 'display:table-caption;text-align:center',
  48. center: 'text-align:center',
  49. cite: 'font-style:italic',
  50. dd: 'margin-left:40px',
  51. mark: 'background-color:yellow',
  52. pre: 'font-family:monospace;white-space:pre;overflow:scroll',
  53. s: 'text-decoration:line-through',
  54. small: 'display:inline;font-size:0.8em',
  55. u: 'text-decoration:underline'
  56. }
  57. }
  58. function makeMap(str) {
  59. var map = Object.create(null),
  60. list = str.split(',');
  61. for (var i = list.length; i--;)
  62. map[list[i]] = true;
  63. return map;
  64. }
  65. // #ifdef MP-WEIXIN
  66. if (wx.canIUse('editor')) {
  67. cfg.blockTags.pre = void 0;
  68. cfg.ignoreTags.rp = true;
  69. Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
  70. Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
  71. }
  72. // #endif
  73. // #ifdef APP-PLUS
  74. cfg.ignoreTags.iframe = void 0;
  75. Object.assign(cfg.trustTags, makeMap('embed,iframe'));
  76. // #endif
  77. =======
  78. /* 配置文件 */
  79. var cfg = {
  80. // 出错占位图
  81. errorImg: null,
  82. // 过滤器函数
  83. filter: null,
  84. // 代码高亮函数
  85. highlight: null,
  86. // 文本处理函数
  87. onText: null,
  88. // 实体编码列表
  89. entities: {
  90. quot: '"',
  91. apos: "'",
  92. semi: ';',
  93. nbsp: '\xA0',
  94. ensp: '\u2002',
  95. emsp: '\u2003',
  96. ndash: '–',
  97. mdash: '—',
  98. middot: '·',
  99. lsquo: '‘',
  100. rsquo: '’',
  101. ldquo: '“',
  102. rdquo: '”',
  103. bull: '•',
  104. hellip: '…'
  105. },
  106. blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
  107. boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
  108. // 块级标签,将被转为 div
  109. blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
  110. // 将被移除的标签
  111. ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
  112. // 只能被 rich-text 显示的标签
  113. richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'),
  114. // 自闭合的标签
  115. selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
  116. // 信任的标签
  117. 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'),
  118. // 默认的标签样式
  119. userAgentStyles: {
  120. address: 'font-style:italic',
  121. big: 'display:inline;font-size:1.2em',
  122. blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
  123. caption: 'display:table-caption;text-align:center',
  124. center: 'text-align:center',
  125. cite: 'font-style:italic',
  126. dd: 'margin-left:40px',
  127. mark: 'background-color:yellow',
  128. pre: 'font-family:monospace;white-space:pre;overflow:scroll',
  129. s: 'text-decoration:line-through',
  130. small: 'display:inline;font-size:0.8em',
  131. u: 'text-decoration:underline'
  132. }
  133. }
  134. function makeMap(str) {
  135. var map = Object.create(null),
  136. list = str.split(',');
  137. for (var i = list.length; i--;)
  138. map[list[i]] = true;
  139. return map;
  140. }
  141. // #ifdef MP-WEIXIN
  142. if (wx.canIUse('editor')) {
  143. cfg.blockTags.pre = void 0;
  144. cfg.ignoreTags.rp = true;
  145. Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
  146. Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
  147. }
  148. // #endif
  149. // #ifdef APP-PLUS
  150. cfg.ignoreTags.iframe = void 0;
  151. Object.assign(cfg.trustTags, makeMap('embed,iframe'));
  152. // #endif
  153. >>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
  154. module.exports = cfg;