{"id":18685810,"url":"https://github.com/grapesjs/components-custom-code","last_synced_at":"2025-04-06T21:15:01.564Z","repository":{"id":38552642,"uuid":"142496422","full_name":"GrapesJS/components-custom-code","owner":"GrapesJS","description":"GrapesJS component for the embed of custom code ","archived":false,"fork":false,"pushed_at":"2024-01-10T18:32:02.000Z","size":344,"stargazers_count":79,"open_issues_count":11,"forks_count":45,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T20:11:56.117Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://grapesjs.com/demo.html","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrapesJS.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}},"created_at":"2018-07-26T21:37:00.000Z","updated_at":"2025-02-21T08:10:21.000Z","dependencies_parsed_at":"2024-01-23T21:43:18.329Z","dependency_job_id":null,"html_url":"https://github.com/GrapesJS/components-custom-code","commit_stats":null,"previous_names":["artf/grapesjs-custom-code"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrapesJS%2Fcomponents-custom-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrapesJS%2Fcomponents-custom-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrapesJS%2Fcomponents-custom-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrapesJS%2Fcomponents-custom-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrapesJS","download_url":"https://codeload.github.com/GrapesJS/components-custom-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550690,"owners_count":20956987,"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":[],"created_at":"2024-11-07T10:24:20.789Z","updated_at":"2025-04-06T21:15:01.544Z","avatar_url":"https://github.com/GrapesJS.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GrapesJS Custom Code\n\nThis plugin adds the possibility to embed custom code\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/11614725/43289377-15322c5e-912b-11e8-9a29-cc2dc45af48a.gif\" alt=\"GrapesJS Custom Code\" align=\"center\"/\u003e\u003c/p\u003e\n\n\u003e Requires GrapesJS v0.14.25 or higher\n\n\n## Summary\n\n* Plugin name: `grapesjs-custom-code`\n* Components\n  * `custom-code`\n* Blocks\n  * `custom-code`\n* Commands\n  * `custom-code:open-modal`\n\n\n\n\n## Options\n\n|Option|Description|Default|\n|-|-|-\n| `blockCustomCode` | Object to extend the default custom code block, eg. `{ label: 'Custom Code', category: 'Extra', ... }`. Pass a falsy value to avoid adding the block | `{}` |\n| `propsCustomCode` | Object to extend the default custom code properties, eg. `{ name: 'Custom Code', components: '\u003cspan\u003eInitial content\u003c/span\u003e' ... }` | `{}` |\n| `toolbarBtnCustomCode` | Object to extend the default component's toolbar button for the code, eg. `{ label: '\u003c/\u003e', attributes: { title: 'Open custom code' } }`. Pass a falsy value to avoid adding the button | `{}` |\n| `placeholderScript` | Content to show when the custom code contains `\u003cscript\u003e` | [Check the source](https://github.com/GrapesJS/components-custom-code/blob/master/src/index.ts) |\n| `modalTitle` | Title for the modal | `Insert your code` |\n| `codeViewOptions` | Additional options for the code viewer, eg. `{ theme: 'hopscotch', readOnly: 0 }` | `{}` |\n| `buttonLabel` | Label for the default save button | `Save` |\n| `commandCustomCode` | Object to extend the default custom code command, eg. `{ getPreContent: () =\u003e '\u003cdiv\u003ePaste here\u003c/div\u003e' }` [Check the source](https://github.com/GrapesJS/components-custom-code/blob/master/src/commands.ts) to see all available methods | `{}` |\n\n\n\n\n\n## Download\n\n* CDN\n  * `https://unpkg.com/grapesjs-custom-code`\n* NPM\n  * `npm i grapesjs-custom-code`\n* GIT\n  * `git clone https://github.com/GrapesJS/components-custom-code.git`\n\n\n\n\n\n## Usage\n\n\n```html\n\u003clink href=\"https://unpkg.com/grapesjs/dist/css/grapes.min.css\" rel=\"stylesheet\"/\u003e\n\u003cscript src=\"https://unpkg.com/grapesjs\"\u003e\u003c/script\u003e\n\u003cscript src=\"path/to/grapesjs-custom-code.min.js\"\u003e\u003c/script\u003e\n\n\u003cdiv id=\"gjs\"\u003e\u003c/div\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n  var editor = grapesjs.init({\n      container : '#gjs',\n      ...\n      plugins: ['grapesjs-custom-code'],\n      pluginsOpts: {\n        'grapesjs-custom-code': {\n          // options\n        }\n      }\n  });\n\u003c/script\u003e\n```\n\n```jsx\nimport GrapesJS from 'grapesjs';\nimport customCodePlugin from 'grapesjs-custom-code';\n\n...\n\nGrapesJS.init({\n container : '#gjs',\n ...\n plugins: [\n   customCodePlugin\n ],\n pluginsOpts: {\n   [customCodePlugin]: {\n     // options\n   }\n }\n});\n```\n\n\n\n\n\n## Development\n\nClone the repository\n\n```sh\n$ git clone https://github.com/GrapesJS/components-custom-code.git\n$ cd grapesjs-custom-code\n```\n\nInstall dependencies\n\n```sh\n$ npm i\n```\n\nStart the dev server\n\n```sh\n$ npm start\n```\n\n\n\n\n\n## License\n\nBSD 3-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrapesjs%2Fcomponents-custom-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrapesjs%2Fcomponents-custom-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrapesjs%2Fcomponents-custom-code/lists"}