{"_id":"@danielcfe/attaches","_rev":"1-2399b6a946324db0c00878e004c29435","name":"@danielcfe/attaches","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.2":{"name":"@danielcfe/attaches","version":"1.0.2","repository":{"type":"git","url":"git+https://github.com/editor-js/attaches.git"},"license":"MIT","scripts":{"build":"npx webpack --mode production","build:dev":"npx webpack --mode development --watch"},"keywords":["codex editor","tool","attaches","editor.js","editorjs"],"author":{"name":"CodeX","email":"team@codex.so"},"main":"./dist/bundle.js","devDependencies":{"@babel/preset-env":"^7.12.11","@codexteam/ajax":"^4.2.0","babel-loader":"^8.2.2","css-loader":"^5.0.1","eslint":"^7.15.0","eslint-config-codex":"github:codex-team/eslint-config","eslint-loader":"^4.0.2","file-loader":"^6.2.0","formidable":"^1.2.2","postcss-loader":"^4.1.0","postcss-nested":"^5.0.3","postcss-nested-ancestors":"^2.0.0","request":"^2.88.2","style-loader":"^2.0.0","svg-inline-loader":"^0.8.2","webpack":"^5.11.0","webpack-cli":"^4.2.0"},"gitHead":"8429064a506cfc6a04e662be9c028f68d10155f9","description":"Credits for fork to SebastianZimmer https://github.com/SebastianZimmer/attaches","bugs":{"url":"https://github.com/editor-js/attaches/issues"},"homepage":"https://github.com/editor-js/attaches#readme","_id":"@danielcfe/attaches@1.0.2","_nodeVersion":"13.1.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-4c/bkhNq2U3yk8fhy2LVl1BbGnxv9YkJ7HMOZJdlEgHZA/WZqqDobkMP2YJKEGC0yWjkDZp8sZ8HYWqUsyi4lQ==","shasum":"622ee662ee5fc19b84b1c0eb3851dbdb0622af98","tarball":"https://registry.npmjs.org/@danielcfe/attaches/-/attaches-1.0.2.tgz","fileCount":7,"unpackedSize":40520,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/0QICRA9TVsSAnZWagAAAdgQAIHyL/h8uDlqWldMgi1F\n9daxTxBtkpvsEtdab6We1v8BL0j4gFxvndV3oQ23BZaAkKA7cKXxOJ0z89zr\nYzNRiWalkRt7DHrrHEi6O8CucO1sP9+XtUwqwP7GxClOssPwu+KKg+39L8+0\ngB53xILsL7XO18sQal91xq1RpCIyjFEhZnDnq9W6cIg3dmkeJ0BZLXzvcKo7\nrUOFBeJoaxrjOgnA15TR1T5ksHFa4cP47kzIbEJXhgixr9PKPLp51ykZImbT\ndfF8X1Wdh30VJ1brko0qlf0HQm3Tr9itGYWv89CuNqjf58Nzz9xyST1ZTzgm\nhra60OIJ8Q3BHLO1wqCiOcM1znExScHfMRTcb8edIO69EFwsJL/UGiNTYxXq\n+0QlRxtZ9qCzpdRl85Od0n7u2JnO/re1BpeXwtt/2l0d3oFV9eiq6iuH1xwb\nX0Hmr7vNkMinuVGH8++XY2fwnnW4ZMHBGTtRyPYPPZ7zxaNvWUgcdBeeX5KB\nEhhxjscZ4RCfheofF/vn6bh1byrHQ+xDsHXYks9c+QVPik4gytnGhuxUrfh8\nmGme/9SxIonw572R32fJ/zBEITRd2DJUhrYnjU7x6bINc5VPh84ow3ry56/d\nM2VwEOv28FBInG1Yf+p/QZ74lPdyC16Zl4cQLz+H5biI8fKxuAdAo/O5VkTL\n8J5h\r\n=i8uQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNsK3CcIO/RACSdXWnycJ6/25v7J5cl1KDuE55R34lYgIgWsDX5ggN0NHWFQ9TffAVphZgLewcXP4X+Xx6kRuUC+s="}]},"_npmUser":{"name":"danielcfe","email":"danielcfe@gmail.com"},"directories":{},"maintainers":[{"name":"danielcfe","email":"danielcfe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/attaches_1.0.2_1610564616139_0.6973738175022144"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-13T19:03:36.103Z","1.0.2":"2021-01-13T19:03:36.264Z","modified":"2022-04-05T02:40:40.442Z"},"maintainers":[{"name":"danielcfe","email":"danielcfe@gmail.com"}],"description":"Credits for fork to SebastianZimmer https://github.com/SebastianZimmer/attaches","homepage":"https://github.com/editor-js/attaches#readme","keywords":["codex editor","tool","attaches","editor.js","editorjs"],"repository":{"type":"git","url":"git+https://github.com/editor-js/attaches.git"},"author":{"name":"CodeX","email":"team@codex.so"},"bugs":{"url":"https://github.com/editor-js/attaches/issues"},"license":"MIT","readme":"Credits for fork to SebastianZimmer\nhttps://github.com/SebastianZimmer/attaches\n\n![](https://badgen.net/badge/Editor.js/v2.0/blue)\n# Attaches Tool\nAttaches Tool for the [Editor.js](https://codex.so/editor).\n\nThis tool allows you to attach files to your articles.\n\n![Example](https://capella.pics/7b63cffe-9214-40f4-9009-0637970a4630.jpg)\n\n## Get the package\nYou can get the package using any of these ways.\n\n### Install via npm\n\n```shell\nnpm i --save-dev @danielcfe/attaches\n```\n\nInclude module at your application\n\n```javascript\nconst AttachesTool = require('@editorjs/attaches');\n```\n\n\n### Download to your project's source dir\n\n1. Upload 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/attaches).\n\n`https://cdn.jsdelivr.net/npm/@editorjs/attaches@latest`\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    attaches: {\n      class: AttachesTool,\n      config: {\n        endpoint: 'http://localhost:8008/uploadFile'\n      }\n    }\n  }\n\n  ...\n});\n```\n\n## Config Params\n\nAttaches Tool supports these configuration parameters:\n\n| Field | Type     | Description        |\n| ----- | -------- | ------------------ |\n| endpoint | `string` | **Required:** endpoint for file uploading. |\n| field | `string` | (default: `file`) Name of uploaded file field in POST request |\n| types | `string` | (default: `*`) Mime-types of files that can be [accepted with file selection](https://github.com/codex-team/ajax#accept-string).|\n| buttonText | `string` | (default: `Select file`) Placeholder for file upload button |\n| errorMessage | `string` | (default: `File upload failed`) Message to show if file upload failed |\n\n\n## Output data\n\nThis Tool returns `data` with following format\n\n| Field          | Type      | Description                     |\n| -------------- | --------- | ------------------------------- |\n| file           | `object`  | Uploaded file data. Data received from backend uploader. See description below. |\n| title | `string` | File's title. Initially set as uploaded file name. Can be modified by user.          |\n\n### file object <a name=\"file-object\"></a>\nObject `file` consists of the following fields. All of them are optional, `size` and `extension` are supported by design.\n\n| Field          | Type      | Description                       |\n| -------------- | --------- | ----------------------------------|\n| url            |`string`   | Full public path of uploaded file |\n| size           |`number`   | File's size (expected in bytes, according to Tool's design)                      |\n| name           |`string`   | File's name                       |\n| extension      |`string`   | File's extension                  |\n\n```json\n{\n    \"type\" : \"attaches\",\n    \"data\" : {\n        \"file\": {\n            \"url\" : \"https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg\",\n            \"size\": 91,\n            \"name\": \"hero.jpg\",\n            \"extension\": \"jpg\"\n        },\n        \"title\": \"Hero\"\n    }\n}\n```\n\n## Backend response format\n\nResponse of your uploader **should** cover following format:\n\n```json5\n{\n    \"success\" : 1,\n    \"file\": {\n        // any data you want \n        // for example: url, name, size\n    }\n}\n```\n\n**success** - uploading status. 1 for successful, 0 for failed\n\n**file** - uploaded file data.\nCan contain data you want to store. Fields `url`, `name`, `size`, and `extension` if present will be written to [file object](#file-object). Fields size and extension are supported by design.\n","readmeFilename":"README.md"}