Class RichTextEditorPastedImages
Provides configuration options for managing how images pasted into the rich text editor are handled.
Inheritance
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Infrastructure.dll
Syntax
public sealed class RichTextEditorPastedImages
Constructors
View SourceRichTextEditorPastedImages(IUmbracoContextAccessor, IPublishedUrlProvider, ITemporaryFileService, IScopeProvider, IMediaImportService, IImageUrlGenerator, IEntityService, AppCaches)
Initializes a new instance of the RichTextEditorPastedImages class. Handles the processing of images pasted into the rich text editor, including temporary storage and import into the media library.
Declaration
public RichTextEditorPastedImages(IUmbracoContextAccessor umbracoContextAccessor, IPublishedUrlProvider publishedUrlProvider, ITemporaryFileService temporaryFileService, IScopeProvider scopeProvider, IMediaImportService mediaImportService, IImageUrlGenerator imageUrlGenerator, IEntityService entityService, AppCaches appCaches)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoContextAccessor | umbracoContextAccessor | Provides access to the current Umbraco context. |
| IPublishedUrlProvider | publishedUrlProvider | Resolves published URLs for content and media items. |
| ITemporaryFileService | temporaryFileService | Service for managing temporary files, such as those created when images are pasted. |
| IScopeProvider | scopeProvider | Manages database transaction scopes. |
| IMediaImportService | mediaImportService | Handles importing images into the media library. |
| IImageUrlGenerator | imageUrlGenerator | Generates URLs for images, including those stored in the media library. |
| IEntityService | entityService | Provides access to Umbraco entities, such as media items. |
| AppCaches | appCaches | Provides caching for application data. |
Methods
View SourceFindAndPersistPastedTempImagesAsync(string, Guid, Guid)
Finds all temporary pasted images in the provided HTML content, persists them to the media library, updates their URLs, and returns the modified HTML. Used by the RTE (and grid RTE) for drag/drop and pasting images.
Declaration
public Task<string> FindAndPersistPastedTempImagesAsync(string html, Guid mediaParentFolder, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| string | html | The HTML content containing pasted images with temporary references. |
| Guid | mediaParentFolder | The System.Guid of the media parent folder where images will be stored. If empty, the default media root is used. |
| Guid | userKey | The System.Guid of the user performing the operation. |
Returns
| Type | Description |
|---|---|
| Task<string> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the updated HTML with persisted image URLs and data attributes updated. |