Interface RichTextHandler


@ProviderType public interface RichTextHandler
Manages XHTML rich text fragment formatting.

The interface is implemented by a Sling Model. You can adapt from SlingHttpServletRequest or Resource to get a context-specific handler instance.

  • Method Summary

    Modifier and Type
    Method
    Description
    get(@Nullable String text)
    Build formatter text from given raw text string.
    get(@Nullable org.apache.sling.api.resource.Resource resource)
    Build formatted text from content resource using default property names.
    boolean
    isEmpty(@Nullable String text)
    Check if the given formatted text block is empty.
  • Method Details

    • get

      @NotNull @NotNull RichTextBuilder get(@Nullable @Nullable org.apache.sling.api.resource.Resource resource)
      Build formatted text from content resource using default property names.
      Parameters:
      resource - Resource
      Returns:
      Rich text builder
    • get

      @NotNull @NotNull RichTextBuilder get(@Nullable @Nullable String text)
      Build formatter text from given raw text string.
      Parameters:
      text - Raw text
      Returns:
      Rich text builder
    • isEmpty

      boolean isEmpty(@Nullable @Nullable String text)
      Check if the given formatted text block is empty. A text block containing only one paragraph element and whitespaces is considered as empty. A text block with more than 20 characters (raw data) is never considered as empty.
      Parameters:
      text - XHTML text string (root element not needed)
      Returns:
      true if text block is empty