# xws-editor-outlink

> Link Tool for Editor.js

Latest version **0.0.4** (published 2019-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install xws-editor-outlink
pnpm add xws-editor-outlink
yarn add xws-editor-outlink
bun add xws-editor-outlink
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-08-07 |
| First published | 2019-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 51.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | mingying |
| Keywords | codex editor, tool, link, editor.js, editor |

## Links

- npm: https://www.npmjs.com/package/xws-editor-outlink
- npm.io page: https://npm.io/package/xws-editor-outlink

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.3.1

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2019-08-07
- 0.0.3 — 2019-08-06
- 0.0.2 — 2019-08-05
- 0.0.1 — 2019-08-05

## README

![](https://badgen.net/badge/Editor.js/v2.0/blue)

# Link Tool

Link Block for the [Editor.js](https://codex.so/editor).

![](assets/gif/demo.gif)

## Features

Allows to add link previews to your articles.

**Note:** this Tool requires server-side implementation for link data fetching. See [backend response format](#server-format) for more details.

## Installation

### Install via NPM

Get the package

```shell
npm i --save-dev xws-editor-outlink
```

Include module at your application

```javascript
const LinkTool = require("xws-editor-outlink");
```

### Download to your project's source dir

1. Download folder `dist` from repository
2. Add `dist/bundle.js` file to your page.

## Usage

Add a new Tool to the `tools` property of the Editor.js initial config.

```javascript
var editor = EditorJS({
  ...

  tools: {
    ...
    linkTool: {
      class: LinkTool,
      config: {
        endpoint: 'http://localhost:8008/fetchUrl', // Your backend endpoint for url data fetching
      }
    }
  }

  ...
});
```

## Config Params

Link Tool supports these configuration parameters:

| Field    | Type     | Description                                    |
| -------- | -------- | ---------------------------------------------- |
| endpoint | `string` | **Required:** endpoint for link data fetching. |

## Output data

This Tool returns `data` with following format

| Field | Type     | Description                                                                                                            |
| ----- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| link  | `string` | Pasted link url                                                                                                        |
| meta  | `object` | Fetched link data. Any data got from backend. Currently title, image and description are supported by plugin's design. |

```json
{
  "type": "linkTool",
  "data": {}
}
```

## Backend response format <a name="server-format"></a>

You can implement backend for link data fetching your own way. It is a specific and trivial task depending on your
environment and stack.

Backend response **should** cover following format:

```json5
{
  success: 1,
  meta: {
    // ... any fields you want
  }
}
```

```

Also, can contain any additional fields you want to store.
```

---
_Source: https://npm.io/package/xws-editor-outlink · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
