From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- uview-ui/components/u-parse/libs/config.js | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/uview-ui/components/u-parse/libs/config.js b/uview-ui/components/u-parse/libs/config.js new file mode 100644 index 0000000..1f772e9 --- /dev/null +++ b/uview-ui/components/u-parse/libs/config.js @@ -0,0 +1,80 @@ +/* 閰嶇疆鏂囦欢 */ +var cfg = { + // 鍑洪敊鍗犱綅鍥� + errorImg: null, + // 杩囨护鍣ㄥ嚱鏁� + filter: null, + // 浠g爜楂樹寒鍑芥暟 + highlight: null, + // 鏂囨湰澶勭悊鍑芥暟 + onText: null, + // 瀹炰綋缂栫爜鍒楄〃 + entities: { + quot: '"', + apos: "'", + semi: ';', + nbsp: '\xA0', + ensp: '\u2002', + emsp: '\u2003', + ndash: '鈥�', + mdash: '鈥�', + middot: '路', + lsquo: '鈥�', + rsquo: '鈥�', + ldquo: '鈥�', + rdquo: '鈥�', + bull: '鈥�', + hellip: '鈥�' + }, + blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'), + boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'), + // 鍧楃骇鏍囩锛屽皢琚浆涓� div + blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'), + // 灏嗚绉婚櫎鐨勬爣绛� + ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'), + // 鍙兘琚� rich-text 鏄剧ず鐨勬爣绛� + richOnlyTags: makeMap('a,colgroup,fieldset,legend'), + // 鑷棴鍚堢殑鏍囩 + selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'), + // 淇′换鐨勬爣绛� + 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'), + // 榛樿鐨勬爣绛炬牱寮� + userAgentStyles: { + address: 'font-style:italic', + big: 'display:inline;font-size:1.2em', + blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px', + caption: 'display:table-caption;text-align:center', + center: 'text-align:center', + cite: 'font-style:italic', + dd: 'margin-left:40px', + mark: 'background-color:yellow', + pre: 'font-family:monospace;white-space:pre;overflow:scroll', + s: 'text-decoration:line-through', + small: 'display:inline;font-size:0.8em', + u: 'text-decoration:underline' + } +} + +function makeMap(str) { + var map = Object.create(null), + list = str.split(','); + for (var i = list.length; i--;) + map[list[i]] = true; + return map; +} + +// #ifdef MP-WEIXIN +if (wx.canIUse('editor')) { + cfg.blockTags.pre = void 0; + cfg.ignoreTags.rp = true; + Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby')); + Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby')); +} +// #endif + +// #ifdef APP-PLUS +cfg.ignoreTags.iframe = void 0; +Object.assign(cfg.trustTags, makeMap('embed,iframe')); +// #endif + +module.exports = cfg; -- Gitblit v1.9.3