nhn / toast-ui.vue-image-editor

Toast UI Image Editor for Vue
MIT License
186 stars 41 forks source link
image-editor vue

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

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

From now on, please submit issues or contributing related to TOAST UI Vue Wrapper to TOAST UI ImageEditor repository. Thank you🙂.

Vue wrapper for TOAST UI Image Editor

This is Vue component wrapping TOAST UI Image 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

TOAST UI ImageEditor applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI ImageEditor 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 option when creating the instance.

const options = {
    ...
    usageStatistics: false
}

const imageEditor = new tui.ImageEditor('#tui-image-editor-container', options);

Or, include tui-code-snippet(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-image-editor

If you install other packages, you may lose dependency on fabric. You need to reinstall the fabric.

npm install --no-save --no-optional fabric@~1.6.7

🔡 Usage

Load

Implement

First insert <tui-image-editor> in the template or html. includeUi and options props are required.

<tui-image-editor :include-ui="useDefaultUI" :options="options"></tui-image-editor>

Load ImageEditor component and then add it to the components in your component or Vue instance.

import {ImageEditor} from '@toast-ui/vue-image-editor';

export default {
    components: {
        'tui-image-editor': ImageEditor
    },
    data() {
        return {
            useDefaultUI: true,
            options: { // for tui-image-editor component's "options" prop
                cssMaxWidth: 700,
                cssMaxHeight: 500
            }
        };
    }
}

Props

You can use includeUi and options props. Example of each props is in the Getting Started.

Event

<tui-image-editor ...
                  @addText="onAddText"
                  @objectMoved="onObjectMoved">
</tui-image-editor>
...
methods: {
    onAddText(pos) {
        ...
    },
    onObjectMoved(props) {
        ...
    }
}
...

For more information such as the parameters of each event, see event of tui.image-editor.

Method

For use method, first you need to assign ref attribute of element like this:

<tui-image-editor ref="tuiImageEditor" :options="options"></tui-image-editor>

After then you can use methods through this.$refs. We provide getRootElement and invoke methods.

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

📙 Documents

💬 Contributing

📜 License

This software is licensed under the MIT © NHN.