All Projects → nhn → Toast Ui.vue Editor

nhn / Toast Ui.vue Editor

Licence: mit
This repository is DEPRECATED! GO TO 👉 https://github.com/nhn/tui.editor/tree/master/apps/vue-editor

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Toast Ui.vue Editor

Lumixengine
3D C++ Game Engine - yet another open source game engine
Stars: ✭ 2,604 (+1008.09%)
Mutual labels:  editor
Obsidian
WAD file editor for League of Legends
Stars: ✭ 218 (-7.23%)
Mutual labels:  editor
Theia
Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
Stars: ✭ 15,920 (+6674.47%)
Mutual labels:  editor
Vue Neditor Wrap
基于vue和neditor的双向绑定组件,使用vue-cli3的项目可以直接使用
Stars: ✭ 216 (-8.09%)
Mutual labels:  editor
Bowpad
A simple and fast text editor with a ribbon UI
Stars: ✭ 217 (-7.66%)
Mutual labels:  editor
Json Editor
JSON Schema Based Editor
Stars: ✭ 2,909 (+1137.87%)
Mutual labels:  editor
Ox
An independent Rust text editor that runs in your terminal!
Stars: ✭ 2,634 (+1020.85%)
Mutual labels:  editor
Composer
Visual and code editor for Common Workflow Language
Stars: ✭ 232 (-1.28%)
Mutual labels:  editor
Procedural Worlds Editor
Procedural World Editor is a node based procedural terrain generator
Stars: ✭ 218 (-7.23%)
Mutual labels:  editor
Id
🆔 The easy-to-use OpenStreetMap editor in JavaScript.
Stars: ✭ 2,667 (+1034.89%)
Mutual labels:  editor
Vue Tinymce Editor
This a component provides use of tinymce for vue developers
Stars: ✭ 216 (-8.09%)
Mutual labels:  editor
Editor
Source code editor in pure Go.
Stars: ✭ 214 (-8.94%)
Mutual labels:  editor
Docker Emacs
Dockerized Emacs (GUI)
Stars: ✭ 224 (-4.68%)
Mutual labels:  editor
Miikun
Simple Markdown Editor using Electron.
Stars: ✭ 215 (-8.51%)
Mutual labels:  editor
Piper
A drag-and-drop mobile website builder base on Vue
Stars: ✭ 228 (-2.98%)
Mutual labels:  editor
React Json Editor Ajrm
A modular, easy to use, react component, to view, edit, and debug javascript objects.
Stars: ✭ 211 (-10.21%)
Mutual labels:  editor
Edi
Edi - The open source text editor IDE based on AvalonDock and AvalonEdit
Stars: ✭ 220 (-6.38%)
Mutual labels:  editor
Kkfileviewofficeedit
文件在线预览及OFFICE(word,excel,ppt)的在线编辑
Stars: ✭ 234 (-0.43%)
Mutual labels:  editor
Graph Studio Next
GraphStudioNext is a tool for developers to build and test DirectShow Graphs
Stars: ✭ 231 (-1.7%)
Mutual labels:  editor
Pythonbuddy
Online Python Editor With Live Syntax Checking and Execution
Stars: ✭ 223 (-5.11%)
Mutual labels:  editor

⚠️Notice: This repository is deprecated️️️️️

TOAST UI Editor Vue Wrapper has been managed separately from the TOAST UI Editor repository. As a result of the distribution of these issues, we decided to deprecated each wrapper repository and manage repository as a mono-repo from the TOAST UI Editor repository.

From now on, please submit issues or contributings related to TOAST UI React Wrapper to TOAST UI Editor repository. Thank you🙂.

TOAST UI Editor for Vue

This is Vue component wrapping TOAST UI Editor.

vue2 github version npm version license PRs welcome code with hearth by NHN

🚩 Table of Contents

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.

var options = {
    ...
    usageStatistics: false
}

Or, include include tui-code-snippet.js (v1.4.0 or later) and then immediately write the options as follows:

tui.usageStatistics = false;

💾 Install

Using npm

npm install --save @toast-ui/vue-editor

📝 Editor Usage

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

    import 'tui-editor/dist/tui-editor.css';
    import 'tui-editor/dist/tui-editor-contents.css';
    import 'codemirror/lib/codemirror.css';
    import { Editor } from '@toast-ui/vue-editor'
    
  • Using Commonjs module

    require('tui-editor/dist/tui-editor.css');
    require('tui-editor/dist/tui-editor-contents.css');
    require('codemirror/lib/codemirror.css');
    var toastui = require('@toast-ui/vue-editor');
    var Editor = toastui.Editor;
    
  • Using Single File Component

    import 'tui-editor/dist/tui-editor.css';
    import 'tui-editor/dist/tui-editor-contents.css';
    import 'codemirror/lib/codemirror.css';
    import Editor from '@toast-ui/vue-editor/src/Editor.vue'
    
  • Using namespace

    var Editor = toastui.Editor;
    

Implement

First implement <editor/> in the template.

<template>
    <editor/>
</template>

And then add Editor to the components in your component or Vue instance like this:

import { Editor } from '@toast-ui/vue-editor'

export default {
  components: {
    'editor': Editor
  }
}

or

import { Editor } from '@toast-ui/vue-editor'
new Vue({
    el: '#app',
    components: {
        'editor': Editor
    }
});

Using v-model

If you use v-model, you have to declare a data for binding. (❗️ When using the editor in wysiwyg mode, v-model can cause performance degradation.)

In the example below, editorText is binding to the text of the editor.

<template>
    <editor v-model="editorText"/>
</template>
<script>
import { Editor } from '@toast-ui/vue-editor'

export default {
  components: {
    'editor': Editor
  },
  data() {
      return {
          editorText: ''
      }
  }
}
</script>

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. (markdownor wysiwyg)
html String - If you want to change content of the editor using html format, use this prop.
visible Boolean true This prop can control visible of the eiditor.
const defaultOptions = {
    minHeight: '200px',
    language: 'en_US',
    useCommandShortcut: true,
    useDefaultHTMLSanitizer: true,
    usageStatistics: true,
    hideModeSwitch: false,
    toolbarItems: [
        'heading',
        'bold',
        'italic',
        'strike',
        'divider',
        'hr',
        'quote',
        'divider',
        'ul',
        'ol',
        'task',
        'indent',
        'outdent',
        'divider',
        'table',
        'image',
        'link',
        'divider',
        'code',
        'codeblock'
    ]
};

Example :

<template>
    <editor
    :value="editorText"
    :options="editorOptions"
    :html="editorHtml"
    :visible="editorVisible"
    previewStyle="vertical"
    height="500px"
    mode="wysiwyg"
    />
</template>
<script>
import { Editor } from '@toast-ui/vue-editor'

export default {
    components: {
        'editor': Editor
    },
    data() {
        return {
            editorText: 'This is initialValue.',
            editorOptions: {
                hideModeSwitch: true
            },
            editorHtml: '',
            editorVisible: true
        };
    },
};
</script>

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

Example :

<template>
    <editor
    @load="onEditorLoad"
    @focus="onEditorFocus"
    @blur="onEditorBlur"
    @change="onEditorChange"
    @stateChange="onEditorStateChange"
    />
</template>
<script>
import { Editor } from '@toast-ui/vue-editor'

export default {
    components: {
        'editor': Editor
    },
    methods: {
        onEditorLoad() {
            // implement your code
        },
        onEditorFocus() {
            // implement your code
        },
        onEditorBlur() {
            // implement your code
        },
        onEditorChange() {
            // implement your code
        },
        onEditorStateChange() {
            // implement your code
        },
    }
};
</script>

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:

<template>
    <editor ref="tuiEditor"/>
</template>
<script>
import { Editor } from '@toast-ui/vue-editor'

export default {
    components: {
        'editor': Editor
    },
    methods: {
        scroll() {
            this.$refs.tuiEditor.invoke('scrollTop', 10);
        },
        moveTop() {
            this.$refs.tuiEditor.invoke('moveCursorToStart');
        },
        getHtml() {
            let html = this.$refs.tuiEditor.invoke('getHtml');
        }
    }
};
</script>

📃 Viewer Usage

Load

  • Using Ecmascript module

    import 'tui-editor/dist/tui-editor-contents.css';
    import 'highlight.js/styles/github.css';
    import { Viewer } from '@toast-ui/vue-editor'
    
  • Using Commonjs module

    require('tui-editor/dist/tui-editor-contents.css');
    require('highlight.js/styles/github.css'); 
    var toastui = require('@toast-ui/vue-editor');
    var Viewer = toastui.Viewer;
    
  • Using Single File Component

    import 'tui-editor/dist/tui-editor-contents.css';
    import 'highlight.js/styles/github.css';
    import Viewer from '@toast-ui/vue-editor/src/Viewer.vue'
    
  • Using namespace

    var Viewer = toastui.Viewer;
    

Implement

First implement <viewer/> in the template.

<template>
    <viewer/>
</template>

And then add Viewer to the components in your component or Vue instance like this:

import { Viewer } from '@toast-ui/vue-editor'

export default {
  components: {
    'viewer': Viewer
  }
}

or

import { Viewer } from '@toast-ui/vue-editor'
new Vue({
    el: '#app',
    components: {
        'viewer': Viewer
    }
});

Props

Name Type Default Description
value String '' This prop can change content of the viewer.
height String '300px' This prop can control the height of the viewer.
exts Array This prop can apply the extensions of the viewer.

Example :

<template>
    <viewer
    :value="viewerText"
    height="500px"
    />
</template>
<script>
import { Viewer } from '@toast-ui/vue-editor'

export default {
    components: {
        'viewer': Viewer
    },
    data() {
        return {
            viewerText: '# This is Viewer.\n Hello World.',
        };
    },
};
</script>

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

Example :

<template>
    <viewer
    @load="onEditorLoad"
    @focus="onEditorFocus"
    @blur="onEditorBlur"
    @change="onEditorChange"
    @stateChange="onEditorStateChange"
    />
</template>

<script>
import { Viewer } from '@toast-ui/vue-editor'

export default {
    components: {
        'viewer': Viewer
    },
    methods: {
        onEditorLoad() {
            // implement your code
        },
        onEditorFocus() {
            // implement your code
        },
        onEditorBlur() {
            // implement your code
        },
        onEditorChange() {
            // implement your code
        },
        onEditorStateChange() {
            // implement your code
        },
    }
};

🔧 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.

$ git clone https://github.com/{your-personal-repo}/[[repo name]].git
$ cd [[repo name]]
$ npm install

Develop

Let's start development!

Pull Request

Before PR, check to test lastly and then check any errors. If it has no error, commit and then push it!

For more information on PR's step, please see links of Contributing section.

💬 Contributing

📜 License

This software is licensed under the MIT © NHN.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].