CommentSource

CommentSource

Class that keeps the methods and data related to the 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 section source code 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'
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).

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