toast-ui.vue-editor
This is Vue component wrapping TOAST UI Editor.
Collect statistics on the use of open source
Vue Wrapper of TOAST UI Editor applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Editor is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following usageStatistics
options when declare Vue Wrapper compoent.
Or, include include tui-code-snippet.js
(v1.4.0 or later) and then immediately write the options as follows:
? Install
Using npm
? Usage
If you want to more details, see Tutorials ?
Load
You can use Toast UI Editor for Vue as moudule format or namespace. Also you can use Single File Component (SFC of Vue). When using module format and SFC, you should load tui-editor.css
, tui-editor-contents.css
and codemirror.css
in the script.
-
Using Ecmascript module
-
Using Commonjs module
-
Using Single File Component
-
Using namespace
Implement
First implement <editor/>
in the template.
And then add Editor
to the components
in your component or Vue instance like this:
or
Using v-model
If you use v-model, you have to declare a data
for binding.
In the example below, editorText
is binding to the text of the editor.
Props
Name | Type | Default | Description |
---|---|---|---|
value | String | '' | This prop can change content of the editor. If you using v-model , don't use it. |
options | Object | following defaultOptions |
Options of tui.editor. This is for initailize tui.editor. |
height | String | '300px' | This prop can control the height of the editor. |
previewStyle | String | 'tab' | This prop can change preview style of the editor. (tab or vertical ) |
mode | String | 'markdown' | This prop can change mode of the editor. (markdown or wysiwyg ) |
html | String | - | If you want change content of the editor using html format, use this prop. |
visible | Boolean | true | This prop can control visible of the eiditor. |
Event
- load : It would be emitted when editor fully load
- change : It would be emitted when content changed
- stateChange : It would be emitted when format change by cursor position
- focus : It would be emitted when editor get focus
- blur : It would be emitted when editor loose focus
Method
If you want to more manipulate the Editor, you can use invoke
method to call the method of tui.editor. For more information of method, see method of tui.editor.
First, you need to assign ref
attribute of <editor/>
and then you can use invoke
method through this.$refs
like this:
? Pull Request Steps
TOAST UI products are open source, so you can create a pull request(PR) after you fix issues.
Run npm scripts and develop yourself with the following process.
Setup
Fork develop
branch into your personal repository.
Clone it to local computer. Install node modules.
Before starting development, you should check to haveany errors.