{"_id":"@anderstornkvist/link","_rev":"1-8c50db041350e00f9e71a55d679b2bd4","name":"@anderstornkvist/link","dist-tags":{"next":"2.1.3","latest":"2.1.3"},"versions":{"2.1.3":{"name":"@anderstornkvist/link","version":"2.1.3","keywords":["codex editor","tool","link","editor.js","editor"],"description":"Link Tool for Editor.js","license":"MIT","repository":{"type":"git","url":"git+https://github.com/editor-js/link.git"},"main":"./dist/bundle.js","scripts":{"build":"webpack --mode production","build:dev":"webpack --mode development --watch"},"author":{"name":"CodeX","email":"team@ifmo.su"},"devDependencies":{"@babel/core":"^7.3.4","@babel/plugin-transform-runtime":"^7.2.0","@babel/preset-env":"^7.3.4","@codexteam/ajax":"^3.2.1","babel-loader":"^8.0.5","babel-preset-env":"^1.7.0","css-loader":"^1.0.0","eslint":"^5.9.0","eslint-config-codex":"github:codex-team/eslint-config","eslint-loader":"^2.1.1","open-graph":"^0.2.4","postcss-loader":"^3.0.0","postcss-nested":"^4.1.0","postcss-nested-ancestors":"^2.0.0","style-loader":"^0.21.0","svg-inline-loader":"^0.8.0","url-polyfill":"^1.1.3","webpack":"^4.29.5","webpack-cli":"^3.2.3"},"bugs":{"url":"https://github.com/editor-js/link/issues"},"homepage":"https://github.com/editor-js/link#readme","dependencies":{"@babel/runtime":"^7.3.1"},"gitHead":"0c7ee59932cf04b3a822b6274c0da4de09dcd7e7","_id":"@anderstornkvist/link@2.1.3","_nodeVersion":"10.16.3","_npmVersion":"6.14.5","dist":{"integrity":"sha512-qwyJSF9Sx8sdbr8wKGRFglKve9hp4oKsaT2GFsQWHvt2+p3u5sEuVCB2jNHcmV6bJnFMu93j+5SdPawz648Gow==","shasum":"3984a2097774eea3a8928082c3a386b7213f7f7d","tarball":"https://registry.npmjs.org/@anderstornkvist/link/-/link-2.1.3.tgz","fileCount":3,"unpackedSize":51480,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJexioVCRA9TVsSAnZWagAA/zsP/3JWCzVMpHzASUQn086r\nQ84ZcLwhimZHwn9pPNo2gvSgbn2Q0omcYA9AjkOAJAGDr4HcsNqyLNva6dZx\neIn2Ksf0kXG+U5fOt+4fp97Qnop9g0pG7jbWzFt6+bGRE1bOWwIOlXx2aY+X\nzVwsyEKCIm5n+ci2TC5iMW3aDXnZubWpA03ICqW1y0L+6wqiVjukbGo6Onmd\n1rcY7rKfWd1USNxcQag+R3eaCJu9poPD7U4YxmFnOdBETNQ6gkhP36tv/L15\nMmyJ1fRRa0jY2CNWMuYNhQDPWqew0c52Woj/sHTk3BYhDrAvsQci0uIVO4BM\nVqpdO9XqdLK/K9UIOqIzF7cOhGiTeAtHFFhOMXDSEchpDCzr31PBDxAop0OF\nRfZWPslU4TBaWhAheNcsKGbSZ9cNPFxVCZxLkHu2yrlExfmQbt5NF5oszUmL\nYhlnwpup0pW5TobWDDU2uDznivMKiN5ychCsqqrhwPrB5n4TWmeeek2f89q2\nGFg/D9i/DgF6HKSU2Fi8lMtJM+lS7jcYc2N4Th7B6f5qXHl4UsByFz6vlXL2\nNsw4PE4E0QbuPPOMSaE6ZybYlvH+nlxQkcUggl9OTuqgC7ayn8T/5DQR5lQW\n5z0Rw4y+sRgLsMivss8SlB9zZSqGPiKKsq28Lw/FS3AXShESke11rPEb4gzG\nTPFT\r\n=ITYH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDo00KcmdFchPBT0yzQdoDjGjDHjerg7ULmreeK2bfFEwIgUWQRMQLQoX7i+9FB2frhbVMS7PYvb8JXbait5fdkohU="}]},"maintainers":[{"name":"anderstornkvist","email":"dev.npm@anderstornkvist.se"}],"_npmUser":{"name":"anderstornkvist","email":"dev.npm@anderstornkvist.se"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/link_2.1.3_1590045204618_0.31475503005705163"},"_hasShrinkwrap":false}},"time":{"created":"2020-05-21T07:13:24.574Z","2.1.3":"2020-05-21T07:13:24.811Z","modified":"2022-04-04T13:58:10.306Z"},"maintainers":[{"name":"anderstornkvist","email":"dev.npm@anderstornkvist.se"}],"description":"Link Tool for Editor.js","homepage":"https://github.com/editor-js/link#readme","keywords":["codex editor","tool","link","editor.js","editor"],"repository":{"type":"git","url":"git+https://github.com/editor-js/link.git"},"author":{"name":"CodeX","email":"team@ifmo.su"},"bugs":{"url":"https://github.com/editor-js/link/issues"},"license":"MIT","readme":"![](https://badgen.net/badge/Editor.js/v2.0/blue)\n\n# Link Tool\n\nLink Block for the [Editor.js](https://codex.so/editor).\n\n![](assets/gif/demo.gif)\n\n## Features\n\nAllows to add link previews to your articles.\n\n**Note:** this Tool requires server-side implementation for link data fetching. See [backend response format](#server-format) for more details.\n\n## Installation\n\n### Install via NPM\n\nGet the package\n\n```shell\nnpm i --save-dev @editorjs/link\n```\n\nInclude module at your application\n\n```javascript\nconst LinkTool = require('@editorjs/link');\n```\n\n### Download to your project's source dir\n\n1. Download folder `dist` from repository\n2. Add `dist/bundle.js` file to your page.\n\n### Load from CDN\n\nYou can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/link).\n\n`https://cdn.jsdelivr.net/npm/@editorjs/link@2.0.0`\n\nThen require this script on page with Editor.js through the `<script src=\"\"></script>` tag.\n\n## Usage\n\nAdd a new Tool to the `tools` property of the Editor.js initial config.\n\n```javascript\nvar editor = EditorJS({\n  ...\n\n  tools: {\n    ...\n    linkTool: {\n      class: LinkTool,\n      config: {\n        endpoint: 'http://localhost:8008/fetchUrl', // Your backend endpoint for url data fetching\n      }\n    }\n  }\n\n  ...\n});\n```\n\n## Config Params\n\nLink Tool supports these configuration parameters:\n\n| Field    | Type        | Description                                    |\n| ---------|-------------|------------------------------------------------|\n| endpoint | `string`    | Endpoint for link data fetching. |\n| fetcher | `{{fetchLinkDataForUrl: function}}`    | Optional custom fetch function. See details below. |\n\nNote that if you don't implement your custom fetch method, the `endpoint` parameter is required.\n\n## Output data\n\nThis Tool returns `data` with following format\n\n| Field          | Type      | Description                     |\n| -------------- | --------- | ------------------------------- |\n| link           | `string`  | Pasted link url                 |\n| meta           | `object`  | Fetched link data. Any data got from backend. Currently title, image and description are supported by plugin's design. |\n\n```json\n{\n    \"type\" : \"linkTool\",\n    \"data\" : {\n        \"link\" : \"https://codex.so\",\n        \"meta\" : {\n            \"title\" : \"CodeX Team\",\n            \"site_name\" : \"CodeX\",\n            \"description\" : \"Club of web-development, design and marketing. We build team learning how to build full-valued projects on the world market.\",\n            \"image\" : {\n                \"url\" : \"https://codex.so/public/app/img/meta_img.png\"\n            }\n        }\n    }\n}\n```\n\n## Backend response format <a name=\"server-format\"></a>\n\nYou can implement backend for link data fetching your own way. It is a specific and trivial task depending on your\nenvironment and stack.\n\nBackend response **should** cover following format:\n\n```json5\n{\n    \"success\" : 1,\n    \"meta\": {\n        // ... any fields you want\n    }\n}\n```\n\n**success** — uploading status. 1 for successful, 0 for failed\n\n**meta** — link fetched data. \n\nCurrently title, image and description fields are supported by plugin's design . They should have the following format in the response:\n```json5\n{\n    \"success\" : 1,\n    \"meta\": {\n        \"title\" : \"CodeX Team\",\n        \"description\" : \"Club of web-development, design and marketing. We build team learning how to build full-valued projects on the world market.\",\n        \"image\" : {\n            \"url\" : \"https://codex.so/public/app/img/meta_img.png\"\n        }\n    }\n}\n```\nAlso, can contain any additional fields you want to store. \n\n## Providing custom fetch method\nYou have the option to provide your own custom fetch method. Use the `fetcher` config parameter with an object with a `fetchLinkDataForUrl` method that takes the url as a parameter and returns a Promise that resolves with response in the format described above.\n","readmeFilename":"README.md"}