commentFormRegistry

Singleton storing data about comment forms on the page and managing them.

Source:

Methods

(static) adjustLabels()

Source:

Adjust the button labels of all comment forms according to the form width: if the form is too narrow, the labels will shrink.

(static) detach()

Source:

Detach the comment forms keeping events. Also reset some of their properties.

(static) getAll() → {Array.<CommentForm>}

Source:

Get all comment forms.

Returns:
Type
Array.<CommentForm>

(static) getByIndex(index) → (nullable) {CommentForm}

Source:

Get a comment form by index.

Parameters:
Name Type Description
index number

Use a negative index to count from the end.

Returns:
Type
CommentForm

(static) getCount() → {number}

Source:

Get the number of comment forms.

Returns:
Type
number

(static) getLastActive() → (nullable) {CommentForm}

Source:

Get the last active comment form.

Returns:
Type
CommentForm

(static) getLastActiveAltered() → (nullable) {CommentForm}

Source:

Get the last active comment form that has received an input. This includes altering text fields, not checkboxes.

Returns:
Type
CommentForm

(static) init()

Source:

For internal use. Initialize the registry.

(static) query(condition) → {Array.<CommentForm>}

Source:

Get comment forms by a condition.

Parameters:
Name Type Description
condition function
Returns:
Type
Array.<CommentForm>

(static) remove(item)

Source:

Remove a comment form from the registry.

Parameters:
Name Type Description
item CommentForm

(static) saveSession(forceopt)

Source:

For internal use. Save comment form data to the local storage.

Parameters:
Name Type Attributes Default Description
force boolean <optional>
true

Save session immediately, without regard for save frequency.

(static) setupCommentForm(target, config, initialStateopt, commentFormopt) → {CommentForm}

Source:

Create a comment form and add it both to the registry and to the page. If it already exists, reattach it to the page.

Parameters:
Name Type Attributes Description
target Comment | Section | module:pageRegistry.Page
config object

See CommentForm's constructor.

initialState object <optional>

See CommentForm's constructor.

commentForm CommentForm <optional>
Fires:
Returns:
Type
CommentForm