{"id":18646010,"url":"https://github.com/aryanj-nyc/draft-js-aws-amplify-s3-plugin","last_synced_at":"2025-06-13T03:02:29.179Z","repository":{"id":36784429,"uuid":"230062464","full_name":"AryanJ-NYC/draft-js-aws-amplify-s3-plugin","owner":"AryanJ-NYC","description":"A plugin for use with draft-js-plugins-editor and aws-amplify.","archived":false,"fork":false,"pushed_at":"2023-01-05T03:38:42.000Z","size":1741,"stargazers_count":4,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T03:02:26.228Z","etag":null,"topics":["amplify-js","aws","aws-amplify","aws-s3","draft-js","draft-js-plugins","draftjs","s3"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/draft-js-aws-amplify-s3-plugin","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AryanJ-NYC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-25T07:35:49.000Z","updated_at":"2022-08-25T06:40:46.000Z","dependencies_parsed_at":"2023-01-17T05:00:22.871Z","dependency_job_id":null,"html_url":"https://github.com/AryanJ-NYC/draft-js-aws-amplify-s3-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AryanJ-NYC/draft-js-aws-amplify-s3-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AryanJ-NYC%2Fdraft-js-aws-amplify-s3-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AryanJ-NYC%2Fdraft-js-aws-amplify-s3-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AryanJ-NYC%2Fdraft-js-aws-amplify-s3-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AryanJ-NYC%2Fdraft-js-aws-amplify-s3-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AryanJ-NYC","download_url":"https://codeload.github.com/AryanJ-NYC/draft-js-aws-amplify-s3-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AryanJ-NYC%2Fdraft-js-aws-amplify-s3-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259571641,"owners_count":22878182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amplify-js","aws","aws-amplify","aws-s3","draft-js","draft-js-plugins","draftjs","s3"],"created_at":"2024-11-07T06:18:01.708Z","updated_at":"2025-06-13T03:02:27.088Z","avatar_url":"https://github.com/AryanJ-NYC.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DraftJS AWS Amplify S3 Plugin\n\nThis is a plugin for use with [draft-js-plugins-editor](https://github.com/draft-js-plugins/draft-js-plugins)\n\nIt is heavily inspired by the [draft-js-image-plugin](https://www.draft-js-plugins.com/plugin/image).\n\n## Assumptions\n\n### Peer Dependencies\n\nPlease note that using this plugin requires your project has `aws-amplify` (not `@aws-amplify/storage`), `draft-js`, `react` and `react-dom` packages installed.\n\n#### Peer Dependencies Motivation\n\nDraftJS has peer dependencies on `react` and `react-dom`. Additionally, to successfully use hooks, [the `react` import from your application code needs to resolve to the same module as the react import from inside the `react-dom` package](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react).\n\nSince the `Amplify` module installed in your `node_modules` is correctly configured (using `Amplify.configure()`), this library hooks directly into that configuration via the `peerDependency`.\n\n### Amplify Configuration\n\nThis plugin assumes you've successfully [configured AWS `Amplify`](https://aws-amplify.github.io/amplify-js/api/#configuration) with an `awsconfig`.\n\n## Example Usage\n\n```typescript\nimport { Storage } from 'aws-amplify';\nimport { EditorState } from 'draft-js';\nimport Editor from 'draft-js-plugins-editor';\nimport createS3Plugin from 'draft-js-aws-amplify-s3-plugin';\nimport React from 'react';\n\nconst s3Plugin = createS3Plugin();\nconst plugins = [s3Plugin];\n\n// The Editor accepts an array of plugins. In this case, only the s3Plugin\n// is passed in, although it is possible to pass in multiple plugins.\nconst MyEditor = ({ editorState }: { editorState: EditorState }) =\u003e {\n  const onImageChange = async (e: React.ChangeEvent\u003cHTMLInputElement\u003e) =\u003e {\n    const { files } = e.target;\n    const [file] = Array.from(files);\n    const { key: s3Key } = (await Storage.put(file.name, file)) as {\n      key: string;\n    };\n    const newEditorState = s3Plugin.addS3Image(editorState, s3Key);\n    setEditorState(newEditorState);\n  };\n\n  return (\n    \u003c\u003e\n      \u003cEditor editorState={editorState} onChange={onChange} plugins={plugins} /\u003e\n      \u003cinput type=\"file\" onChange={onImageChange} /\u003e\n    \u003c/\u003e\n  );\n};\n\nexport default MyEditor;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryanj-nyc%2Fdraft-js-aws-amplify-s3-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faryanj-nyc%2Fdraft-js-aws-amplify-s3-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryanj-nyc%2Fdraft-js-aws-amplify-s3-plugin/lists"}