Skip to content

actions.ts

github-actions[bot] edited this page Nov 19, 2023 · 1 revision

Functions

reset()void

Resets all fields in the input form to their default values and clears any outputs.

copyCode(input, wikiCodeId)

Copies the code from the specified input element to the clipboard.

downloadFile(button)void

Downloads a file with the name of the current page and content of globalElements.output.fullArticle.

createPage(element, [pagename])void

Disables pointer events on the given element, gets the name of the page, creates a wiki link, and assigns the link to the element.

assignLink(element, link)undefined

Assigns the given link to the provided element. Before assigning, checks if dataIntegrity is valid. If dataIntegrity is invalid, disables element and displays an error message. Otherwise, assigns the link to element and opens it in a new tab.

toggleRedirect()

Toggles the display of copy and create redirect buttons.

reset() ⇒ void

Resets all fields in the input form to their default values and clears any outputs.

Kind: global function

copyCode(input, wikiCodeId)

Copies the code from the specified input element to the clipboard.

Kind: global function

Param Type Description
input HTMLElement

The input element containing the code to be copied.

wikiCodeId string

The ID of the wiki code container element.

downloadFile(button) ⇒ void

Downloads a file with the name of the current page and content of globalElements.output.fullArticle.

Kind: global function

Param Type Description
button HTMLAnchorElement

The anchor element that initiates the file download.

createPage(element, [pagename]) ⇒ void

Disables pointer events on the given element, gets the name of the page, creates a wiki link, and assigns the link to the element.

Kind: global function

Param Type Default Description
element HTMLElement

The element that the link should be assigned to.

[pagename] string "pageData.name"

The name of the new wiki page. Defaults to the name specified in the pageData object.

assignLink(element, link) ⇒ undefined

Assigns the given link to the provided element. Before assigning, checks if dataIntegrity is valid. If dataIntegrity is invalid, disables element and displays an error message. Otherwise, assigns the link to element and opens it in a new tab.

Kind: global function

Param Type Description
element Object

The HTML element to assign the link to.

link string

The link to assign to element.

Example

assignLink(myAnchorElement, 'https://www.example.com')

toggleRedirect()

Toggles the display of copy and create redirect buttons.

Kind: global function