GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

BUG: Select options are not displaying. Rather displaying as input #3735

Closed codingmachine16 closed 3 years ago

codingmachine16 commented 3 years ago

Hi @artf,

We are using select options as Traits but these are displaying as input. sometimes theese display options and sometimes displaying as input . Our code is below

    defaults: Object.assign({}, defaultModel.prototype.defaults, {
      traits: [
        {
          label: "Categories",
          name: "noOfCategories",
          id: "noOfCategories",
          type: "select",
          options: [
            {
              id: "0",
              name: "None",
            },

            {
              id: "1",
              name: "1",
            },
            {
              id: "2",
              name: "2",
            },
            {
              id: "3",
              name: "3",
            },
            {
              id: "4",
              name: "4",
            },
            {
              id: "5",
              name: "5",
            },
            {
              id: "6",
              name: "6",
            },
            {
              id: "7",
              name: "7",
            },
            {
              id: "8",
              name: "8",
            },
            {
              id: "9",
              name: "9",
            },
            {
              id: "10",
              name: "10",
            },
          ],
          changeProp: 1,
        },
        {
          label: "Links",
          name: "noOfLinks",
          id: "noOfLinks",
          type: "select",
          options: [
            {
              id: "0",
              name: "none",
            },
            {
              id: "1",
              name: "1",
            },
            {
              id: "2",
              name: "2",
            },
            {
              id: "3",
              name: "3",
            },
            {
              id: "4",
              name: "4",
            },
          ],
          changeProp: 1,
        },
      ],
    }),

image

calazans10 commented 3 years ago

@codingmachine16 and @artf I got the same error today.

Screen Shot 2021-09-01 at 15 30 44 Screen Shot 2021-09-01 at 15 32 14

artf commented 3 years ago

Weird thing, can anybody provide a simple reproducible demo as I'm not able to reproduce?

calazans10 commented 3 years ago

@artf Here's the demo. light-knee.surge.sh I did it using grapesjs-cli as I was trying to create my own plugin.

YumiChen commented 3 years ago

@artf Just to add that we bumped into this these 2 days as well. This seems only happen to version 0.17.25. Following is Jsfiddle for reproducing the issue, if needed please check: https://jsfiddle.net/a29h7twy/5/

Reproduce step:

  1. Drag a component into canvas
  2. Select the component and click settings button to check the traits
  3. Select trait is displayed as input. In dev tool console some warnings are shown
mmotov commented 3 years ago

Same for me in v0.17.22 and 0.17.25 Warning in the console when clicking on trait Screen Shot 2021-09-03 at 3 43 51 PM

sarelp commented 3 years ago

I have bumped into this same issue.

I think it is due to this.updatedCollection(); being called in the TraisView component. The result is that the traits aren't initialised.

I managed to fix it by removing the this.updatedCollection; and then updatedCollection it in trait_manager/index.js:

    render() {
      TraitsViewer && TraitsViewer.remove();
      TraitsViewer = new TraitsView({
        collection: [],
        editor: c.em,
        config: c
      });
      TraitsViewer.itemsView = types;
      TraitsViewer.updatedCollection();
      return TraitsViewer.render().el;
    },

Not sure if this is the right way to go about it but does solve the issue for me.

artf commented 3 years ago

Yes, you're right @sarelp It's actually wrong calling updatedCollection on initialize, I'll fix it in the next release.

codingmachine16 commented 3 years ago

Hi @artf

This issue is still there. When will this be fixed?

[Traits]: 'select' type not found {level: 'warning'}

codingmachine16 commented 3 years ago

When we drag component and click on the element on which traits are set , it shows input text instead of select box. On the other hand, after component drag, if we click on any other element and then click on that element which has traits then select box will display. very strange!

markovic-nikola commented 3 years ago

When we drag component and click on the element on which traits are set , it shows input text instead of select box. On the other hand, after component drag, if we click on any other element and then click on that element which has traits then select box will display. very strange!

I can confirm this is happening to me on 0.17.25 version also for types: select, number and checkbox.

codingmachine16 commented 3 years ago

This issue is averting us to deploy our projects . Need a fast solution.

markovic-nikola commented 3 years ago

@codingmachine16 If I'm not mistaken, the issue is already fixed, @artf just needs to push the new version.

artf commented 3 years ago

@codingmachine16 you have to wait for the release

codingmachine16 commented 3 years ago

OK . Sure. Thanks. For information, this issue does not exist on 0.17.22

markovic-nikola commented 3 years ago

OK . Sure. Thanks. For information, this issue does not exist on 0.17.22

Good to know, since I need to release it within a project soon.