{"_id":"@egg-/editor-js-attaches","_rev":"3-812cfea0159b3b9ea19ad8e594461838","name":"@egg-/editor-js-attaches","dist-tags":{"latest":"1.3.3"},"versions":{"1.3.0":{"name":"@egg-/editor-js-attaches","version":"1.3.0","repository":{"type":"git","url":"https://github.com/editor-js-attaches"},"license":"MIT","scripts":{"build":"webpack --mode production","build:dev":"webpack --mode development --watch","server":"node ./dev/server.js"},"keywords":["codex editor","tool","attaches","editor.js","editorjs"],"author":{"name":"CodeX","email":"team@codex.so"},"main":"./dist/bundle.js","devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.2","@codexteam/ajax":"^4.0.1","babel-loader":"^8.2.2","css-loader":"^1.0.0","eslint":"^7.32.0","eslint-config-codex":"^1.6.4","eslint-webpack-plugin":"^3.2.0","file-loader":"^4.1.0","formidable":"^1.2.1","postcss-loader":"^3.0.0","postcss-nested":"^4.1.1","postcss-nested-ancestors":"^2.0.0","request":"^2.88.0","style-loader":"^0.21.0","svg-inline-loader":"^0.8.2","to-string-loader":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"dependencies":{"@codexteam/icons":"^0.0.4"},"gitHead":"4c86e08ed5056de31e51a5e2857c631003ac68c3","description":"Tool for the [Editor.js](https://editorjs.io).","_id":"@egg-/editor-js-attaches@1.3.0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-FZDjijrsepbYQHBE4Lyfc5Eew2uuSDD2cOerDGTR3NnpjANBthZwnMd/PO4P3etbWYxEK74LXzOqaU/Kai9iOA==","shasum":"650ce5cffd71cb29adf00948ebca4fa86140a20f","tarball":"https://registry.npmjs.org/@egg-/editor-js-attaches/-/editor-js-attaches-1.3.0.tgz","fileCount":8,"unpackedSize":48925,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFRMGJSN5y1CQH1uP9gIpg8GIZr4+icfX9xBhsxDtlcPAiEAu2jiuKXQQ7qZMRVX9OAqIA5beyMxROl1jtxbiuaOXrw="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQLlTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqkA//QiMLRVskbKGh0fcBadRsP+sZYAviZmui5j0nmjL5PKublX4v\r\nYuUIn5f19wMyiwrHzZ3lhAu28yIVGSM47A27GBAnYHpeSsMlKakP6T68AV0A\r\nX8c6EDIIwSN8V6wc0Ur9OqkgdgfuqVU3bqm+UWMUx7/GpUOUTlDRd80gJJYV\r\nl/uaZAqZzrTXcG3RDT1104kQXz9EdENVlUaJK1c0W7D+qlEEbZDzkbRtxo5R\r\n6zQ/TSZJBbJ+ybm8VQR1jIf/x/BIJY6oozK+dDWWCaZvvGDITxgrUBCm/VWf\r\naMVMxXut6DmrD55DelKjcPIUTRNraxL3b/GK24JUSBYUIjyra+0f7MBH1l5p\r\nCzThnByBXozarlDiMPileq7UoCBUnJFRI7PgNRBYAO9CCVaHxY+6/AcfRncj\r\n6+Rz2r1A5bVro3CINzxdq2KBFiEUt68UfThL7YIb8r+qwJLT2plRkK1uUSvm\r\nK+301DgdaQok/k+M7XRzNAFrNGyBpKZPjqeiuVfho7VEC6T/xp2guZIfrGkd\r\nC7LlUgMyzYyqio9UG1WL+4qFyeygyW5Dm8KI4IlVjC7iPC3wH8oFmTXmYXao\r\nZ7lVIq3qsWZ9EdivMDt4l/P6tkFlIvbZpPokTo7qK6aG6YAPMsc6KuI5QeI0\r\n+/fXQT9hpI2idlYz2mzj2IX1DmWuH9t8AeY=\r\n=kCGC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"egg-","email":"i@egg.pe.kr"},"directories":{},"maintainers":[{"name":"egg-","email":"i@egg.pe.kr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/editor-js-attaches_1.3.0_1681963347411_0.2600281204654973"},"_hasShrinkwrap":false},"1.3.1":{"name":"@egg-/editor-js-attaches","version":"1.3.1","repository":{"type":"git","url":"git+https://github.com/egg-/editor-js-attaches.git"},"license":"MIT","scripts":{"build":"webpack --mode production","build:dev":"webpack --mode development --watch","server":"node ./dev/server.js"},"keywords":["codex editor","tool","attaches","editor.js","editorjs"],"author":{"name":"CodeX","email":"team@codex.so"},"main":"./dist/bundle.js","devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.2","@codexteam/ajax":"^4.0.1","babel-loader":"^8.2.2","css-loader":"^1.0.0","eslint":"^7.32.0","eslint-config-codex":"^1.6.4","eslint-webpack-plugin":"^3.2.0","file-loader":"^4.1.0","formidable":"^1.2.1","postcss-loader":"^3.0.0","postcss-nested":"^4.1.1","postcss-nested-ancestors":"^2.0.0","request":"^2.88.0","style-loader":"^0.21.0","svg-inline-loader":"^0.8.2","to-string-loader":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"dependencies":{"@codexteam/icons":"^0.0.4"},"gitHead":"c80806ba6d78db4740393338c58aee83ee6ede04","description":"Tool for the [Editor.js](https://editorjs.io).","bugs":{"url":"https://github.com/egg-/editor-js-attaches/issues"},"homepage":"https://github.com/egg-/editor-js-attaches#readme","_id":"@egg-/editor-js-attaches@1.3.1","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-hrlZvKGwNf5OyP1rnuCLzh92G8gkcaDSmhCcAzZC2WygIhYnWVO/1ImkO+mT8worvaJwwxzTkIi/v9ggJbH7sQ==","shasum":"6c1f5c1fe31a8fa412b0248aba030c587019c587","tarball":"https://registry.npmjs.org/@egg-/editor-js-attaches/-/editor-js-attaches-1.3.1.tgz","fileCount":8,"unpackedSize":49018,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcsAZ2NNdzPKNhsyRFxTNeUlrmjCV6a0g9P+qXipPJPQIhAPDHSzbTa065XRp+ocwkagTRb+WlQy6azZySKbyTFO+J"}]},"_npmUser":{"name":"egg-","email":"i@egg.pe.kr"},"directories":{},"maintainers":[{"name":"egg-","email":"i@egg.pe.kr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/editor-js-attaches_1.3.1_1684299935365_0.5561672743951411"},"_hasShrinkwrap":false},"1.3.2":{"name":"@egg-/editor-js-attaches","version":"1.3.2","repository":{"type":"git","url":"git+https://github.com/egg-/editor-js-attaches.git"},"license":"MIT","scripts":{"build":"export NODE_OPTIONS=--openssl-legacy-provider && webpack --mode production","build:dev":"webpack --mode development --watch","server":"node ./dev/server.js"},"keywords":["codex editor","tool","attaches","editor.js","editorjs"],"author":{"name":"CodeX","email":"team@codex.so"},"main":"./dist/bundle.js","devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.2","@codexteam/ajax":"^4.0.1","babel-loader":"^8.2.2","css-loader":"^1.0.0","eslint":"^7.32.0","eslint-config-codex":"^1.6.4","eslint-webpack-plugin":"^3.2.0","file-loader":"^4.1.0","formidable":"^1.2.1","postcss-loader":"^3.0.0","postcss-nested":"^4.1.1","postcss-nested-ancestors":"^2.0.0","request":"^2.88.0","style-loader":"^0.21.0","svg-inline-loader":"^0.8.2","to-string-loader":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"dependencies":{"@codexteam/icons":"^0.0.4"},"_id":"@egg-/editor-js-attaches@1.3.2","gitHead":"c80806ba6d78db4740393338c58aee83ee6ede04","description":"Customized UI","bugs":{"url":"https://github.com/egg-/editor-js-attaches/issues"},"homepage":"https://github.com/egg-/editor-js-attaches#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-8FYTzpK1mcDd3gwiHMjl8iMH4oVfZnZmMB8gbYIBwI/A/u94eneS5u+D1rGEG5rAUvKCHJQqIiTxrP0Pk7mGdw==","shasum":"b07002a1619b307216e6d38657cfb20a9b43dd03","tarball":"https://registry.npmjs.org/@egg-/editor-js-attaches/-/editor-js-attaches-1.3.2.tgz","fileCount":8,"unpackedSize":64423,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBOtrjjUohp4HLBIyJSxh2QuzryJ36PwUvHHAAq+qy19AiEAm0E3tD17+1QNjy9zgyW1rHgKjjXByovRnFApMPz6kbQ="}]},"_npmUser":{"name":"egg-","email":"i@egg.pe.kr"},"directories":{},"maintainers":[{"name":"egg-","email":"i@egg.pe.kr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/editor-js-attaches_1.3.2_1711089747757_0.7509287337831587"},"_hasShrinkwrap":false},"1.3.3":{"name":"@egg-/editor-js-attaches","version":"1.3.3","repository":{"type":"git","url":"git+https://github.com/egg-/editor-js-attaches.git"},"license":"MIT","scripts":{"build":"export NODE_OPTIONS=--openssl-legacy-provider && webpack --mode production","build:dev":"webpack --mode development --watch","server":"node ./dev/server.js"},"keywords":["codex editor","tool","attaches","editor.js","editorjs"],"author":{"name":"CodeX","email":"team@codex.so"},"main":"./dist/bundle.js","devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.2","@codexteam/ajax":"^4.0.1","babel-loader":"^8.2.2","css-loader":"^1.0.0","eslint":"^7.32.0","eslint-config-codex":"^1.6.4","eslint-webpack-plugin":"^3.2.0","file-loader":"^4.1.0","formidable":"^1.2.1","postcss-loader":"^3.0.0","postcss-nested":"^4.1.1","postcss-nested-ancestors":"^2.0.0","request":"^2.88.0","style-loader":"^0.21.0","svg-inline-loader":"^0.8.2","to-string-loader":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0"},"dependencies":{"@codexteam/icons":"^0.0.4"},"_id":"@egg-/editor-js-attaches@1.3.3","gitHead":"c80806ba6d78db4740393338c58aee83ee6ede04","description":"Customized UI","bugs":{"url":"https://github.com/egg-/editor-js-attaches/issues"},"homepage":"https://github.com/egg-/editor-js-attaches#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-N8/xHT5AOnlq1bPn1KS0fGQ/jYPxhbE0GL39jsjC+cCQSB8FggrmGgobgwQ6k0qt/YHqufG7Bgq/G03g5B/moA==","shasum":"438d7b76b2b4edae10351c4cbdbd0f677e598d48","tarball":"https://registry.npmjs.org/@egg-/editor-js-attaches/-/editor-js-attaches-1.3.3.tgz","fileCount":8,"unpackedSize":64398,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHUMW+hT/Bi+j8tDue7S2BjrZg2r7hPMPBMXWYK6n1otAiEAntD3ToOwqJx4rV/bijl5N8kOIkqCYMroU4H73qCYPvk="}]},"_npmUser":{"name":"egg-","email":"i@egg.pe.kr"},"directories":{},"maintainers":[{"name":"egg-","email":"i@egg.pe.kr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/editor-js-attaches_1.3.3_1711090094165_0.8695279684504389"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-20T04:02:27.359Z","1.3.0":"2023-04-20T04:02:27.660Z","modified":"2024-03-22T06:48:14.789Z","1.3.1":"2023-05-17T05:05:35.533Z","1.3.2":"2024-03-22T06:42:27.894Z","1.3.3":"2024-03-22T06:48:14.361Z"},"maintainers":[{"name":"egg-","email":"i@egg.pe.kr"}],"description":"Customized UI","keywords":["codex editor","tool","attaches","editor.js","editorjs"],"repository":{"type":"git","url":"git+https://github.com/egg-/editor-js-attaches.git"},"author":{"name":"CodeX","email":"team@codex.so"},"license":"MIT","readme":"# egg- Fork Version\n\nCustomized UI\n\n# Attaches Tool\n\nTool for the [Editor.js](https://editorjs.io).\n\nThis tool allows you to attach files to your articles.\n\n![Example of the Attach tool look](https://user-images.githubusercontent.com/3684889/179849070-1af9678b-34fb-4485-860e-39f3b0d26c3e.png)\n\n## Installation\n\nYou can get the package using any of these ways.\n\n### Via NPM / Yarn\n\n```shell\nnpm install @editorjs/attaches\n```\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\nimport AttachesTool from '@editorjs/attaches';\n\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`                   | Optional endpoint for file uploading or use uploader                                                                             |\n| uploader                 | `{uploadByFile: function}` | Optional custom uploading method or use endpoint                                                                                 |\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| additionalRequestHeaders | `object`                   | (default: `{}`) Object with any custom headers which will be added to request. Example: `{\"X-CSRF-TOKEN\": \"W5fe2...hR8d1\"}`      |\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>\n\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, title\n  }\n}\n```\n\n**success** - uploading status. 1 for successful, 0 for failed\n\n**file** - uploaded file data. Can contain any data you want to store. All fields will be stored as [file object](#file-object) in output data.\n\nFields supported by the UI of block:\n\n- `title`\n- `size`\n- `extension` (if not present, will be extracted from the `name`)\n- `url`\n\n## Providing custom uploading methods\n\nAs mentioned at the Config Params section, you have an ability to provide own custom uploading method.\nIt is a quite simple: implement `uploadByFile` method and pass them via `uploader` config param.\nThe method return a Promise that resolves with response in a format that described at the [backend response format](#backend-response-format) section.\n\n| Method       | Arguments | Return value                         | Description                                                |\n| ------------ | --------- | ------------------------------------ | ---------------------------------------------------------- |\n| uploadByFile | `File`    | `{Promise.<{success, file: {url}}>}` | Upload file to the server and return an uploaded file data |\n\nExample:\n\n```js\nimport AttachesTool from '@editorjs/attaches';\n\nvar editor = EditorJS({\n  ...\n\n  tools: {\n    ...\n    attaches: {\n      class: AttachesTool,\n      config: {\n        /**\n         * Custom uploader\n         */\n        uploader: {\n          /**\n           * Upload file to the server and return an uploaded image data\n           * @param {File} file - file selected from the device or pasted by drag-n-drop\n           * @return {Promise.<{success, file: {url}}>}\n           */\n          uploadByFile(file){\n            // your own uploading logic here\n            return MyAjax.upload(file).then((response) => {\n              return {\n                success: 1,\n                file: {\n                  url: response.fileurl,\n                  // any data you want\n                  // for example: name, size, title\n                }\n              };\n            });\n          },\n        }\n      }\n    }\n  }\n  ...\n});\n```\n","readmeFilename":"README.md","homepage":"https://github.com/egg-/editor-js-attaches#readme","bugs":{"url":"https://github.com/egg-/editor-js-attaches/issues"}}