Class: MarkdownEditorView

MarkdownEditorView()

A view of an HTML textarea with markdown editor UI and preview tab

Constructor

new MarkdownEditorView()

Source:

Extends

  • Backbone.View

Members

className :string

The HTML classes to use for this view's element
Type:
  • string
Source:

events :Object

The events this view will listen to and the associated function to call.
Type:
  • Object
Source:

markdownPlaceholder :string

The placeholder text to display in the textarea when it's empty
Type:
  • string
Source:

maxImageHeight :number

The maximum height for uploaded image files. If a file is taller than this, it will be resized without warning before being uploaded. If set to null, the image won't be resized based on height (but might be depending on maxImageWidth).
Type:
  • number
Since:
  • 2.15.0
Default Value:
  • 1200
Source:

maxImageWidth :number

The maximum width for uploaded image files. If a file is wider than this, it will be resized without warning before being uploaded. If set to null, the image won't be resized based on width (but might be depending on maxImageHeight).
Type:
  • number
Since:
  • 2.15.0
Default Value:
  • 1200
Source:

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:
Source:

previewPlaceholder :string

The placeholder text to display in the preview area when there's no markdown
Type:
  • string
Source:

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
Source:

template :Underscore.Template

References to templates for this view. HTML files are converted to Underscore.js templates
Type:
  • Underscore.Template
Source:

textarea :string

A jQuery selector for the HTML textarea element that will contain the markdown text.
Type:
  • string
Source:

type :string

The type of View this is
Type:
  • string
Source:

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
Source:

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
Source:

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.
Source:

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
Source:

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
Source:

previewMarkdown()

previewMarkdown - render the markdown preview.
Source:

render()

render - Renders the markdownEditor - add UI for adding and editing markdown to a textarea
Source:

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
Source:

updateMarkdown()

updateMarkdown - Update the markdown attribute in this view using the value of the markdown textarea
Source: