Skip to content

Commit

Permalink
docs: replaceWithListSection and replaceWithHeaderSection
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Aug 3, 2016
1 parent 04ea594 commit 2b65ad5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/js/editor/text-input-handlers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import Range from 'mobiledoc-kit/utils/cursor/range';

/**
* Convert section at the editor's cursor position into a list.
* Does nothing if the cursor position is not at the start of the section,
* or if the section is already a list item.
*
* @param {Editor} editor
* @param {String} listTagName ("ul" or "ol")
* @public
*/
export function replaceWithListSection(editor, listTagName) {
let { range: { head, head: { section } } } = editor;
// Skip if cursor is not at end of section
Expand All @@ -21,6 +30,14 @@ export function replaceWithListSection(editor, listTagName) {
});
}

/**
* Convert section at the editor's cursor position into a header section.
* Does nothing if the cursor position is not at the start of the section.
*
* @param {Editor} editor
* @param {String} headingTagName ("h1","h2","h3")
* @public
*/
export function replaceWithHeaderSection(editor, headingTagName) {
let { range: { head, head: { section } } } = editor;
// Skip if cursor is not at end of section
Expand Down

0 comments on commit 2b65ad5

Please sign in to comment.