Skip to content

Commit 8aed0d3

Browse files
authored
Merge pull request #6498 from umbraco/15/newRteUi
15: Rich Text Editor Tiptap
2 parents 3357898 + 0259246 commit 8aed0d3

37 files changed

+434
-103
lines changed

15/umbraco-cms/.gitbook.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,6 @@ redirects:
106106
extending/packages/types-of-packages: extending/packages/README.md
107107
reference/configuration/nucachesettings: reference/configuration/cache-settings.md
108108
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/listview: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/collection.md
109+
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/rte-styles: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/styles.md
110+
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/rte-plugins: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/plugins.md
111+
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/rte-blocks: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/blocks.md

15/umbraco-cms/SUMMARY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
* [Backoffice](fundamentals/backoffice/README.md)
3030
* [Property Editors](fundamentals/backoffice/property-editors/README.md)
3131
* [Built-in Property Editors](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/README.md)
32+
* [Rich Text Editor](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/README.md)
33+
* [Configuration](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/configuration.md)
34+
* [Plugins](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/plugins.md)
35+
* [Blocks](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/blocks.md)
36+
* [Change Rich Text Editor UI](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/change-rich-text-editor-ui.md)
37+
* [Rich Text Editor TinyMce](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/README.md)
38+
* [Configuration](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/configuration.md)
39+
* [Styles](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/styles.md)
40+
* [Plugins](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/plugins.md)
41+
* [Blocks](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/blocks.md)
3242
* [Image Cropper](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/image-cropper.md)
3343
* [Block Editors](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/README.md)
3444
* [Block Grid](fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/block-grid-editor.md)
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Rich Text Editor TinyMce
2+
3+
`Schema Alias: Umbraco.RichText`
4+
`UI Alias: Umb.PropertyEditorUi.TinyMCE`
5+
6+
`Returns: HTML`
7+
8+
{% hint style="warning" %}
9+
This article is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
10+
{% endhint %}
11+
12+
The Rich Text Editor (RTE) is highly configurable and based on [TinyMCE](https://www.tinymce.com/). Depending on the configuration, it will give your content editors more flexibility when working with content that should be more than plain text.
13+
14+
{% hint style="info" %}
15+
**Are you using custom configurations or plugins with TinyMCE?**
16+
17+
In Umbraco 11 the TinyMCE version supported has been upgraded from version 4 to version 6. You need to migrate to the latest version if you are using TinyMCE plugins or custom configuration.
18+
19+
If your site is upgraded from an older version, follow the migration guides below to upgrade the TinyMCE version as well.
20+
21+
* [Migrate from version 4 to version 5](https://www.tiny.cloud/docs/tinymce/5/migration-from-4x/)
22+
* [Migrate from version 5 to version 6](https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/)
23+
{% endhint %}
24+
25+
## [Configuration options](configuration.md)
26+
27+
Customize everything from toolbar options to editor size to where pasted images are saved.
28+
29+
## [Styles](styles.md)
30+
31+
Use CSS to define specific editor styles and add them as formatting options of the Rich Text Editor.
32+
33+
## [Blocks](blocks.md)
34+
35+
Use Blocks to define specific parts that can be added as part of the markup of the Rich Text Editor.
36+
37+
## [Plugins](plugins.md)
38+
39+
Extend the functionality of the Rich Text Editor with plugins.
40+
41+
## Data Type Definition Example
42+
43+
![Rich Text Editor - Data Type](images/rte-datatype-v10.png)
44+
45+
## Content Example
46+
47+
![Rich Text Editor - Content](images/rte-content-11.png)
48+
49+
## MVC View Example
50+
51+
### Without Modelsbuilder
52+
53+
```csharp
54+
@{
55+
if (Model.HasValue("richText")){
56+
<p>@(Model.Value("richText"))</p>
57+
}
58+
}
59+
```
60+
61+
### With Modelsbuilder
62+
63+
```csharp
64+
@{
65+
if (!string.IsNullOrEmpty(Model.RichText.ToString()))
66+
{
67+
<p>@Model.RichText</p>
68+
}
69+
}
70+
```
71+
72+
## Add values programmatically
73+
74+
See the example below to see how a value can be added or changed programmatically. To update a value of a property editor you need the [Content Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.ContentService.html).
75+
76+
{% hint style="info" %}
77+
The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.
78+
{% endhint %}
79+
80+
```csharp
81+
@using Umbraco.Cms.Core.Services;
82+
@inject IContentService Services;
83+
@{
84+
// Get access to ContentService
85+
var contentService = Services;
86+
87+
// Create a variable for the GUID of the page you want to update
88+
var guid = Guid.Parse("32e60db4-1283-4caa-9645-f2153f9888ef");
89+
90+
// Get the page using the GUID you've defined
91+
var content = contentService.GetById(guid); // ID of your page
92+
93+
// Create a variable for the desired value
94+
var htmlValue = new HtmlString("Add some text <strong>here</strong>");
95+
96+
// Set the value of the property with alias 'richText'.
97+
content.SetValue("richText", htmlValue);
98+
99+
// Save the change
100+
contentService.Save(content);
101+
}
102+
```
103+
104+
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
105+
106+
```csharp
107+
@{
108+
// Get the page using it's id
109+
var content = contentService.GetById(1234);
110+
}
111+
```
112+
113+
If Modelsbuilder is enabled you can get the alias of the desired property without using a magic string.
114+
115+
{% hint style="warning" %}
116+
The following example uses `IPublishedSnapshotAccessor` which is obsolete in Umbraco 15 and will be removed in a later version.
117+
{% endhint %}
118+
119+
```csharp
120+
@using Umbraco.Cms.Core.PublishedCache;
121+
@inject IPublishedSnapshotAccessor _publishedSnapshotAccessor;
122+
@{
123+
// Set the value of the property with alias 'richText'
124+
content.SetValue(Home.GetModelPropertyType(_publishedSnapshotAccessor, x => x.RichText).Alias, "Add some text <strong>here</strong>");
125+
}
126+
```
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Blocks in Rich Text Editor
1+
# Blocks
22

33
{% hint style="warning" %}
44
This article is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
@@ -98,4 +98,4 @@ The following example shows a Partial View of a Block with `MyBlockType` as Cont
9898

9999
## Build a Custom Backoffice View
100100

101-
Building Custom Views for Block representations in Backoffice is the same for all Block Editors. [Read about building a Custom View for Blocks here](../block-editor/build-custom-view-for-blocks.md)
101+
Building Custom Views for Block representations in Backoffice is the same for all Block Editors. [Read about building a Custom View for Blocks here](../../../../../tutorials/creating-custom-views-for-blocklist.md).
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Configuration
2+
3+
{% embed url="<https://www.youtube.com/watch?v=QRIWz9SotY4>" %}
4+
Rich Text Editor default implementation
5+
{% endembed %}
6+
7+
In this article, you will learn about different ways to configure the Rich Text Editor (RTE).
8+
9+
## Toolbar
10+
11+
You have full control over which options should be available on the RTE.
12+
13+
![Toolbar: All options enabled](images/toolbar-full-11.png)
14+
15+
In the example above, all 34 options have been enabled. These options include copy/paste buttons, font styles like bold and italics, bullet lists, and options to embed videos and insert images.
16+
17+
## Stylesheets
18+
19+
It is possible to define specific styles that can be used when editing content using the RTE. You can use as many of these styles with the RTE as you want.
20+
21+
The RTE styles are defined in CSS files which can be created in the **Settings** section. Read the [RTE Styles](styles.md) article to learn more about this feature.
22+
23+
## Dimensions
24+
25+
Define the `height` and `width` of the editor displayed in the Content section.
26+
27+
## Maximum size for inserted images
28+
29+
Define the maximum size for images added through the Rich Text Editor.
30+
31+
If inserted images are larger than the dimensions defined here, the images will be resized automatically.
32+
33+
## Mode
34+
35+
The Rich Text Editor comes in two different modes: Classic and Inline.
36+
37+
### Classic
38+
39+
The default mode which displays the toolbar at the top.
40+
41+
![RTE Mode: Classic](images/rte-mode-classic-11.png)
42+
43+
### Inline
44+
45+
In this mode, the toolbar is hidden and only shows up when content in the editor is highlighted.
46+
47+
![Rich Text Editor Inline mode](images/inline-mode-new.png)
48+
49+
## Blocks
50+
51+
Blocks can be added as elements in the Rich Text Editor. Configuration and rendering of Blocks are described in the [Blocks in Rich Text Editor](blocks.md) article.
52+
53+
## Overlay Size
54+
55+
Select the width of the link picker overlay. The overlay size comes in three sizes: Small, Medium, and Large.
56+
57+
## Hide Label
58+
59+
When this option is checked the label and description for the RTE property will be hidden.
60+
61+
## Ignore User Start Nodes
62+
63+
Some backoffice users might be restricted to specific parts of the Content tree. When the "Ignore User Start Nodes" option is checked, users can pick any piece of content, when adding internal links.
64+
65+
## Image Upload Folder
66+
67+
Images added through the RTE are by default added to the root of the Media library.
68+
69+
Sometimes you might want to add the images to a specific folder. This folder can be configured using the "Image Upload Folder" setting.

0 commit comments

Comments
 (0)