Hello,
Like this you can add a new preformatted text button to touch devices.
Add the following to a new component Common/Header section.
<script type="text/discourse-plugin" version="0.8">
const container = Discourse.__container__;
this.capabilities = container.lookup("capabilities:main");
if (this.capabilities.touch) {
api.onToolbarCreate(function(toolbar) {
toolbar.addButton({
id: "code",
group: "insertions",
preventFocus: true,
trimLeading: true,
action: "formatCode",
});
});
}
</script>
Add this to Common/CSS section. This will hide the preformatted text button from popup menu.
.select-kit.dropdown-select-box.toolbar-popup-menu-options {
li[data-value="applyFormatCode"] {
display: none;
}
}