Issue #2121💬 AnsweredOpened July 8, 2019by mksmanish791 reactions

Gjs-editable='false' works only on drag drog

快速解答by mksmanish791

I am able to fix this by creating plugin

Read full answer below ↓

Question

代码片段TEXT
I have created a component

    var comps = editor.DomComponents;
    var defaultType = comps.getType('default');
    var defaultModel = defaultType.model;
    var defaultView = defaultType.view;

    comps.addType('module', {
        model: defaultModel.extend({
            defaults: Object.assign({}, defaultModel.prototype.defaults, {
                droppable: false,
                editable: false
            })
        },
            {
                isComponent: function (el) {
                    if (el.tagName == 'div' || el.tagName == 'DIV' && (el.attributes.desktopmoduleid != undefined)) {
                        return { type: 'module' };
                    }
                }
            })
    });


`editor.BlockManager.add(value.ModuleName, {
                    category: 'apps',
                    attributes: { type: 'apps' },
                    label: '<div><img src="' + value.ModuleImage + '"/><div class="my-label-block">' + value.ModuleName + '</div></div>',
                    content: '<div desktopmoduleid="' + value.ModuleID + '" mid="" gjs-editable="false" gjs-type="module" gjs-droppable="false" style="padding:10px;">' + value.ModuleName + '</div>'
                })`



The gjs-editable="false" works only on drag drop, its not working on page load after saved.

Answers (1)

mksmanish79July 9, 2019

I am able to fix this by creating plugin

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.