import dash_mantine_components as dmc
from dash import Dash
from dash_iconify import DashIconify
app=Dash()
content = """<h2 style="text-align: center;">RichTextEditor Custom Controls Demo</h2>"""
toolbar = {
"sticky": True,
"controlsGroups": [
[
{
"CustomControl": {
"ariaLabel": "Insert Table",
"title": "Insert Table",
"children": [DashIconify(icon="mdi:table-plus", width=20, height=20)],
"function": "insertTable",
},
},
{
"CustomControl": {
"ariaLabel": "Add Column Before",
"title": "Add Column Before",
"children": [DashIconify(icon="mdi:table-column-plus-before", width=20, height=20)],
"function": "addColumnBefore",
},
},
{
"CustomControl": {
"ariaLabel": "Delete Column",
"title": "Delete Column",
"children": [DashIconify(icon="mdi:table-column-remove", width=20, height=20)],
"function": "deleteColumn",
},
},
],
[
"Bold",
"Italic",
"Underline",
],
],
}
app.layout = dmc.MantineProvider(
dmc.RichTextEditor(
html=content,
toolbar=toolbar
)
)
if __name__ == "__main__":
app.run(debug=True)