{"id":17434606,"url":"https://github.com/divbrands/payload-plugin-editing-check","last_synced_at":"2025-03-01T07:32:12.756Z","repository":{"id":199889490,"uuid":"701465415","full_name":"divbrands/payload-plugin-editing-check","owner":"divbrands","description":"Payload plugin to display if a page is being edited by someone else. Built with PartyKit.","archived":false,"fork":false,"pushed_at":"2023-10-16T19:36:35.000Z","size":81,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T14:06:04.391Z","etag":null,"topics":["payload-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@divbrands/payload-plugin-editing-check","language":"JavaScript","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/divbrands.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-06T17:34:57.000Z","updated_at":"2024-06-13T20:41:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf6d5b2b-2231-4430-bae6-7c7b84dcdd9e","html_url":"https://github.com/divbrands/payload-plugin-editing-check","commit_stats":null,"previous_names":["divbrands/payload-plugin-editing-check"],"tags_count":0,"template":false,"template_full_name":"payloadcms/plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divbrands%2Fpayload-plugin-editing-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divbrands%2Fpayload-plugin-editing-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divbrands%2Fpayload-plugin-editing-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divbrands%2Fpayload-plugin-editing-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divbrands","download_url":"https://codeload.github.com/divbrands/payload-plugin-editing-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240364353,"owners_count":19789758,"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":["payload-plugin"],"created_at":"2024-10-17T09:07:39.591Z","updated_at":"2025-03-01T07:32:12.364Z","avatar_url":"https://github.com/divbrands.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payload Plugin Editing Check\n\n* This plugin is still under development. PR's are welcomed.\n\nThis plugin adds a field to your collections that blocks someone of editing the content if that ID is already being edited by someone else.\n\nIt uses the PartyKit library to create websocket connections with a room for each slug and ID so that the editing can be reenabled after whoever was editing finishes it.\n\n## Installation\n\n### Install the package\n\n```\nyarn add @divbrands/payload-plugin-editing-check\n```\n\n### Configure PartyKit server\n\nCreate a `partykit.json` file in the root of your project with the following contents:\n\n```\n{\n  \"name\": \"payload-editing-check-party\",\n  \"main\": \"./node_modules/@divbrands/payload-plugin-editing-check/dist/server/partykit.js\",\n  \"compatibilityDate\": \"2023-10-06\"\n}\n```\n\nThis will ensure that the deployed server works with the plugin.\n\nYou can change the name of the party as you want.\n\n### Create the server\n\nRun this command where the `partykit.json` file resides:\n\n```\nnpx partykit deploy\n```\n\nIt will first ask to create your login if you don't have it yet. \nThen grab the URL of the server on the command line and add to your ```.env``` file:\n\n```\nPAYLOAD_PUBLIC_PARTY_URL=name-of-your-party-and-server\n```\n\nYou can find more info if needed at: [https://docs.partykit.io/](https://docs.partykit.io/)\n\n### Configure Payload CMS\n\nAdd the plugin to your configuration:\n\n```js\nimport { buildConfig } from 'payload/config';\nimport { editingCheck } from \"@divbrands/payload-plugin-editing-check\"\n\nconst config = buildConfig({\n  collections: ['examples', 'users'],\n  plugins: [\n    editingCheck({\n      enabled: true,\n      except: ['users'],\n      partyUrl: process.env.PAYLOAD_PUBLIC_PARTY_URL\n    }),\n  ],\n});\n\nexport default config;\n```\n\n#### Options\n- `enabled`: Boolean\n \n  If you want the plugin enabled or not.\n\n- `except`: string[] | null\n\n  You can choose the collections that you don't want the plugin to apply.\n\n- `partyUrl`: string\n\n  The URL provided by deploying Party Kit with `npx partykit deploy`.\n  It has to be public if it comes from `.env` file.\n\n\n### Enjoy\n\nAnd that's it! You can try opening a few tabs wih and ID of a collection and seeing the modal appear. It will block any editing of the content for that specific ID.\n\nWhen you close the tab that was actually editing the content, another one should reload and now be able to edit.\n\nThe tab will reload so that it gets the updated content from last edit.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivbrands%2Fpayload-plugin-editing-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivbrands%2Fpayload-plugin-editing-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivbrands%2Fpayload-plugin-editing-check/lists"}