Extends
Constructor
new ve.ui.MWWikitextAction(surface)
#
Methods
toggleWrapSelection(before, after, placeholder, [expandOffsetsCallback], [unwrapOffsetsCallback]) → {boolean}
#
Wrap an selection inline
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
before |
string | Text to go before selection |
|
after |
string | Text to go after selection |
|
placeholder |
function | string | Placeholder text to insert at an empty selection |
|
expandOffsetsCallback |
function |
optional |
Function that returns a tuple of offsets to expand to selection to in order to get relevant text for unwrapping |
unwrapOffsetsCallback |
function |
optional |
Function that returns a tuple of offsets to unwrap from the selected text, e.g. "''Foo'''" -> [2,3] to unwrap 2 from the left and 3 from the right |
Returns:
Action was executed
- Type
- boolean
wrapLine(before, after, placeholder, [unwrapOffsetsCallback]) → {boolean}
#
Wrap an selection as a block element on its own line
If the selection is collapsed, it expands to take the whole line, otherwise it splits the paragraph to make sure it is one line
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
before |
string | Text to go before each line |
|
after |
string | Text to go after each line |
|
placeholder |
function | string | Placeholder text to insert at an empty selection |
|
unwrapOffsetsCallback |
function |
optional |
Function that returns a tuple of offsets to unwrap from the selected text, e.g. '== Foo ===' -> [2,3] to unwrap 2 from the left and 3 from the right |
Returns:
Action was executed
- Type
- boolean
Wrap an selection as a block element on its own line
If the selection is collapsed, it expands to take the whole line, otherwise it splits the paragraph to make sure it is one line
wrapSelection(before, after, placeholder) → {boolean}
#
Wrap an selection inline
Parameters:
Name | Type | Description |
---|---|---|
before |
string | Text to go before selection |
after |
string | Text to go after selection |
placeholder |
function | string | Placeholder text to insert at an empty selection |
Returns:
Action was executed
- Type
- boolean