From 724eae95c09beda1731c5da7f9d4eb058b562db7 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 20 Oct 2022 17:30:53 +0200 Subject: [PATCH 01/11] [gitflow-maven-plugin] Update for next development version 1.6.3-SNAPSHOT --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9a9c605..36831ce 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ io.wcm io.wcm.handler.richtext - 1.6.2 + 1.6.3-SNAPSHOT jar RichText Handler @@ -49,7 +49,7 @@ handler/richtext - 2022-10-20T15:29:50Z + 2022-10-20T15:30:52Z From bd3cbac0211c4d4bd21fe71958eeb6431944e902 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Wed, 30 Nov 2022 10:46:40 +0100 Subject: [PATCH 02/11] rename to "myproject-links" to avoid potential problems with policy editor --- src/site/markdown/rte-link-plugin.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/site/markdown/rte-link-plugin.md b/src/site/markdown/rte-link-plugin.md index d795e44..ac0deb3 100644 --- a/src/site/markdown/rte-link-plugin.md +++ b/src/site/markdown/rte-link-plugin.md @@ -79,8 +79,8 @@ Example for a custom `linkPlugin.js`: initializeUI: function (tbGenerator) { // register icon for this plugins toolbar actions - tbGenerator.registerIcon("myproject.links#modifylink", "link"); - tbGenerator.registerIcon("myproject.links#unlink", "linkOff"); + tbGenerator.registerIcon("myproject-links#modifylink", "link"); + tbGenerator.registerIcon("myproject-links#unlink", "linkOff"); // call the "super" method this.inherited(arguments); } @@ -90,7 +90,7 @@ Example for a custom `linkPlugin.js`: })(window.jQuery); // register plugin -CUI.rte.plugins.PluginRegistry.register("myproject.links", myproject.rte.plugins.LinkPlugin); +CUI.rte.plugins.PluginRegistry.register("myproject-links", myproject.rte.plugins.LinkPlugin); ``` Example for a custom `linkDialog.js`: From 82c16e224bfeda0d1a39a1b6b8cc62f8521b093c Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Wed, 30 Nov 2022 10:55:25 +0100 Subject: [PATCH 03/11] fix link to sources --- src/site/markdown/rte-link-plugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/markdown/rte-link-plugin.md b/src/site/markdown/rte-link-plugin.md index ac0deb3..319c2bb 100644 --- a/src/site/markdown/rte-link-plugin.md +++ b/src/site/markdown/rte-link-plugin.md @@ -133,4 +133,4 @@ For more details have a look into the [sources of the wcm.io RichText Handler li [aem-rte]: https://helpx.adobe.com/experience-manager/6-4/sites/administering/using/rich-text-editor.html [link-handler]: ../link/ [rte-full-example]: https://github.com/wcm-io/wcm-io-samples/blob/develop/bundles/core/src/main/webapp/app-root/components/global/include/richTextConfig.json -[rte-link-plugin-sources]: https://github.com/wcm-io/wcm-io-handler/tree/develop/richtext/src/main/webapp/app-root/clientlibs/rte.plugins/js +[rte-link-plugin-sources]: https://github.com/wcm-io/io.wcm.handler.richtext/tree/develop/src/main/webapp/app-root/clientlibs/rte.plugins/js From 788b0502c992cc3e46e7708fb4c2cbe594bc345b Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Wed, 30 Nov 2022 12:37:04 +0100 Subject: [PATCH 04/11] add hint about LinkType#hasRichTextPlugin() --- src/site/markdown/rte-link-plugin.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/site/markdown/rte-link-plugin.md b/src/site/markdown/rte-link-plugin.md index 319c2bb..c98617c 100644 --- a/src/site/markdown/rte-link-plugin.md +++ b/src/site/markdown/rte-link-plugin.md @@ -61,6 +61,8 @@ For a complete example see [richTextConfig.json][rte-full-example]. If you want to customize the link plugin dialog you have to create your own custom RTE link plugin that inherits from the wcm.io RichText Handler link plugin. Then you can override some of the methods that control which fields are displayed for each link type or all link types. +By default, custom link types are not shown in the dropdown for link type selection of the RTE link dialog. In your custom link type class extending [LinkType][link-handler-linktype], you have to return `true` in the method `hasRichTextPlugin()`. + Example for a custom `linkPlugin.js`: ```js @@ -134,3 +136,4 @@ For more details have a look into the [sources of the wcm.io RichText Handler li [link-handler]: ../link/ [rte-full-example]: https://github.com/wcm-io/wcm-io-samples/blob/develop/bundles/core/src/main/webapp/app-root/components/global/include/richTextConfig.json [rte-link-plugin-sources]: https://github.com/wcm-io/io.wcm.handler.richtext/tree/develop/src/main/webapp/app-root/clientlibs/rte.plugins/js +[link-handler-linktype]: https://wcm.io/handler/link/apidocs/io/wcm/handler/link/spi/LinkType.html \ No newline at end of file From d475edc770019917f52b2b6ce2e4c8196d1fd9bd Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 16 Dec 2022 15:41:40 +0100 Subject: [PATCH 05/11] Switch to Java 11 as minimum version. --- .github/workflows/maven-build.yml | 2 +- .github/workflows/maven-deploy.yml | 10 +++++----- .github/workflows/release-from-tag.yml | 2 +- changes.xml | 6 ++++++ pom.xml | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index bd99c91..33879bd 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -20,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [8, 11, 17] + java: [11, 17] os: [ubuntu-latest] distribution: [temurin] diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index 96d6b65..aef0ee4 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -1,4 +1,4 @@ -# Deploy snapshots to Sonatpe OSS repository and deploy site to GitHub Pages +# Deploy snapshots to Sonatype OSS repository and deploy site to GitHub Pages name: Deploy @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Configure GIT run: | @@ -23,11 +23,11 @@ jobs: git config --global user.name "${{ secrets.GH_SITE_DEPLOY_NAME }}" - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: temurin - java-version: 8 - cache: 'maven' + java-version: 11 + cache: maven - name: Build, verify, deploy, generate site env: diff --git a/.github/workflows/release-from-tag.yml b/.github/workflows/release-from-tag.yml index f2ab4d2..12b8729 100644 --- a/.github/workflows/release-from-tag.yml +++ b/.github/workflows/release-from-tag.yml @@ -12,7 +12,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ncipollo/release-action@v1 with: body: 'Changes: https://wcm.io/handler/richtext/changes-report.html' diff --git a/changes.xml b/changes.xml index e6db23c..9e21602 100644 --- a/changes.xml +++ b/changes.xml @@ -23,6 +23,12 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> + + + Switch to Java 11 as minimum version. + + + DefaultRewriteContentHandler: Do not decode attribute values read from data attributes explicitly to avoid decoding properly encoded external URLs. diff --git a/pom.xml b/pom.xml index 36831ce..0a2d7fd 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ io.wcm io.wcm.parent_toplevel - 2.1.0 + 2.2.0-SNAPSHOT From 8ec1f699d520c4599c052a0aed448d5920922db4 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 16 Dec 2022 15:45:26 +0100 Subject: [PATCH 06/11] Eliminate dependency to Guava. --- changes.xml | 3 +++ .../richtext/DefaultRewriteContentHandler.java | 3 +-- .../handler/richtext/impl/RichTextHandlerImpl.java | 12 ++++++------ .../handler/richtext/spi/RichTextHandlerConfig.java | 4 +--- .../java/io/wcm/handler/richtext/RichTextTest.java | 8 ++++---- .../richtext/impl/RichTextHandlerImplTest.java | 7 ++----- .../testcontext/DummyMediaHandlerConfig.java | 6 ++---- .../richtext/testcontext/DummyUrlHandlerConfig.java | 7 ++----- 8 files changed, 21 insertions(+), 29 deletions(-) diff --git a/changes.xml b/changes.xml index 9e21602..0f933eb 100644 --- a/changes.xml +++ b/changes.xml @@ -27,6 +27,9 @@ Switch to Java 11 as minimum version. + + Eliminate dependency to Guava. + diff --git a/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java b/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java index c9ca0a8..803a797 100644 --- a/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java +++ b/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java @@ -48,7 +48,6 @@ import org.slf4j.LoggerFactory; import com.day.cq.commons.jcr.JcrConstants; -import com.google.common.collect.ImmutableSet; import io.wcm.handler.link.Link; import io.wcm.handler.link.LinkHandler; @@ -88,7 +87,7 @@ public final class DefaultRewriteContentHandler implements RewriteContentHandler /** * List of all tag names that should not be rendered "self-closing" to avoid interpretation errors in browsers */ - private static final Set NONSELFCLOSING_TAGS = ImmutableSet.of( + private static final Set NONSELFCLOSING_TAGS = Set.of( "div", "span", "strong", diff --git a/src/main/java/io/wcm/handler/richtext/impl/RichTextHandlerImpl.java b/src/main/java/io/wcm/handler/richtext/impl/RichTextHandlerImpl.java index 8fc15d6..4895c0d 100644 --- a/src/main/java/io/wcm/handler/richtext/impl/RichTextHandlerImpl.java +++ b/src/main/java/io/wcm/handler/richtext/impl/RichTextHandlerImpl.java @@ -20,6 +20,7 @@ package io.wcm.handler.richtext.impl; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.commons.lang3.StringUtils; @@ -39,7 +40,6 @@ import org.slf4j.LoggerFactory; import com.day.cq.wcm.api.Page; -import com.google.common.collect.ImmutableList; import io.wcm.handler.richtext.RichText; import io.wcm.handler.richtext.RichTextBuilder; @@ -122,7 +122,7 @@ else if (richTextRequest.getResource() != null) { private List processRichText(String text) { if (isEmpty(text)) { - return ImmutableList.of(); + return Collections.emptyList(); } // Parse text @@ -136,20 +136,20 @@ private List processRichText(String text) { } // return xhtml elements - return ImmutableList.copyOf(contentParent.cloneContent()); + return List.copyOf(contentParent.cloneContent()); } catch (JDOMException ex) { if (log.isDebugEnabled()) { log.debug("Unable to parse XHTML text." + (currentPage != null ? " Current page is " + currentPage.getPath() + "." : ""), ex); } - return ImmutableList.of(); + return Collections.emptyList(); } } private List processPlainText(String text) { if (StringUtils.isBlank(text)) { - return ImmutableList.of(); + return Collections.emptyList(); } List content = new ArrayList<>(); @@ -161,7 +161,7 @@ private List processPlainText(String text) { content.add(new Text(lines[i])); } - return ImmutableList.copyOf(content); + return List.copyOf(content); } @Override diff --git a/src/main/java/io/wcm/handler/richtext/spi/RichTextHandlerConfig.java b/src/main/java/io/wcm/handler/richtext/spi/RichTextHandlerConfig.java index 5eaceb0..6277229 100644 --- a/src/main/java/io/wcm/handler/richtext/spi/RichTextHandlerConfig.java +++ b/src/main/java/io/wcm/handler/richtext/spi/RichTextHandlerConfig.java @@ -24,8 +24,6 @@ import org.jetbrains.annotations.NotNull; import org.osgi.annotation.versioning.ConsumerType; -import com.google.common.collect.ImmutableList; - import io.wcm.handler.richtext.DefaultRewriteContentHandler; import io.wcm.handler.richtext.util.RewriteContentHandler; import io.wcm.sling.commons.caservice.ContextAwareService; @@ -38,7 +36,7 @@ @ConsumerType public abstract class RichTextHandlerConfig implements ContextAwareService { - private static final List> DEFAULT_REWRITE_CONTENT_HANDLERS = ImmutableList.>of( + private static final List> DEFAULT_REWRITE_CONTENT_HANDLERS = List.of( DefaultRewriteContentHandler.class); /** diff --git a/src/test/java/io/wcm/handler/richtext/RichTextTest.java b/src/test/java/io/wcm/handler/richtext/RichTextTest.java index 0ef4468..8bcb0d8 100644 --- a/src/test/java/io/wcm/handler/richtext/RichTextTest.java +++ b/src/test/java/io/wcm/handler/richtext/RichTextTest.java @@ -25,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.Collections; import java.util.List; import org.jdom2.Content; @@ -32,8 +33,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import com.google.common.collect.ImmutableList; - import io.wcm.handler.commons.dom.Div; import io.wcm.handler.commons.dom.Span; @@ -47,8 +46,9 @@ void setUp() { } @Test + @SuppressWarnings("null") void testWithContent() { - List content = ImmutableList.of(new Span("wurst"), new Text(" "), new Div().setCssClass("abc")); + List content = List.of(new Span("wurst"), new Text(" "), new Div().setCssClass("abc")); RichText underTest = new RichText(richTextRequest, content); assertSame(richTextRequest, underTest.getRichTextRequest()); @@ -59,7 +59,7 @@ void testWithContent() { @Test void testWithoutContent() { - RichText underTest = new RichText(richTextRequest, ImmutableList.of()); + RichText underTest = new RichText(richTextRequest, Collections.emptyList()); assertFalse(underTest.isValid()); assertTrue(underTest.getContent().isEmpty()); diff --git a/src/test/java/io/wcm/handler/richtext/impl/RichTextHandlerImplTest.java b/src/test/java/io/wcm/handler/richtext/impl/RichTextHandlerImplTest.java index bcb62ca..3abaf4a 100644 --- a/src/test/java/io/wcm/handler/richtext/impl/RichTextHandlerImplTest.java +++ b/src/test/java/io/wcm/handler/richtext/impl/RichTextHandlerImplTest.java @@ -34,8 +34,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import com.google.common.collect.ImmutableList; - import io.wcm.handler.richtext.DefaultRewriteContentHandler; import io.wcm.handler.richtext.RichText; import io.wcm.handler.richtext.RichTextHandler; @@ -180,8 +178,7 @@ void testContentWithCustomRewriterContentHandler() { context.registerService(RichTextHandlerConfig.class, new RichTextHandlerConfig() { @Override public List> getRewriteContentHandlers() { - return ImmutableList.>of( - DefaultRewriteContentHandler.class, CustomRewriteContentHandler.class); + return List.of(DefaultRewriteContentHandler.class, CustomRewriteContentHandler.class); } }); @@ -202,7 +199,7 @@ public List rewriteElement(Element element) { @Override public List rewriteText(Text text) { - return ImmutableList.of(new Text(text.getText().toLowerCase())); + return List.of(new Text(text.getText().toLowerCase())); } } diff --git a/src/test/java/io/wcm/handler/richtext/testcontext/DummyMediaHandlerConfig.java b/src/test/java/io/wcm/handler/richtext/testcontext/DummyMediaHandlerConfig.java index a1534e2..0677572 100644 --- a/src/test/java/io/wcm/handler/richtext/testcontext/DummyMediaHandlerConfig.java +++ b/src/test/java/io/wcm/handler/richtext/testcontext/DummyMediaHandlerConfig.java @@ -19,10 +19,9 @@ */ package io.wcm.handler.richtext.testcontext; +import java.util.Collections; import java.util.List; -import com.google.common.collect.ImmutableList; - import io.wcm.handler.media.spi.MediaHandlerConfig; import io.wcm.handler.media.spi.MediaSource; @@ -32,8 +31,7 @@ @SuppressWarnings("null") public class DummyMediaHandlerConfig extends MediaHandlerConfig { - private static final List> MEDIA_SOURCES = - ImmutableList.>of(); + private static final List> MEDIA_SOURCES = Collections.emptyList(); @Override public List> getSources() { diff --git a/src/test/java/io/wcm/handler/richtext/testcontext/DummyUrlHandlerConfig.java b/src/test/java/io/wcm/handler/richtext/testcontext/DummyUrlHandlerConfig.java index 64bc2b1..acdbb59 100644 --- a/src/test/java/io/wcm/handler/richtext/testcontext/DummyUrlHandlerConfig.java +++ b/src/test/java/io/wcm/handler/richtext/testcontext/DummyUrlHandlerConfig.java @@ -23,8 +23,6 @@ import org.apache.sling.api.resource.Resource; -import com.google.common.collect.ImmutableList; - import io.wcm.handler.url.integrator.IntegratorMode; import io.wcm.handler.url.integrator.IntegratorModes; import io.wcm.handler.url.spi.UrlHandlerConfig; @@ -37,10 +35,9 @@ public class DummyUrlHandlerConfig extends UrlHandlerConfig { public static final int SITE_ROOT_LEVEL = 4; - private static final List INTEGRATOR_MODES = ImmutableList.of( + private static final List INTEGRATOR_MODES = List.of( IntegratorModes.SIMPLE, - IntegratorModes.EXTENDED - ); + IntegratorModes.EXTENDED); @Override public int getSiteRootLevel(Resource resource) { From ddf53de9f1848053a37ef5df1a04927e4797836a Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 22 Dec 2022 15:58:22 +0100 Subject: [PATCH 07/11] switch issue management to GitHub --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3bdb18..f1c350d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Rich text processing and markup generation. Documentation: https://wcm.io/handler/richtext/
-Issues: https://wcm-io.atlassian.net/projects/WHAN
+Issues: https://github.com/wcm-io/io.wcm.handler.richtext/issues
Wiki: https://wcm-io.atlassian.net/wiki/
Continuous Integration: https://github.com/wcm-io/io.wcm.handler.richtext/actions
Commercial support: https://wcm.io/commercial-support.html From 860b56d4a59ac445de2c8c5cc3a34e8c3dffd5ee Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 12 Jan 2023 22:38:33 +0100 Subject: [PATCH 08/11] update dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0a2d7fd..8cd77e2 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ io.wcm io.wcm.parent_toplevel - 2.2.0-SNAPSHOT + 2.2.0 From bd3cd54cd3633d7237b4eb846de8f230bb5b38ec Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 27 Mar 2023 14:19:48 +0200 Subject: [PATCH 09/11] update dependencies --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8cd77e2..c9fc54b 100644 --- a/pom.xml +++ b/pom.xml @@ -137,7 +137,7 @@ io.wcm io.wcm.testing.aem-mock.junit5 - 5.0.0 + 5.2.0 test @@ -155,7 +155,7 @@ io.wcm io.wcm.testing.wcm-io-mock.sling - 1.1.0 + 1.2.0 test From 27bbf2c7910fc2aefa87c18c31e4aafe9c21388d Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Wed, 19 Apr 2023 13:17:53 +0200 Subject: [PATCH 10/11] prepare release --- changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes.xml b/changes.xml index 0f933eb..6b987d9 100644 --- a/changes.xml +++ b/changes.xml @@ -23,7 +23,7 @@ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> - + Switch to Java 11 as minimum version. From e4003ee1657c5b01b2fd524dee47f453ae20cdcc Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Wed, 19 Apr 2023 13:18:12 +0200 Subject: [PATCH 11/11] [gitflow-maven-plugin] Update versions for release 1.6.4 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c9fc54b..49926dd 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ io.wcm io.wcm.handler.richtext - 1.6.3-SNAPSHOT + 1.6.4 jar RichText Handler @@ -49,7 +49,7 @@ handler/richtext - 2022-10-20T15:30:52Z + 2023-04-19T11:18:11Z