export default (editor, opts = {}) => {
  const am = editor.AssetManager;
  const config = am.getConfig();
  config.upload = false;
  let { types } = opts;
  am.addType(types.button, {
    model: {
      defaults: {
        type: types.button,
        content: "",
        name: "Default Custom Button",
      },
      getName() {
        return this.get("name");
      },
    },
    view: {
      init() {
        this.className += " ".concat(this.pfx, types.button);
      },
      getPreview() {
        return `${this.model.get("label")}`;
      },
      getInfo() {
        return `${this.model.get("name")}`;
      },
      updateTarget(target) {
        const customButton = this.model.get("content");
        target.set("content", customButton);
      },
    },
  });
  am.addType(types.card, {
    model: {
      defaults: {
        type: types.card,
        content: "",
        name: "Custom Card",
      },
      getName() {
        return this.get("name");
      },
    },
    view: {
      init() {
        this.className += " ".concat(this.pfx, types.card);
      },
      getPreview() {
        return `${this.model.get("label")}`;
      },
      getInfo() {
        return `${this.model.get("name")}`;
      },
      updateTarget(target) {
        const customButton = this.model.get("content");
        target.set("content", customButton);
      },
    },
  });
};
