
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
grapesjs-dynamic-components
Advanced tools
Switch component type based on where a block is dropped
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-dynamic-components"></script>
<div id="gjs"></div>
const editor = grapesjs.init({
container: '#gjs',
height: '100%',
fromElement: true,
storageManager: false,
plugins: ['grapesjs-dynamic-components'],
});
body, html {
margin: 0;
height: 100%;
}
grapesjs-dynamic-componentsdynamic| Option | Description | Default |
|---|---|---|
dynamicName | Name of dynamic component | dynamic |
dynamicOpts | Options for extending dynamic component | {} |
https://unpkg.com/grapesjs-dynamic-componentsnpm i grapesjs-dynamic-componentsgit clone https://github.com/documint-me/grapesjs-dynamic-components.gitDefine block with type dynamic and define which component to use for a given set of parent components
const bm = editor.Blocks;
bm.add('dynamic-content', {
label: 'Dynamic Content',
content: {
type: 'dynamic',
switch: [{
parents: ['cont'], // List of parent component types
type: 'test' // Type to use given above parent components
},
{
parents: ['cont2'],
type: 'test2'
}
]
}
});
Directly in the browser
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-dynamic-components.min.js"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container: '#gjs',
// ...
plugins: ['grapesjs-dynamic-components'],
pluginsOpts: {
'grapesjs-dynamic-components': { /* options */ }
}
});
</script>
Modern javascript
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-dynamic-components';
import 'grapesjs/dist/css/grapes.min.css';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
Clone the repository
$ git clone https://github.com/documint-me/grapesjs-dynamic-components.git
$ cd grapesjs-dynamic-components
Install dependencies
$ npm i
Start the dev server
$ npm start
Build the source
$ npm run build
MIT
FAQs
Grapesjs Dynamic Components
We found that grapesjs-dynamic-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.