The CustomiseItem component performs the majority of the work involved in editing individual GitHub markdown files. An item in this component makes available various detailed views depending upon what is relevant for that item.
Items that are already part of the main repository and are well-specified allow editing of YAML headers (if applicable) using a form and body content using a markdown editor. Files that are not well-specified allow editing of the raw file content. Items that have been modified in this way make available an option to push the changes to GitHub.
Items from other repositories are made available to install into the main repository. They also offer the opportunity to view the YAML headers and body content side-by-side.
Items assigned to a day in the scheduler allow removing the item back to the stash, and stashed items allow removing the item from the stash entirely. Stashed items that belong to the main repository can be deleted (rather than simply dropped).
All items include a link to where their content can be viewed in the rendered website.
Props
Name | Type | Default value | Required? | Description |
---|---|---|---|---|
item |
File | - | Yes | The markdown file object being customised. |
overrideName |
String | - | No | A name to use instead of the item's YAML name field. |
overrideLink |
String | - | No | A link to use instead of the item's episode-adjusted path. |
noYAML |
Boolean | false |
No | Whether the item is missing YAML information. |
addButtons |
Array.<String> | [] |
No | Names of buttons to add to the item, overriding the default presence/absence determination for those buttons. |
removeButtons |
Array.<String> | [] |
No | Names of buttons not to add to the item, overriding the default presence/absence determination for those buttons. |
start |
Array.<Number> | - | No | The start time of the item, as an array of [minutes, hours], each of which is a number. |
end |
Array.<Number> | - | No | The end time of the item, as an array of [minutes, hours], each of which is a number. |
Data
Name | Type | Default value | Description |
---|---|---|---|
isViewing |
Boolean | false |
Whether the user is viewing the details of the item. Updates store.editingItem via watcher. |
isEditing |
Boolean | false |
Whether the user is editing the details of the item. Updates store.editingItem via watcher. |
isEditingContent |
Boolean | false |
Whether the user is editing the content of the item. Updates store.editingItem via watcher. |
isEditingRawContent |
Boolean | false |
Whether the user is editing the raw content of the item. Updates store.editingItem via watcher. |
currentContent |
String | "" |
The current content of the item. |
currentRawContent |
String | "" |
The current raw content of the item. |
iconSize |
String | 'is-small' |
Buefy size class for the icons. |
toolbars |
Object | Object |
mavon-editor toolbar specification. |
Computed
Name | Type | Description |
---|---|---|
mainRepo |
Repository|null | The main repository being edited. |
template |
String | The template of the main repository. |
content |
String | The content of the item as held in the store. |
rawContent |
String | The raw content of the item as held in the store. |
Fields |
Array.<Field> | The YAML fields in the item's content. |
Events
Name | Payload Type | Description |
---|---|---|
refresh |
Emit a request to refresh the item's content from the store. |
Requires
- module:mavon-editor
Methods
-
editContent()
-
Start editing the item's content.
-
editRawContent()
-
Start editing the item's raw content.
-
getPagesLink(item) → {String}
-
Convert an item's link into a link to the item's page when rendered with GitHub pages.
Parameters:
Name Type Description item
File The item whose link is required. Returns:
String -
getRelativeLink(item, link) → {String}
-
Generate a link from the item's GitHub Pages instance to a specified extension.
Parameters:
Name Type Description item
File The item whose link is required. link
String Extra pathing to append to the end of the generated pages link. Returns:
String -
imgAdd(pos, img)
-
Upload an image in the maven-editor and store it for including in a markdown file.
Parameters:
Name Type Description pos
Number The index of the image. img
Object The image to store. -
install() → {Promise.<BNoticeComponent>}
-
Install a remote item into the current main repository. Issues a Buefy toast on completion.
Returns:
Promise.<BNoticeComponent> -
installMissingDependencies() → {Promise.<BNoticeComponent>}
-
Iterate through the dependencies for an item and attempt to install the missing ones from the original non-main repository. Issues a Buefy toast on completion.
Returns:
Promise.<BNoticeComponent> -
pad(x) → {string}
-
Pad a number to two digits with leading zero.
Parameters:
Name Type Description x
Number Returns:
string -
save() → {Promise.<void>}
-
Save the current version of an item.
Returns:
Promise.<void>