jin-yufeng / mp-html

小程序富文本组件,支持渲染和编辑 html,支持在微信、QQ、百度、支付宝、头条和 uni-app 平台使用

Home Page:https://jin-yufeng.gitee.io/mp-html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

svg animate不支持

mgbq opened this issue · comments

使用环境

微信小程序基础库 2.19

问题描述

使用135模板编辑的资讯,无法解析animate 标签

复现方式

打开下面网址点击按钮插入编辑器,然后 点击右侧的外网复制,就能复制到带有动画的html 小程序端不展示动画,希望展示动画
http://www.135editor.com/editor_styles/102574.html

或者如下代码

<p >
    <svg style="box-sizing:border-box;width: 100%;height: auto;" data-width="100%">
        <text x="30%" y="50%" fill="#e59630" font-family="microsoft yahei,sans-serif" font-weight="bold" font-size="26" text-anchor="middle">
            金
            <animate attributename="opacity" from="1" to="0" begin="0s" dur="2s" repeatcount="indefinite"></animate>
        </text>
    </svg>
</p>

html 里可以不区分大小写,但是小程序端本身不支持 svgsvg 是通过转为 data:image/svg+xml; 的图片实现的,需要严格按照 xml 的格式(区分大小写)
attributename 改为 attributeNamerepeatcount 改为 repeatCount 就有动画了
之后可以会适配一些常用的属性

如何把attributename 转成attributeName repeatcount 转成repeatCount,所有相关的属性转成驼峰作者大大有何建议

新版已经适配了 这些,遇到更多的话也可以添加到这里