Extends
- Backbone.View
Members
className :string
The HTML classes to use for this view's element
Type:
- string
events :Object
The events this view will listen to and the associated function to call.
Type:
- Object
markdownPlaceholder :string
The placeholder text to display in the textarea when it's empty
Type:
- string
model :EMLText
EMLText model that contains a markdown attribute to edit. The markdown is
inserted into the textarea when the view is first rendered. If there's no markdown,
then the view looks for markdown from the markdownExample attribute in the model.
Note that if there are multiple markdown strings in the model, only the first
is rendered/edited.
Type:
previewPlaceholder :string
The placeholder text to display in the preview area when there's no
markdown
Type:
- string
showTOC :boolean
Indicates whether or not to render a table of contents for the markdown
preview. If set to true, a table of contents will be shown in the preview
if there two or more top-level headers are rendered from the markdown.
Type:
- boolean
template :Underscore.Template
References to templates for this view. HTML files are converted to
Underscore.js templates
Type:
- Underscore.Template
textarea :string
A jQuery selector for the HTML textarea element that will contain the
markdown text.
Type:
- string
type :string
The type of View this is
Type:
- string
Methods
addDivider(e, mode, chunks)
addDivider - Add or remove a divider
Parameters:
Name | Type | Description |
---|---|---|
e |
event | is the original event object |
mode |
string | can be markdown, html, or wysiwyg |
chunks |
object | is a chunks object, describing the current state of the editor, see https://github.com/bevacqua/woofmark#chunks |
addHeader(e, mode, chunks, id)
addHeader - description
Parameters:
Name | Type | Description |
---|---|---|
e |
event | is the original event object |
mode |
string | can be markdown, html, or wysiwyg |
chunks |
object | is a chunks object, describing the current state of the editor, see https://github.com/bevacqua/woofmark#chunks |
id |
string | the ID of the function, set as they key in buttonOptions in the render function |
addMdImage()
addMdImage - The function that gets called when a user clicks the custom
add image button added to the markdown editor. It uses the UI created by
the ImageUploaderView to allow a user to select & upload an image to the
repository, and uses Woofmark's built-in add image functionality to
insert the correct markdown into the textarea. This function must be
called such that "this" is the markdownEditor view.
addTable(e, mode, chunks)
addTable - Creates the UI for editing and adding tables to the textarea.
Detects whether the selection contained any part of a markdown table,
then opens a woofmark dialog box and inserts a table editor view. If a
table was selected, the table information is imported into the table
editor where the user can edit it. If no table was selected, then it
creates an empty table where the user can add data.
Parameters:
Name | Type | Description |
---|---|---|
e |
event | is the original event object |
mode |
string | can be markdown, html, or wysiwyg |
chunks |
object | is a chunks object, describing the current state of the editor, see https://github.com/bevacqua/woofmark#chunks |
initialize(options)
Initialize is executed when a new markdownEditor is created.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | A literal object with options to pass to the view |
previewMarkdown()
previewMarkdown - render the markdown preview.
render()
render - Renders the markdownEditor - add UI for adding and editing
markdown to a textarea
strikethrough(e, mode, chunks)
strikethrough - Add or remove the markdown syntax for strike through to
the textarea. If there is text selected, then strike through formatting
will be added or removed from that selection. If no selection,
some placeholder text will be added surrounded by the strikethrough
delimiters.
Parameters:
Name | Type | Description |
---|---|---|
e |
event | is the original event object |
mode |
string | can be markdown, html, or wysiwyg |
chunks |
object | is a chunks object, describing the current state of the editor, see https://github.com/bevacqua/woofmark#chunks |
updateMarkdown()
updateMarkdown - Update the markdown attribute in this view using the
value of the markdown textarea