Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Apr 19, 2023
2 parents c960fa9 + e4003ee commit d944143
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [8, 11, 17]
java: [11, 17]
os: [ubuntu-latest]
distribution: [temurin]

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -15,19 +15,19 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Configure GIT
run: |
git config --global user.email "${{ secrets.GH_SITE_DEPLOY_EMAIL }}"
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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Rich text processing and markup generation.

Documentation: https://wcm.io/handler/richtext/<br/>
Issues: https://wcm-io.atlassian.net/projects/WHAN<br/>
Issues: https://github.com/wcm-io/io.wcm.handler.richtext/issues<br/>
Wiki: https://wcm-io.atlassian.net/wiki/<br/>
Continuous Integration: https://github.com/wcm-io/io.wcm.handler.richtext/actions<br/>
Commercial support: https://wcm.io/commercial-support.html
Expand Down
9 changes: 9 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.6.4" date="2023-04-19">
<action type="update" dev="sseifert">
Switch to Java 11 as minimum version.
</action>
<action type="update" dev="sseifert">
Eliminate dependency to Guava.
</action>
</release>

<release version="1.6.2" date="2022-10-20">
<action type="fix" dev="sseifert" issue="WHAN-52">
DefaultRewriteContentHandler: Do not decode attribute values read from data attributes explicitly to avoid decoding properly encoded external URLs.
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.parent_toplevel</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
<relativePath/>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.richtext</artifactId>
<version>1.6.2</version>
<version>1.6.4</version>
<packaging>jar</packaging>

<name>RichText Handler</name>
Expand All @@ -49,7 +49,7 @@
<site.url.module.prefix>handler/richtext</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2022-10-20T15:29:50Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-04-19T11:18:11Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down Expand Up @@ -137,7 +137,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>5.0.0</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -155,7 +155,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.wcm-io-mock.sling</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> NONSELFCLOSING_TAGS = ImmutableSet.of(
private static final Set<String> NONSELFCLOSING_TAGS = Set.of(
"div",
"span",
"strong",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -122,7 +122,7 @@ else if (richTextRequest.getResource() != null) {

private List<Content> processRichText(String text) {
if (isEmpty(text)) {
return ImmutableList.of();
return Collections.emptyList();
}

// Parse text
Expand All @@ -136,20 +136,20 @@ private List<Content> 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<Content> processPlainText(String text) {
if (StringUtils.isBlank(text)) {
return ImmutableList.of();
return Collections.emptyList();
}

List<Content> content = new ArrayList<>();
Expand All @@ -161,7 +161,7 @@ private List<Content> processPlainText(String text) {
content.add(new Text(lines[i]));
}

return ImmutableList.copyOf(content);
return List.copyOf(content);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +36,7 @@
@ConsumerType
public abstract class RichTextHandlerConfig implements ContextAwareService {

private static final List<Class<? extends RewriteContentHandler>> DEFAULT_REWRITE_CONTENT_HANDLERS = ImmutableList.<Class<? extends RewriteContentHandler>>of(
private static final List<Class<? extends RewriteContentHandler>> DEFAULT_REWRITE_CONTENT_HANDLERS = List.of(
DefaultRewriteContentHandler.class);

/**
Expand Down
11 changes: 7 additions & 4 deletions src/site/markdown/rte-link-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -79,8 +81,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);
}
Expand All @@ -90,7 +92,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`:
Expand Down Expand Up @@ -133,4 +135,5 @@ 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
[link-handler-linktype]: https://wcm.io/handler/link/apidocs/io/wcm/handler/link/spi/LinkType.html
8 changes: 4 additions & 4 deletions src/test/java/io/wcm/handler/richtext/RichTextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
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;
import org.jdom2.Text;
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;

Expand All @@ -47,8 +46,9 @@ void setUp() {
}

@Test
@SuppressWarnings("null")
void testWithContent() {
List<Content> content = ImmutableList.<Content>of(new Span("wurst"), new Text(" "), new Div().setCssClass("abc"));
List<Content> content = List.of(new Span("wurst"), new Text(" "), new Div().setCssClass("abc"));
RichText underTest = new RichText(richTextRequest, content);

assertSame(richTextRequest, underTest.getRichTextRequest());
Expand All @@ -59,7 +59,7 @@ void testWithContent() {

@Test
void testWithoutContent() {
RichText underTest = new RichText(richTextRequest, ImmutableList.<Content>of());
RichText underTest = new RichText(richTextRequest, Collections.emptyList());

assertFalse(underTest.isValid());
assertTrue(underTest.getContent().isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -180,8 +178,7 @@ void testContentWithCustomRewriterContentHandler() {
context.registerService(RichTextHandlerConfig.class, new RichTextHandlerConfig() {
@Override
public List<Class<? extends RewriteContentHandler>> getRewriteContentHandlers() {
return ImmutableList.<Class<? extends RewriteContentHandler>>of(
DefaultRewriteContentHandler.class, CustomRewriteContentHandler.class);
return List.of(DefaultRewriteContentHandler.class, CustomRewriteContentHandler.class);
}
});

Expand All @@ -202,7 +199,7 @@ public List<Content> rewriteElement(Element element) {

@Override
public List<Content> rewriteText(Text text) {
return ImmutableList.<Content>of(new Text(text.getText().toLowerCase()));
return List.of(new Text(text.getText().toLowerCase()));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -32,8 +31,7 @@
@SuppressWarnings("null")
public class DummyMediaHandlerConfig extends MediaHandlerConfig {

private static final List<Class<? extends MediaSource>> MEDIA_SOURCES =
ImmutableList.<Class<? extends MediaSource>>of();
private static final List<Class<? extends MediaSource>> MEDIA_SOURCES = Collections.emptyList();

@Override
public List<Class<? extends MediaSource>> getSources() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,10 +35,9 @@ public class DummyUrlHandlerConfig extends UrlHandlerConfig {

public static final int SITE_ROOT_LEVEL = 4;

private static final List<IntegratorMode> INTEGRATOR_MODES = ImmutableList.<IntegratorMode>of(
private static final List<IntegratorMode> INTEGRATOR_MODES = List.of(
IntegratorModes.SIMPLE,
IntegratorModes.EXTENDED
);
IntegratorModes.EXTENDED);

@Override
public int getSiteRootLevel(Resource resource) {
Expand Down

0 comments on commit d944143

Please sign in to comment.