Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

代码过滤出错 #314

Open
soitif opened this issue Jul 30, 2020 · 1 comment
Open

代码过滤出错 #314

soitif opened this issue Jul 30, 2020 · 1 comment

Comments

@soitif
Copy link

soitif commented Jul 30, 2020

代码模式下输入

<center style="box-sizing: border-box;"><svg width="100%" height="200" xmlns="http://www.w3.org/2000/svg" style="margin-top: -180px;box-sizing: border-box;transform: rotateZ(0deg);-webkit-transform: rotateZ(0deg);-moz-transform: rotateZ(0deg);-ms-transform: rotateZ(0deg);-o-transform: rotateZ(0deg);" data-height="200"><rect width="100%" height="200" style="fill: #fefefe;box-sizing: border-box;"><animate attributename="opacity" begin="click" dur="6s" style="box-sizing: border-box;" from="1" to="0" fill="freeze"></animate></rect></svg></center>

切换到编辑模式,在切换回来变成了

<center style="box-sizing:border-box;">
	<svg width="100%" height="200" xmlns="http://www.w3.org/2000/svg" style="margin-top:-180px;box-sizing:border-box;transform:rotateZ(0deg);-webkit-transform:rotateZ(0deg);-moz-transform:rotateZ(0deg);-ms-transform:rotateZ(0deg);-o-transform:rotateZ(0deg);" data-height="200"><rect width="100%" height="200" style="fill:#fefefe;box-sizing:border-box;"></rect></svg><a name="undefined"></a>
</center>

animate标签没了,多了个anchor

@soitif
Copy link
Author

soitif commented Jul 30, 2020

修改

.replace(/<a[^>]*name="([^"]+)"[^>]*>(?:<\/a>)?/ig, function(full) {

.replace(/<a [^>]*name="([^"]+)"[^>]*>(?:<\/a>)?/ig, function(full) {

anchor一般是a空格后name

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant