Skip to content

Commit 2b65ad5

Browse files
committed
docs: replaceWithListSection and replaceWithHeaderSection
1 parent 04ea594 commit 2b65ad5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/js/editor/text-input-handlers.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import Range from 'mobiledoc-kit/utils/cursor/range';
22

3+
/**
4+
* Convert section at the editor's cursor position into a list.
5+
* Does nothing if the cursor position is not at the start of the section,
6+
* or if the section is already a list item.
7+
*
8+
* @param {Editor} editor
9+
* @param {String} listTagName ("ul" or "ol")
10+
* @public
11+
*/
312
export function replaceWithListSection(editor, listTagName) {
413
let { range: { head, head: { section } } } = editor;
514
// Skip if cursor is not at end of section
@@ -21,6 +30,14 @@ export function replaceWithListSection(editor, listTagName) {
2130
});
2231
}
2332

33+
/**
34+
* Convert section at the editor's cursor position into a header section.
35+
* Does nothing if the cursor position is not at the start of the section.
36+
*
37+
* @param {Editor} editor
38+
* @param {String} headingTagName ("h1","h2","h3")
39+
* @public
40+
*/
2441
export function replaceWithHeaderSection(editor, headingTagName) {
2542
let { range: { head, head: { section } } } = editor;
2643
// Skip if cursor is not at end of section

0 commit comments

Comments
 (0)