8000 Remove placeholderContent option · GrapesJS/components-custom-code@28a7f5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 28a7f5f

Browse files
committed
Remove placeholderContent option
1 parent 1a0d6ac commit 28a7f5f

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/components.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export default (editor: grapesjs.Editor, opts: PluginOptions = {}) => {
2323
defaults: {
2424
name: 'Custom Code',
2525
editable: true,
26+
components: {
27+
tagName: 'span',
28+
components: { type: 'textnode', content: 'Insert here your custom code' }
29+
},
2630
...opts.propsCustomCode,
2731
},
2832

@@ -32,7 +36,7 @@ export default (editor: grapesjs.Editor, opts: PluginOptions = {}) => {
3236
init() {
3337
// @ts-ignore
3438
this.on(`change:${keyCustomCode}`, this.onCustomCodeChange);
35-
const initialCode = this.get(keyCustomCode) || opts.placeholderContent;
39+
const initialCode = this.get(keyCustomCode);
3640
!this.components().length && this.components(initialCode);
3741
const toolbar = this.get('toolbar');
3842
const id = 'custom-code';

src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ export type PluginOptions = {
1818
*/
1919
propsCustomCode?: grapesjs.ComponentDefinition;
2020

21-
/**
22-
* Initial content of the custom code component
23-
* @default '<span>Insert here your custom code</span>'
24-
*/
25-
placeholderContent?: string;
26-
2721
/**
2822
* Object to extend the default component's toolbar button for the code. Pass a falsy value to avoid adding the button
2923
* @example
@@ -65,7 +59,6 @@ const plugin: grapesjs.Plugin<PluginOptions> = (editor, opts = {}) => {
6559
const options: PluginOptions = {
6660
blockCustomCode: {},
6761
propsCustomCode: {},
68-
placeholderContent: '<span>Insert here your custom code</span>',
6962
toolbarBtnCustomCode: {},
7063
placeholderScript: `<div style="pointer-events: none; padding: 10px;">
7164
<svg viewBox="0 0 24 24" style="height: 30px; vertical-align: middle;">

0 commit comments

Comments
 (0)
0