Class ContentManager

java.lang.Object
com.wontlost.ckeditor.internal.ContentManager

public class ContentManager extends Object
Internal class for managing editor content. Handles content retrieval, setting, sanitization, and transformation.

This class is an internal API and should not be used directly by external code.

  • Constructor Details

    • ContentManager

      public ContentManager(HtmlSanitizer htmlSanitizer)
      Create a content manager.
      Parameters:
      htmlSanitizer - HTML sanitizer, may be null
  • Method Details

    • getSanitizedValue

      public String getSanitizedValue(String html)
      Get sanitized HTML content.
      Parameters:
      html - raw HTML
      Returns:
      sanitized HTML, or raw content if no sanitizer is set
    • getPlainText

      public String getPlainText(String html)
      Convert HTML to plain text.
      Parameters:
      html - HTML content
      Returns:
      plain text content
    • getSanitizedHtml

      public String getSanitizedHtml(String html)
      Sanitize HTML using relaxed rules.
      Parameters:
      html - HTML content
      Returns:
      sanitized HTML
    • sanitizeHtml

      public String sanitizeHtml(String html, org.jsoup.safety.Safelist safelist)
      Sanitize HTML using custom rules.
      Parameters:
      html - HTML content
      safelist - sanitization rules
      Returns:
      sanitized HTML
    • normalizeForComparison

      public String normalizeForComparison(String html)
      Normalize HTML content for comparison.
      Parameters:
      html - HTML content
      Returns:
      normalized HTML
    • isContentEmpty

      public boolean isContentEmpty(String html)
      Check whether the content is empty.
      Parameters:
      html - HTML content
      Returns:
      true if the content is empty or contains only whitespace tags
    • getCharacterCount

      public int getCharacterCount(String html)
      Estimate the character count of the content (excluding HTML tags).
      Parameters:
      html - HTML content
      Returns:
      character count
    • getWordCount

      public int getWordCount(String html)
      Estimate the word count of the content.
      Parameters:
      html - HTML content
      Returns:
      word count