简体   繁体   中英

TinyMCE slider max and min value

I want to change the font with a slider in my editor, however I cannot set max-ariavalue. The slider works with the default tinyMCE editor manager.

                // Open window
                editor.windowManager.open({
                    title: 'font resize',
                    body: [
                        {type: 'slider', name: 'size', label: 'Size', value: 50, max: 200}
                    ],
                    onsubmit: function(e) {
                        node = tinymce.activeEditor.selection.getNode();
                        execFontSize(e.data['size'], 'px', node);
                    }
                });

The max doesn't seem to work. I also tried "aria-valuemax" etc. Is it possible to change it, our do I have to "hack it" with JS?

The attributes you need are minValue and maxValue (as opposed to min and max ).

For example:

editor.windowManager.open({ 
    title: 'font resize', 
    body: [ 
      {
         type: 'slider', 
         name: 'size', 
         label: 'Size', 
         value: 30, 
         minValue: 25, 
         maxValue: 50
      } 
    ], 
    ...  
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM