提交 a8d94c07 编写于 作者: fxy060608's avatar fxy060608

fix(h5): multiple classes (rich-text) #756

上级 db1522a0
...@@ -55,7 +55,7 @@ const CHARS = { ...@@ -55,7 +55,7 @@ const CHARS = {
'nbsp': ' ', 'nbsp': ' ',
'quot': '"', 'quot': '"',
'apos': "'" 'apos': "'"
} }
function decodeEntities (htmlString) { function decodeEntities (htmlString) {
return htmlString.replace(/&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi, function (match, stage) { return htmlString.replace(/&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi, function (match, stage) {
...@@ -95,9 +95,11 @@ export default function parseNodes (nodes, parentNode) { ...@@ -95,9 +95,11 @@ export default function parseNodes (nodes, parentNode) {
if (isPlainObject(attrs)) { if (isPlainObject(attrs)) {
const tagAttrs = TAGS[tagName] || [] const tagAttrs = TAGS[tagName] || []
Object.keys(attrs).forEach(function (name) { Object.keys(attrs).forEach(function (name) {
const value = attrs[name] let value = attrs[name]
switch (name) { switch (name) {
case 'class': case 'class':
/* eslint-disable no-fallthrough */
Array.isArray(value) && (value = value.join(' '))
case 'style': case 'style':
elem.setAttribute(name, value) elem.setAttribute(name, value)
break break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册