npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wizteam/vue-image-editor

v3.15.2

Published

TOAST UI Image-Editor for Vue

Downloads

3

Readme

Vue wrapper for TOAST UI Image Editor

This is a Vue component wrapping TOAST UI Image Editor.

npm version

🚩 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@~4.2.0
```

🔡 Usage

Load

  • Using namespace

    const ImageEditor = toastui.ImageEditor;
  • Using module

    // es modules
    import { ImageEditor } from '@toast-ui/vue-image-editor';
    
    // commonjs require
    const { ImageEditor } = require('@toast-ui/vue-image-editor');
  • Using <script>

    If you just add javascript file to your html, you use toastui-vue-image-editor.js downloaded. Insert toastui-vue-image-editor.js with vue in your html like this:

    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="path/to/toastui-vue-image-editor.js"></script>
  • Using only Vue wrapper component (Single File Component)

    toastui-vue-image-editor.js has all of the tui.ImageEditor. If you only need vue wrapper component, you can use @toast-ui/vue-image-editor/src/ImageEditor.vue like this:

    import ImageEditor from '@toast-ui/vue-image-editor/src/ImageEditor.vue';

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 'tui-color-picker/dist/tui-color-picker.css';
import 'tui-image-editor/dist/tui-image-editor.css';
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.

  • includeUi

    | Type | Required | Default | | ------- | -------- | ------- | | Boolean | X | true |

    This prop can contained the includeUI prop in the option. You can see the default UI.

  • options

    | Type | Required | Default | | ------ | -------- | --------------------------------------- | | Object | X | { cssMaxWidth: 700, cssMaxHeight: 500 } |

    You can configure your image editor using options prop. For more information which properties can be set in options, see options of tui.image-editor.

Events

  • addText: The event when 'TEXT' drawing mode is enabled and click non-object area.
  • mousedown: The mouse down event with position x, y on canvas
  • objectActivated: The event when object is selected(aka activated).
  • objectMoved: The event when object is moved.
  • objectScaled: The event when scale factor is changed.
  • redoStackChanged: Redo stack changed event
  • textEditing: The event which starts to edit text object.
  • undoStackChanged: Undo stack changed 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.

  • getRootElement

    You can get root element of image editor using this method.

    this.$refs.tuiImageEditor.getRootElement();
  • invoke

    If you want to more manipulate the ImageEditor, you can use invoke method to call the method of tui.ImageEditor. First argument of invoke is name of the method and second argument is parameters of the method. To find out what kind of methods are available, see method of tui.ImageEditor.

    const drawingMode = this.$refs.tuiImageEditor.invoke('getDrawingMode');
    
    this.$refs.tuiImageEditor.invoke('loadImageFromURL', './sampleImage.png', 'My sample image');
    
    this.$refs.tuiImageEditor.invoke('startDrawingMode', 'FREE_DRAWING', {
      width: 10,
      color: 'rgba(255, 0, 0, 0.5)',
    });