CommentSource

CommentSource

Class that keeps the methods and data related to a comment's source code. Also used for comment source match candidates before a single match is chosen among them.

Constructor

new CommentSource(comment, signature, contextCode, isInSectionContext)

Source:

Create a comment's source object.

Parameters:
Name Type Description
comment Comment

Comment.

signature object

Data about the source code of the signature.

contextCode string

Wikitext used as a reference point for the indexes.

isInSectionContext boolean

Is the source code of the section (not page) used.

Methods

modifyContext(options) → {object}

Source:

Modify the code of a whole section or page related to the comment in accordance with an action.

Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
action 'reply' | 'edit'
formAction 'submit' | 'viewChanged' | 'preview'
commentCode string <optional>

Comment code, including trailing newlines, indentation characters, and the signature.

doDelete boolean <optional>

Whether to delete the comment.

contextCode string <optional>

Code that has the comment. Usually not needed; provide it only if you need to perform operations on some code that is not the code of a section or page).

commentForm CommentForm <optional>

Comment form that has the code. Can be not set if commentCode is set or action is 'edit'.

Throws:
Returns:
Type
object

toInput() → {string}

Source:

Convert the comment's source code to code to set as a value of an input (practically, to the comment form's input).

Returns:
Type
string