Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
# Conflicts:
#	index.d.ts
  • Loading branch information
junghwan-park committed Mar 20, 2019
2 parents 516f647 + 3f370a0 commit 81c0b4d
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 54 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

## Wrappers
- [toast-ui.vue-image-editor](https://github.com/nhnent/toast-ui.vue-image-editor): Vue wrapper component is powered by [NHN Entertainment](https://github.com/nhnent).
- [toast-ui.react-image-editor](https://github.com/nhnent/toast-ui.react-image-editor): React wrapper component is powered by [NHN Entertainment](https://github.com/nhnent).

![6 -20-2018 17-45-54](https://user-images.githubusercontent.com/35218826/41647896-7b218ae0-74b2-11e8-90db-d7805cc23e8c.gif)

Expand Down Expand Up @@ -45,7 +46,7 @@ TOAST UI ImageEditor applies Google Analytics (GA) to collect statistics on the

```js
var options = {
...
//...
usageStatistics: false
}

Expand Down Expand Up @@ -184,11 +185,29 @@ When using npm, be sure [Node.js](https://nodejs.org) is installed in the enviro

#### npm

#### 1. ImageEditor installation
```sh
$ npm install --save tui-image-editor # Latest version
$ npm install --save tui-image-editor@<version> # Specific version
```

##### 2. `fabric.js` installation
And you should add **postInstall** script to your `package.json`.
_This process will be removed when `fabric.js` updated to v2.7.0 and bundled with TOAST UI ImageEditor together._

```js
{
// ...
"scripts": {
// ...
"postInstall": "npm install --no-save --no-optional fabric@^1.6.7"
}
// ...
}
```

Or you can add `fabric` as dependency. **But** there is [some steps](https://github.com/fabricjs/fabric.js#install-with-npm) to be installed well.

#### bower

```sh
Expand Down Expand Up @@ -286,6 +305,23 @@ var instance = new ImageEditor(document.querySelector('#tui-image-editor'), {
});
```

### TypeScript
If you using TypeScript, You must `import module = require('module')` on importing.
[`export =` and `import = require()`](https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require)

```typescript
import ImageEditor = require('tui-image-editor');

const instance = new ImageEditor(document.querySelector('#tui-image-editor'), {
cssMaxWidth: 700,
cssMaxHeight: 500,
selectionStyle: {
cornerSize: 20,
rotatingPointOffset: 70
}
});
```

See [details](https://nhnent.github.io/tui.image-editor/latest) for additional informations.

## 🔧 Development
Expand Down Expand Up @@ -326,7 +362,7 @@ $ npm run serve
* [Commit convention](https://github.com/nhnent/tui.image-editor/blob/production/docs/COMMIT_MESSAGE_CONVENTION.md)

## 🔩 Dependency
* [fabric.js](https://github.com/kangax/fabric.js/releases/tag/v1.6.7) >=1.6.7
* [fabric.js](https://github.com/kangax/fabric.js/releases/tag/v1.6.7) >=1.6.7 && < 2.0.0
* [tui.code-snippet](https://github.com/nhnent/tui.code-snippet/releases/tag/v1.2.5) >=1.3.0
* [tui.color-picker](https://github.com/nhnent/tui.color-picker/releases/tag/v2.2.0) >=2.2.0

Expand Down
11 changes: 9 additions & 2 deletions docs/Apply-Mobile-Version.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Please refer to the [sample page](http://nhnent.github.io/tui.image-editor/latest/tutorial-example03-mobile.html) first to check the UI configuration and operation.

#### Step 1. Include the dependency file on the page. (PC version same)

```html
<script src="libs/code-snippet.min.js"></script>
<script src="libs/jquery.min.js"></script>
Expand All @@ -14,18 +15,21 @@
```

#### Step 2. `body` Add markup to the tag to create an image editor. (PC version same)

```html
<div class="tui-image-editor">
<canvas></canvas>
</div>
```

#### Step 3. `head` Add a meta tag for setting the viewport to the tag.

```html
<meta name="viewport" content="width=device-width, user-scalable=no">
```

#### Step 4. Create an image editor by setting option values for mobile device optimization.

```js
// Create image editor
var imageEditor = new tui.component.ImageEditor('.tui-image-editor canvas', {
Expand All @@ -37,6 +41,7 @@ var imageEditor = new tui.component.ImageEditor('.tui-image-editor canvas', {
}
});
```

- `cssMaxWidth`, `cssMaxHeight` :
* Sets maximum `width` and` height` values in the canvas area.
* Do not set it to a fixed value like the PC version because the value changes depending on the mobile device to be connected.
Expand All @@ -58,17 +63,19 @@ var imageEditor = new tui.component.ImageEditor('.tui-image-editor canvas', {


#### Step 5. Add a CSS file and markup for UI configuration. (PC version same)

```html
<link type="text/css" href="css/tui-image-editor-m.css" rel="stylesheet">
<link type="text/css" href="css/service-mobile.css" rel="stylesheet">
```
>
The CSS file is used on the sample page and should only refer to the UI configuration,
It is recommended to customize image, CSS, and markup files when applying the service.


#### Step 6. Apply the image editor API to the UI

- API : [http://nhnent.github.io/tui.image-editor/latest/](http://nhnent.github.io/tui.image-editor/latest/)
- Sample Page : [http://nhnent.github.io/tui.image-editor/latest/tutorial-example01-includeUi.html](http://nhnent.github.io/tui.image-editor/latest/tutorial-example01-includeUi.html)
- Sample Page : [http://nhnent.github.io/tui.image-editor/latest/tutorial-example03-mobile.html](http://nhnent.github.io/tui.image-editor/latest/tutorial-example01-includeUi.html)

![all_feature_small](https://cloud.githubusercontent.com/assets/18183560/17803706/034ea17c-6633-11e6-914d-6602d12888f9.gif)
![text_feature_small](https://cloud.githubusercontent.com/assets/18183560/17803707/03530636-6633-11e6-8c03-cd5523716b9b.gif)
Expand Down
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for TOAST UI Image Editor v3.5.0
// Type definitions for TOAST UI Image Editor v3.5.2
// TypeScript Version: 3.2.2

declare namespace tuiImageEditor {
Expand Down Expand Up @@ -270,7 +270,7 @@ declare namespace tuiImageEditor {
public removeFilter(type?: string): Promise<IFilterResolveObject>;
public removeObject(id: number): Promise<void>;
public resetFlip(): Promise<IFlipXYResolveObject>;
public resizeCanvasDemension(dimension: ICanvasSize): Promise<void>;
public resizeCanvasDimension(dimension: ICanvasSize): Promise<void>;
public rotate(angle: AngleType): Promise<AngleType>;
public setAngle(angle: AngleType): Promise<AngleType>;
public setBrush(option: IBrushOptions): void;
Expand All @@ -288,5 +288,5 @@ declare namespace tuiImageEditor {
}

declare module 'tui-image-editor' {
export default tuiImageEditor.ImageEditor;
export = tuiImageEditor.ImageEditor;
}
Loading

0 comments on commit 81c0b4d

Please sign in to comment.