-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
块内可以增加自定义元素和自定义属性吗? #13325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
自定义属性名需要用 |
收到,谢谢! |
请教下,是这样添加吗?添加后,再次编辑或调用updateBlock元素还是被删除。 <img alt="demo/出纳记账" class="emoji" custom-demodemodemo="demodemodemo" src="/emojis/demo/出纳记账.png" title="demo/出纳记账"> |
应该不会被删除吧,我的脚注插件也对脚注引用和选中的文字加了自定义属性,是可以保留的 |
只有块级元素支持自定义属性,行级元素不支持。 |
明白了,谢谢D大! |
你的span是在哪里?块内吗? 这个演示的是span内,不行的。 20241201_182250.mp4 |
直接改html源码是不会被保存的 |
是的,修改后如果不需要手动修改块内容是没事的,如果修改的话非官方自带的元素和属性会被清除。 我觉得应该可以用块的自定义属性保存,然后加载时解析出来,每次修改后再重新渲染,太麻烦了,还是改用其他方案吧 |
可以试试这个函数
|
@wish5115 span不能嵌套,只能叠加自定义属性和data-type |
感谢!原来如此!学习了! |
In what scenarios do you need this feature?
如图,只要块内添加了自定义元素,哪怕仅仅修改了属性值,再次编辑块就会把自定义块删除,如果在可编辑div元素外则转义为普通字符,即使调用/api/block/updateBlock也无法把自定义元素或属性保存。
请问,有没有办法实现可以让自定义元素或属性不被删除或可以保存呢?
Describe the optimal solution
期望可以让自定义元素或属性不被删除或可以保存。
Describe the candidate solution
No response
Other information
No response
The text was updated successfully, but these errors were encountered: