gpt4 book ai didi

CKEditor编辑数据-*属性

转载 作者:行者123 更新时间:2023-12-04 02:21:16 24 4
gpt4 key购买 nike

我需要一个解决方案,允许我在 CKEditor 中的单个元素上添加/编辑/删除 data-* 属性,而无需直接在源代码编辑器中手动添加它?

我还没有找到任何允许我这样做的配置项或插件。

我该怎么做?

最佳答案

Here is a working sample based on the example you provided.

您可以使用 this 添加/编辑/删除元素的数据属性:

element.data( 'extra-info', 'test' );   // Appended the attribute data-extra-info="test" to the element.
alert( element.data( 'extra-info' ) ); // 'test'
element.data( 'extra-info', false ); // Remove the data-extra-info attribute from the element.

http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-data

关于CKEditor编辑数据-*属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29142591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com