Methods
setOptions(options)
Add or reset option property.
Name | Type | Description |
---|---|---|
options |
Object | Options |
noticeOpen(message)
Open a notice area.
Name | Type | Description |
---|---|---|
message |
String | Notice message |
noticeClose()
Close a notice area.
save()
Copying the contents of the editor to the original textarea
getContext() → {Object}
Gets the kothing-editor's context object. Contains settings, plugins, and
cached element objects.
getContents() → {String}
Gets the contents of the kothing-editor
getImagesInfo() → {Array}
Gets uploaded images informations
insertImage(files)
Upload images using image plugin
Parameters:
Name | Type | Description |
---|---|---|
files |
FileList | FileList |
insertHTML(html)
Inserts an HTML element or HTML string or plain string at the
current cursor position
Parameters:
Name | Type | Description |
---|---|---|
html |
Element|String | HTML Element or HTML string or plain string |
setContents(contents)
Change the contents of the kothing-editor
Parameters:
Name | Type | Description |
---|---|---|
contents |
String | Contents to Input |
appendContents(contents)
Add contents to the kothing-editor
Parameters:
Name | Type | Description |
---|---|---|
contents |
String | Contents to Input |
disabled()
Disable the kothing-editor
enabled()
Enabled the kothing-editor
show()
Show the kothing-editor
hide()
Hide the kothing-editor
destroy()
Destroy the kothing-editor
Events
It can be redefined by receiving event object as parameter. It is
not called in exceptional cases and is called after the default
event function has finished.
onScroll(event)
Scroll event
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
onClick(event)
Click event
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
onKeyDown(event)
KeyDown event
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
onKeyUp(event)
KeyUp event
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
onDrop(event)
Drop event
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
onChange(contents)
When the contents change
Name | Type | Description |
---|---|---|
contents |
String | HTML string |
onPaste(event, cleanData, maxCharCount)
Paste event.
Called before the editor's default event action.
If it returns false, it stops without executing the rest of the action.
Called before the editor's default event action.
If it returns false, it stops without executing the rest of the action.
Name | Type | Description |
---|---|---|
event |
Object | Event Object |
cleanData |
String | HTML string modified for editor format |
maxCharCount |
Boolean | maxCharCount option (true if max character is exceeded) |
onImageUpload(targetImgElement, index, state, imageInfo, remainingFilesCount)
Called when the image is uploaded or the uploaded image is deleted
Name | Type | Description |
---|---|---|
targetImgElement |
Element | Current img element |
index |
Number | Uploaded index (key value) |
state |
String | Upload status ('create', 'update', 'delete') |
imageInfo |
Object |
src: imgage src index: data index name: file name size: file size select: select function delete: delete function |
remainingFilesCount |
Number | Count of remaining image files |
onImageUploadError(errorMessage, result)
Called when the image is uploaded or the uploaded image is deleted
Name | Type | Description |
---|---|---|
errorMessage |
String | Error message to show |
result |
Object | Result object |
showInline(toolbar, context)
Paste event.
Called before the editor's default event action.
If it returns false, it stops without executing the rest of the action.
Called before the editor's default event action.
If it returns false, it stops without executing the rest of the action.
Name | Type | Description |
---|---|---|
toolbar |
Element | Toolbar Element |
context |
Object | The editor's context object |