Convenience wrapper for tables in different schemas. While for HTML schemas as used for data view representation in CKEditor 5 high level methods can be used to modify a table (HTMLTableElement), the same convenience cannot be used for <table> elements as retrieved via CoreMedia Rich Text 1.0 data.

This wrapper will provide similar convenience for both, like, for example, creating <tbody> elements, accessing <thead> elements, etc.

Constructors

Accessors

  • get rows(): Element[]
  • Returns all direct rows in the table, either as direct children of <table> or within one of the table sections <thead>, <tbody>, or <tfoot>.

    In contrast to HTMLTableElement.rows the result is static.

    Returns Element[]

  • get tBodies(): (Element | HTMLTableSectionElement)[]
  • Returns all <tbody> elements, which are available as snapshot. Note, that while in HTML a table may have multiple <tbody> elements, CoreMedia RichText 1.0 may have only one element.

    Returns (Element | HTMLTableSectionElement)[]

Methods

  • Merges all sections in table into one <tbody> element. Note, that this removes any <thead> and <tfoot> sections. For processing such as in CKEditor 5 data-processing you may want to mark corresponding rows before, that they originally belonged to <thead> or <tfoot> like applying a reserved class.

    Returns void

  • Moves all rows containing a given class name to <tfoot> section.

    Parameters

    • className: string

      class name to select row elements to move

    • remove: boolean = true

      if to remove the denoting class name from class list

    Returns void

  • Moves all rows containing a given class name to <thead> section.

    Parameters

    • className: string

      class name to select row elements to move

    • remove: boolean = true

      if to remove the denoting class name from class list

    Returns void

  • Retrieve all direct children and direct children of all sections that match the given selectors.

    Parameters

    • selectors: string

      selectors to match

    Returns Element[]