TinyMCE, allow data attribute

前端 未结 2 904
耶瑟儿~
耶瑟儿~ 2021-01-17 11:07

I have to use the HTML 5 data attribute in Tiny MCE, but the editor always clear them, as it\'s not an attribute known by the default valid_elements configuration.

S

2条回答
  •  长发绾君心
    2021-01-17 11:24

    extended_valid_elements is not the best choice here. Hava a look at the valid_elements setting. Here is an example

        // The valid_elements option defines which elements will remain in the edited text when the editor saves.
        valid_elements: "@[id|class|title|style|data-options|data*]," +
        "a[name|href|target|title]," +
        "#p,-ol,-ul,-li,br,img[src|height|width],-b,-i,-u," +
        "-span[data-mce-type],hr",
    

提交回复
热议问题