首页 > 解决方案 > GrapesJs 链接组件不可调整大小

问题描述

我正在扩展葡萄 js 的链接组件,但即使在给出之后

resizable: 1, 
droppable: 1,

我不能调整它的大小,也不能在里面放任何东西。图书馆里还有什么我需要改变的吗?

我的组件代码是-

 const linkType = domc.getType('link');
  const model = linkType.model;
  const view = linkType.view;
  domc.addType('link', {
    model: model.extend({
      defaults: {
        ...model.prototype.defaults,
        resizable: 1,
        editable: 1,
        droppable: 1,
        traits: [
          {
            type: 'text',
            name: 'test',
            label: 'Text',
          },
          ...model.prototype.defaults.traits,
        ],
      },

      isComponent: function (el) {
        if (el.tagName == 'A' || el.tagName == 'LINK') {
          return { type: 'link' };
        }
      },
    }),
    view: view,
  });

标签: grapesjs

解决方案


推荐阅读