AI销管
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

config.js 2.5 KiB

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