config.js 2.6 KB

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