clearStyles not working
please check this.
{ "buttons": [ "html", "formatting", "bold", "italic", "unorderedlist", "redactoranchors", "orderedlist", "link", "file", "image", "video", "sup" ], "plugins": [ "alignment", "widget", "fullscreen", "video", "table", "customstyles", "redactoranchors" ], "linkNewTab": true, "toolbarFixed": true, "imageResizable": true, "imagePosition": true, "imageFloatMargin": "20px", "customstyles": { "customStyles": { "dropdown": { "Download Button": { "args": { "tag": "div", "class": "btn file-dwonload-a", "type": "toggle" }, "title": "Download Button" }, "Special Headeing": { "args": { "tag": "div", "class": "special-headeing", "type": "toggle" }, "title": "Special Heading" }, "clearStyles": { "api": "module.inline.clearformat" } } } } }
The module.inline.clearformat API is clearing attributes of “inline” tags only. And you’ve got div tags it looks like?
okay so how can i clear div tag?
Good question @keyurkadam. What’s your goal, convert the div to a p or h2 tag?
The goal is to add a div tag after a user clicks "Special Heading" and to remove it after they click "clearStyles". is it possible?
You can try the module.block.clearformat API if you want to clear block formatting.
https://imperavi.com/redactor/docs/api-modules/#s-clearformat
Or you setup multiple formatting options with module.block.format to switch between them. This should be basically identical as adding them to the default Formatting dropdown using the formattingAdd setting.
https://imperavi.com/redactor/docs/api-modules/#s-format https://imperavi.com/redactor/docs/settings/formatting/#s-formattingadd
I’ve just added an dropdown for link styles to the example config file, that you might want to take inspiration from for your download button.
https://github.com/carlcs/craft-redactorcustomstyles/blob/393d283cebd46d3e7191e39958d35326e39b6c50/_examples/redactor/Example.json#L45-L63
@carlcs sorry but not working. i have also tried your json but still "clear style" and "add class" not working. https://drive.google.com/file/d/1wFTGTEcXcYHZjtGw7jc0FHVN1QETYXG-/view
@carlcs any update on this?