How to use the grapesjs.init function in grapesjs

To help you get started, we’ve selected a few grapesjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github origami-cms / cms / packages / admin / src / components / ui / WYSIWYG / WYSIWYG.ts View on Github external
public firstUpdated() {
    this._editor = gjs.init({
      // Indicate where to init the editor. You can also pass an HTMLElement
      container: this.shadowRoot!.querySelector('#gjs'),
      // Get the content for the canvas directly from the element
      // As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
      components: this._initialValue,
      // Size of the editor
      height: '300px',
      width: 'auto',
      // Disable the storage manager for the moment
      storageManager: { type: null },
      // Avoid any default panel
      panels: { defaults: [] },

      rte: {
        actions: ['bold', 'italic', 'underline', 'strikethrough']
      },
github creative-connections / Bodylight.js-Composer / src / scenes / Design / Design.jsx View on Github external
componentDidMount() {
    createjs.Ticker.framerate = 13

    const editor = grapesjs.init({
      container: this.ref.current,

      components: '',
      fromElement: false,

      height: '100vh',
      width: 'auto',

      autorender: 0,

      storageManager: {
        id: '',
        type: 'redux',
        stepsBeforeSave: 0
      },
github creative-connections / Bodylight.js-Composer / src / scenes / Design / components / Editor / Editor.jsx View on Github external
componentDidMount () {
    const editor = grapesjs.init({
      container: this.editor.current,

      components: '',
      fromElement: false,

      height: '100vh',
      width: 'auto',

      autorender: 0,

      storageManager: {
        id: '',
        type: 'redux',
        stepsBeforeSave: 1
      },
github oroinc / platform / src / Oro / Bundle / ContentBuilderBundle / Resources / public / js / app / views / grapesjs-editor-view.js View on Github external
initBuilder: function() {
            this.builder = GrapesJS.init(_.extend(
                {}
                , {
                    avoidInlineStyle: 1,
                    container: this.getContainer()
                }
                , this._prepareBuilderOptions()));

            mediator.trigger('grapesjs:created', this.builder);

            this.builderDelegateEvents();

            GrapesJSModules.call('components', {
                builder: this.builder
            });
        },
github thanhtunguet / grapesjs-react / src / components / GEditor.tsx View on Github external
useEffect(() => {
      if (!editor) {

        let plugins = [
          gjsBasicBlocks,
          ...props.plugins
        ];
        if (webpage) {
          plugins = [...plugins, gjsPresetWebpage];
        }
        if (newsletter) {
          plugins = [...plugins, gjsPresetNewsletter];
        }

        const e = GrapesJS.init({
          blockManager,
          container: `#${id}`,
          fromElement: true,
          plugins,
          storageManager
        });

        const defaultType = e.DomComponents.getType('default');
        const defaultModel = defaultType.model;
        const defaultView = defaultType.view;
        components.forEach((component: GComponent) => {
          e.DomComponents.addType(component.type, {
            model: defaultModel.extend(
              {
                defaults: Object.assign({}, defaultModel.prototype.defaults)
              },
github Mailtrain-org / mailtrain / client / src / lib / sandboxed-grapesjs-root.js View on Github external
'  }\n' +
                '  .grid-item-cell2-r{\n' +
                '    vertical-align:top;\n' +
                '    padding-left:10px;\n' +
                '    width:50%;\n' +
                '  }';

            config.plugins.push('gjs-preset-newsletter');
        }

        config.components = props.initialSource ? base(props.initialSource, this.props.tagLanguage, trustedUrlBase, sandboxUrlBase, publicUrlBase) : defaultSource;
        config.style = props.initialStyle ? base(props.initialStyle, this.props.tagLanguage, trustedUrlBase, sandboxUrlBase, publicUrlBase) : defaultStyle;

        config.plugins.push('mailtrain-remove-buttons');

        this.editor = grapesjs.init(config);
    }
github thanhtunguet / grapesjs-react / src / Editor / Editor.tsx View on Github external
() => {
        if (!editor) {
          const newEditor = GrapesJS.init({
            container: `#${id}`,
            fromElement: true,
            blockManager,
            styleManager,
            storageManager,
            width,
            height,
            plugins: [
              presets[presetType],
              ...propPlugins,
            ],
          });
          setEditor(newEditor);
          if (onInit) {
            onInit(editor);
          }

grapesjs

Free and Open Source Web Builder Framework

BSD-3-Clause
Latest version published 4 days ago

Package Health Score

92 / 100
Full package analysis