/
EyeDropperColorPickerPropertyEditor.cs
46 lines (41 loc) · 1.72 KB
/
EyeDropperColorPickerPropertyEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Core.PropertyEditors;
[DataEditor(
Constants.PropertyEditors.Aliases.ColorPickerEyeDropper,
EditorType.PropertyValue | EditorType.MacroParameter,
"Eye Dropper Color Picker",
"eyedropper",
Icon = "icon-colorpicker",
Group = Constants.PropertyEditors.Groups.Pickers,
ValueEditorIsReusable = true)]
public class EyeDropperColorPickerPropertyEditor : DataEditor
{
private readonly IEditorConfigurationParser _editorConfigurationParser;
private readonly IIOHelper _ioHelper;
// Scheduled for removal in v12
[Obsolete("Please use constructor that takes an IEditorConfigurationParser instead")]
public EyeDropperColorPickerPropertyEditor(
IDataValueEditorFactory dataValueEditorFactory,
IIOHelper ioHelper,
EditorType type = EditorType.PropertyValue)
: this(dataValueEditorFactory, ioHelper, StaticServiceProvider.Instance.GetRequiredService<IEditorConfigurationParser>(), type)
{
}
public EyeDropperColorPickerPropertyEditor(
IDataValueEditorFactory dataValueEditorFactory,
IIOHelper ioHelper,
IEditorConfigurationParser editorConfigurationParser,
EditorType type = EditorType.PropertyValue)
: base(dataValueEditorFactory, type)
{
_ioHelper = ioHelper;
_editorConfigurationParser = editorConfigurationParser;
SupportsReadOnly = true;
}
/// <inheritdoc />
protected override IConfigurationEditor CreateConfigurationEditor() =>
new EyeDropperColorPickerConfigurationEditor(_ioHelper, _editorConfigurationParser);
}