Multiline editting behavior that is optimized to handle relatively large (thousands of lines) texts.
that have this behavior applied by default:
<plaintext>...</plaintext>
display:block editor;that this behavior knows about:
readonly
- declares that element is read only.spellcheck
- boolean, "true" | "false", enable/disable spell checking.Plaintext parses each line of text into separate <text> element:
<plaintext> <text>Line 1</text> <text>Line 2</text> <text>Line 3</text> </plaintext>
Together with the standard set of events (mouse, keyboard, focus) behavior: button generates:
string, reflects current status of internal editing buffer.
dir
attribute these key combinations switches between dir="ltr"
and dir="rtl"
.Commands supported by the behavior through Element.execCommand()
and Element.queryMethods()
:
"edit:cut"
- cut selection - copy selection to the clipboard and remove it;"edit:copy"
- copy selection to the clipboard;"edit:paste"
- paste content of the clipboard;"edit:selectall"
- select whole content of the element;"edit:undo"
- undo last editing operation;"edit:redo"
- redo last operation that was undone;"edit:delete-next"
- if there is a selection - delete selected content, otherwise delete next character;"edit:delete-prev"
- if there is a selection - delete selected content, otherwise delete previous character;"edit:delete-word-next"
- if there is a selection - delete selected content, otherwise delete next word;"edit:delete-word-prev"
- if there is a selection - delete selected content, otherwise delete previous word;"edit:insert-break"
- inserts line break;"edit:insert-text"
- inserts text at current position: element.execCommand("edit:insert-text", text);
"navigate:backward"
"navigate:word-start
"navigate:forward"
"navigate:word-end
"navigate:up"
"navigate:down"
"navigate:line-start"
"navigate:line-end"
"navigate:start
"navigate:end"
Note: API of plaintext is accessible on element by using .plaintext. interface modifier:
const editor = $(plaintext#editor); editor.plaintext.load("file://users/documents/readme.txt");
plaintext[index:integer]
var firstLine = el.plaintext[0];
for(var line in el.plaintext)
plaintext.content
plaintext.lines
plaintext.selectionStart
plaintext.selectionEnd
plaintext.selectionText
plaintext.load
(url:string): true|false
loads file from URL into the editor;
plaintext.save
(url:string): true|false
saves content to file defined by the file url;
plaintext.selectRange
(startLine:integer, startPosition:integer, endLine:integer, endPosition:integer)
selects text range;
plaintext.appendLine
(text:string | lines: array): true|false
appends line at the end of the text;
plaintext.insertLine
(at: integer, text:string | lines: array): true|false
inserts line at position n;
plaintext.removeLine
(at : integer [, count: integer) : true|false
removes line[s] at position;