diff --git a/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextDefinition.java b/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextDefinition.java index 5d6d550..5d68a25 100644 --- a/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextDefinition.java +++ b/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextDefinition.java @@ -1,14 +1,16 @@ package com.merkle.oss.magnolia.definition.custom.richtext; -import com.merkle.oss.magnolia.definition.custom.richtext.toolbarbuilder.RichTextToolbarConfig; -import info.magnolia.ui.field.RichTextFieldDefinition; +import info.magnolia.dam.app.field.DamRichTextFieldDefinition; -import javax.annotation.Nullable; import java.util.Collections; import java.util.Map; import java.util.Optional; -public class ExtendedRichTextDefinition extends RichTextFieldDefinition { +import javax.annotation.Nullable; + +import com.merkle.oss.magnolia.definition.custom.richtext.toolbarbuilder.RichTextToolbarConfig; + +public class ExtendedRichTextDefinition extends DamRichTextFieldDefinition { @Nullable private String formatTags; @Nullable diff --git a/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextFactory.java b/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextFactory.java index a23c67c..d49f4ee 100644 --- a/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextFactory.java +++ b/custom-definitions/src/main/java/com/merkle/oss/magnolia/definition/custom/richtext/ExtendedRichTextFactory.java @@ -1,23 +1,27 @@ package com.merkle.oss.magnolia.definition.custom.richtext; -import com.merkle.oss.magnolia.definition.custom.richtext.toolbarbuilder.RichTextToolbarConfig; -import com.vaadin.server.VaadinService; +import info.magnolia.dam.api.AssetProviderRegistry; +import info.magnolia.dam.app.field.factory.DamRichTextFieldFactory; import info.magnolia.i18nsystem.I18nizer; import info.magnolia.i18nsystem.SimpleTranslator; import info.magnolia.ui.dialog.DialogDefinitionRegistry; -import info.magnolia.ui.field.factory.RichTextFieldFactory; import info.magnolia.ui.framework.ioc.UiComponentProvider; import info.magnolia.ui.vaadin.ckeditor.MagnoliaCKEditorConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import javax.inject.Inject; import java.util.Collections; import java.util.List; import java.util.Optional; -public class ExtendedRichTextFactory extends RichTextFieldFactory { +import javax.annotation.Nullable; +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.merkle.oss.magnolia.definition.custom.richtext.toolbarbuilder.RichTextToolbarConfig; +import com.vaadin.server.VaadinService; + +public class ExtendedRichTextFactory extends DamRichTextFieldFactory { private static final Logger LOG = LoggerFactory.getLogger(ExtendedRichTextFactory.class); @Inject @@ -26,9 +30,10 @@ public ExtendedRichTextFactory( final UiComponentProvider componentProvider, final SimpleTranslator i18n, final DialogDefinitionRegistry dialogDefinitionRegistry, - final I18nizer i18nizer + final I18nizer i18nizer, + final AssetProviderRegistry assetProviderRegistry ) { - super(definition, componentProvider, i18n, dialogDefinitionRegistry, i18nizer); + super(definition, componentProvider, i18n, dialogDefinitionRegistry, i18nizer, assetProviderRegistry); } @Override diff --git a/magnolia-builders/src/main/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilder.java b/magnolia-builders/src/main/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilder.java index 7531535..5b6b386 100644 --- a/magnolia-builders/src/main/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilder.java +++ b/magnolia-builders/src/main/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilder.java @@ -1,5 +1,6 @@ package com.merkle.oss.magnolia.definition.builder.simple; +import info.magnolia.dam.app.field.DamRichTextFieldDefinition; import info.magnolia.ui.field.RichTextFieldDefinition; /** @@ -7,10 +8,10 @@ * @see magnolia Docs - Rich text field * @author Merkle DACH */ -public class RichTextFieldDefinitionBuilder extends AbstractRichTextFieldDefinitionBuilder { +public class RichTextFieldDefinitionBuilder extends AbstractRichTextFieldDefinitionBuilder { - public RichTextFieldDefinition build(final String name) { - final RichTextFieldDefinition definition = new RichTextFieldDefinition(); + public DamRichTextFieldDefinition build(final String name) { + final DamRichTextFieldDefinition definition = new DamRichTextFieldDefinition(); super.populate(definition, name); return definition; } diff --git a/magnolia-builders/src/test/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilderTest.java b/magnolia-builders/src/test/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilderTest.java index 09a6580..9be8100 100644 --- a/magnolia-builders/src/test/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilderTest.java +++ b/magnolia-builders/src/test/java/com/merkle/oss/magnolia/definition/builder/simple/RichTextFieldDefinitionBuilderTest.java @@ -1,28 +1,20 @@ package com.merkle.oss.magnolia.definition.builder.simple; -import com.merkle.oss.magnolia.definition.builder.AbstractFieldDefinitionBuilderTestCase; +import static org.junit.jupiter.api.Assertions.*; + +import info.magnolia.dam.app.field.DamRichTextFieldDefinition; +import info.magnolia.dam.app.field.factory.DamRichTextFieldFactory; import info.magnolia.repository.RepositoryConstants; -import info.magnolia.ui.datasource.BaseDatasourceDefinition; -import info.magnolia.ui.datasource.DatasourceDefinition; -import info.magnolia.ui.field.ComboBoxFieldDefinition; -import info.magnolia.ui.field.LinkFieldDefinition; -import info.magnolia.ui.field.RichTextFieldDefinition; -import info.magnolia.ui.field.SafeHtmlValidatorDefinition; -import info.magnolia.ui.field.factory.ComboBoxFieldFactory; -import info.magnolia.ui.field.factory.RichTextFieldFactory; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import java.util.HashMap; -import java.util.Map; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import com.merkle.oss.magnolia.definition.builder.AbstractFieldDefinitionBuilderTestCase; class RichTextFieldDefinitionBuilderTest extends AbstractFieldDefinitionBuilderTestCase { @Test void testBuilder() { - final RichTextFieldDefinition definition = super.assertField(new RichTextFieldDefinitionBuilder(), (name, builder) -> builder.build(name)) + final DamRichTextFieldDefinition definition = super.assertField(new RichTextFieldDefinitionBuilder(), (name, builder) -> builder.build(name)) .alignment(true) .images(true) .lists(false) @@ -46,11 +38,11 @@ void testBuilder() { assertEquals("someFontSizes", definition.getFontSizes()); assertEquals("someConfigJsFile", definition.getConfigJsFile()); - final RichTextFieldDefinition emptyDefinition = new RichTextFieldDefinitionBuilder().build("richText"); + final DamRichTextFieldDefinition emptyDefinition = new RichTextFieldDefinitionBuilder().build("richText"); assertEquals(String.class, emptyDefinition.getType()); - assertEquals(RichTextFieldFactory.class, emptyDefinition.getFactoryClass()); + assertEquals(DamRichTextFieldFactory.class, emptyDefinition.getFactoryClass()); assertEquals(0, emptyDefinition.getValidators().size()); - assertEquals(1, emptyDefinition.getLinkFieldDefinitions().size()); + assertEquals(2, emptyDefinition.getLinkFieldDefinitions().size()); assertNotNull(emptyDefinition.getLinkFieldDefinitions().get(RepositoryConstants.WEBSITE)); } }