Issue #2748Opened April 30, 2020by jsychova1 reactions

[FEATURE REQUEST][BUG] Slider doesn't work with a non-integer step value

Question

Default StyleManager property "slider" doesn't work with a non-integer step value. GrapesJS version: 0.16.1

In many cases, it’s convenient to use a slider with a non-integer step value: GrapesJS

seems that Grapesjs supports only integer and rounds non-integer values.

Steps to reproduce: Add a property with type 'slider'

var property = styleManager.addProperty('mySector',{
   name: 'Opacity',
   type: 'slider',
   property: 'opacity',
   defaults: 1,
   step: 0.1,
   max: 1,
   min: 0,
   }, { at: 0 });

Answers (3)

adamwpeApril 30, 20201 reactions

Ah, you mean the arrows - sorry, thought you meant in general that the slider doesn't work.

image

Never noticed that - always use the slider order the mouse dragging over the arrows.

I'll have a look at the view - not too sure where to start haha.

adamwpeApril 30, 20200 reactions

Oddly enough - this works for me (I know I'm creating the sector at the same time):

        editor.StyleManager.addSector('General',{
            name: 'Extras',
            open: false,
            properties: [{
                property: 'opacity',
                type: 'slider',
                defaults: 1,
                step: 0.01,
                max: 1,
                min: 0
            }]
        }, { at: 9 });

Can you make a demo?

jsychovaApril 30, 20200 reactions

Yes of course. I've created a sample with your snippet, but seems that it doesn't want to work with me.

https://codepen.io/sjul66/pen/VwvMwNY

Thanks!

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.