Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.eslintrc
*.log
_index.html
dist/
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ This plugin adds the possibility to embed custom code

|Option|Description|Default|
|-|-|-
| `blockLabel` | Label of the custom code block | `Custom Code` |
| `blockCustomCode` | Object to extend the default custom code block, eg. `{ label: 'Custom Code', category: 'Extra', ... }`. Pass a falsy value to avoid adding the block | `{}` |
| `propsCustomCode` | Object to extend the default custom code properties, eg. `{ name: 'Custom Code', droppable: false, ... }` | `{}` |
| `placeholderContent` | Initial content of the custom code component | `<span>Insert here your custom code</span>` |
| `propsCustomCode` | Object to extend the default custom code properties, eg. `{ name: 'Custom Code', components: '<span>Initial content</span>' ... }` | `{}` |
| `toolbarBtnCustomCode` | Object to extend the default component's toolbar button for the code, eg. `{ label: '</>', attributes: { title: 'Open custom code' } }`. Pass a falsy value to avoid adding the button | `{}` |
| `placeholderScript` | Content to show when the custom code contains `<script>` | [Check the source](https://github.com/artf/grapesjs-custom-code/tree/master/src/index.js) |
| `modalTitle` | Title for the modal | `Insert your code` |
Expand Down
3 changes: 0 additions & 3 deletions dist/grapesjs-custom-code.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/grapesjs-custom-code.min.js.map

This file was deleted.

26 changes: 12 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<title>GrapesJS Plugin Custom Code</title>
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="dist/grapesjs-plugin-boilerplate.min.js"></script>
<style>
body,
html {
Expand All @@ -25,20 +24,19 @@


<script type="text/javascript">
var editor = grapesjs.init({
height: '100%',
showOffsets: 1,
noticeOnUnload: 0,
storageManager: { autoload: 0 },
container: '#gjs',
fromElement: true,
setTimeout(() => {
window.editor = grapesjs.init({
height: '100%',
showOffsets: true,
allowScripts: true,
noticeOnUnload: false,
storageManager: false,
container: '#gjs',
fromElement: true,

plugins: ['grapesjs-custom-code'],
pluginsOpts: {
'grapesjs-custom-code': {}
}
});
window.editor = editor;
plugins: ['grapesjs-custom-code'],
});
})
</script>
</body>
</html>
Loading