Skip to content

Commit eb2ebc5

Browse files
committed
Duplicated to v16 docs
1 parent ee25939 commit eb2ebc5

File tree

7 files changed

+112
-1
lines changed

7 files changed

+112
-1
lines changed

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ The Rich Text Editor property editor is highly configurable and based on [Tiptap
1616

1717
Customize everything from toolbar options to editor size to where pasted images are saved.
1818

19+
## [Style Menu](style-menu.md)
20+
21+
Define a cascading text formatting and style menu for the Rich Text Editor toolbar.
22+
1923
## [Blocks](blocks.md)
2024

2125
Use Blocks to define specific parts that can be added as part of the markup of the Rich Text Editor.

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/configuration.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You have full control over which options should be available on the RTE.
88

99
![Toolbar: All options enabled](images/rte-tiptap-all-toolbar-items.png)
1010

11-
In the example above, all 27 options have been enabled. These options include font styles like bold and italics, bullet lists, and options to embed videos and insert images.
11+
In the example above, all 38 options have been enabled. These options include font styles like bold and italics, bullet lists, and options to embed videos and insert images.
1212

1313
You can customize the look of the toolbar:
1414

@@ -17,6 +17,18 @@ You can customize the look of the toolbar:
1717

1818
![Enhance and customize the capabilities of the Rich Text Editor toolbar](images/rte-tiptap-capabilities-and-toolbar.png)
1919

20+
## Statusbar
21+
22+
As well as the toolbar, you can configure extensions for the statusbar.
23+
24+
![Statusbar: with Word Count extension enabled](images/rte-tiptap-statusbar.png)
25+
26+
## Stylesheets
27+
28+
To apply custom styles to the Rich Text Editor, you can select from any existing stylesheets.
29+
30+
Stylesheets can be created in the **Settings** section. Read about [Stylesheets in the Backoffice](../../../../design/stylesheets-javascript.md) to learn more about this feature.
31+
2032
## Dimensions
2133

2234
Define `height` and `width` of the editor displayed in the content section.
Loading
Loading
Loading
Loading
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Style Menu
2+
3+
A Style Menu for the Rich Text Editor (RTE) is configurable extension to add a cascading menu to the toolbar, to apply text styles and formatting.
4+
5+
![Rich Text Editor cascading style menu](images/rte-tiptap-stylemenu.png)
6+
7+
{% hint style="info" %}
8+
Please note that any custom stylesheets associated with the Rich Text Editor will not auto generate a style menu in the toolbar.
9+
{% endhint %}
10+
11+
### Creating a Style Menu
12+
13+
In this article you can find an example of how to setup an RTE Style Menu using the package manifest file.
14+
15+
{% code title="umbraco-package.json" %}
16+
```json
17+
{
18+
"name": "Name of your package",
19+
"alias": "My.Package",
20+
"extensions": [
21+
{
22+
"type": "tiptapToolbarExtension",
23+
"kind": "styleMenu",
24+
"alias": "MyCustom.Tiptap.StyleMenu",
25+
"name": "My Custom Tiptap Style Menu",
26+
"meta": {
27+
"alias": "myCustomStyleMenu",
28+
"icon": "icon-palette",
29+
"label": "My custom styles"
30+
},
31+
"items": [
32+
{
33+
"label": "Headings",
34+
"items": [
35+
{
36+
"label": "Heading 2",
37+
"data": { "tag": "h2" },
38+
"appearance": { "icon": "icon-heading-2" }
39+
},
40+
{
41+
"label": "Heading 3",
42+
"data": { "tag": "h3" },
43+
"appearance": { "style": "font-size: large;" }
44+
},
45+
{
46+
"label": "Heading 4",
47+
"data": { "tag": "h4" }
48+
}
49+
]
50+
},
51+
{
52+
"label": "Attributes",
53+
"items": [
54+
{
55+
"label": "Classes",
56+
"data": { "class": "foo" }
57+
},
58+
{
59+
"label": "IDs",
60+
"data": { "id": "bar" }
61+
},
62+
{
63+
"label": "Mixed",
64+
"data": { "tag": "span", "class": "foo", "id": "bar" }
65+
}
66+
]
67+
}
68+
]
69+
}
70+
]
71+
}
72+
```
73+
{% endcode %}
74+
75+
76+
The "`items`" property defines the structure of the style menu. Each menu item has the following options.
77+
78+
- `label`: _(required)_ The label of the menu item. This supports localization keys.
79+
- `appearance`: This defines the appearance of the menu item. The value has 2 optional properties:
80+
- `icon`: To prefix an icon to the menu item.
81+
- `style`: To apply CSS rules to the menu item.
82+
- `data`: To configure the function of the style menu item. The value has 3 optional properties:
83+
- `tag`: A supported HTML tag name, _(see below)_, this will be applied to the selected text.
84+
- `class`: Applies a class attribute with the defined class name to the containing tag of the selected text.
85+
- `id`: Applies an ID attribute with the defined ID value to the containing tag of the selected text.
86+
- `separatorAfter`: When `true`, it will add a line separator after the menu item.
87+
- `items`: To enable a cascading menu, an array of nested menu items may be added.
88+
89+
90+
Once configured, all custom style menus will appear in the Rich Text Editor toolbar options, as described in the [RTE Configuration](configuration.md) article.
91+
92+
93+
#### Supported HTML tags
94+
95+
Since the Tiptap has a strict RTE schema, only supported HTML tags can be used in the style menu, _(arbitrary markup will be excluded)._ The following HTML tag names are supported: `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `p`, `blockquote`, `code`, `codeBlock`, `div`, `em` (italic), `ol`, `strong` (bold), `s` (strike-through), `span`, `u` (underline) and `ul`.

0 commit comments

Comments
 (0)