You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* 配置文件 */
  2. // #ifdef MP-WEIXIN
  3. const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容
  4. // #endif
  5. module.exports = {
  6. // 出错占位图
  7. errorImg: null,
  8. // 过滤器函数
  9. filter: null,
  10. // 代码高亮函数
  11. highlight: null,
  12. // 文本处理函数
  13. onText: null,
  14. // 实体编码列表
  15. entities: {
  16. quot: '"',
  17. apos: "'",
  18. semi: ';',
  19. nbsp: '\xA0',
  20. ensp: '\u2002',
  21. emsp: '\u2003',
  22. ndash: '–',
  23. mdash: '—',
  24. middot: '·',
  25. lsquo: '‘',
  26. rsquo: '’',
  27. ldquo: '“',
  28. rdquo: '”',
  29. bull: '•',
  30. hellip: '…'
  31. },
  32. blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
  33. boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
  34. // 块级标签,将被转为 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')),
  40. // 将被移除的标签
  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. ),
  50. // 只能被 rich-text 显示的标签
  51. richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'
  52. // #ifdef MP-WEIXIN
  53. + (canIUse ? ',bdi,bdo,caption,rt,ruby' : '')
  54. // #endif
  55. ),
  56. // 自闭合的标签
  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. ),
  60. // 信任的标签
  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. ),
  70. // 默认的标签样式
  71. userAgentStyles: {
  72. address: 'font-style:italic',
  73. big: 'display:inline;font-size:1.2em',
  74. blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
  75. caption: 'display:table-caption;text-align:center',
  76. center: 'text-align:center',
  77. cite: 'font-style:italic',
  78. dd: 'margin-left:40px',
  79. mark: 'background-color:yellow',
  80. pre: 'font-family:monospace;white-space:pre;overflow:scroll',
  81. s: 'text-decoration:line-through',
  82. small: 'display:inline;font-size:0.8em',
  83. u: 'text-decoration:underline'
  84. }
  85. }
  86. function makeMap(str) {
  87. var map = Object.create(null),
  88. list = str.split(',');
  89. for (var i = list.length; i--;)
  90. map[list[i]] = true;
  91. return map;
  92. }