Jump to content
pconkie

Bug or by design?

Recommended Posts

Very simple test case - skeleton widget with one widget preference defined.

Com.Frog.Utils.require(
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/assets/styles/main.css',
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/assets/views/main.ejs',
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/widget.ejs'
).then(function() {
    Com.Frog.Controllers.Widget.extend('Widget.Test', {
    }, {
         prefs: {
            file: {
                type: 'upload',
                label: "Select a File to Display",
                showDiscover: false,
                showClipboard: false,
                filter: ['image'],
                view: 'mini',
                sources: ['native']
            }
        },
        packageID: '66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B',
        /**
         * Constructor. Runs when the widget is first loaded.
         *
         * @method init
         */
        init: function() {},
        /**
         * Event fired by the Site Controller.
         *
         * @event 'widget.live'
         */
        'widget.live': function(el, ev, data) {
            this.element.html(
                this.view('main.ejs')
            );
            
        },
        /**
         * Event fired by the Site Controller. Tells the widget that the site is in Edit Mode.
         *
         * @event 'widget.edit'
         */
        'widget.edit': function(el, ev, data) {
            this.element.html(
                this.view('./widget.ejs')
            );        
        }
    });
});

When dragged on to a site the site fails to save unless a file has previously been selected.

Is there a way around this?

I would like to give teachers the option of loading a file into the widget, but if they want to start "with a clean slate" that would be fine too.....

 

Thanks

Paul

Link to comment
Share on other sites

If you add a defaultValue param to your prefs and set it to null, you may find that this works. Like below:

prefs: {
            file: {
                type: 'upload',
                label: "Select a File to Display",
                showDiscover: false,
                showClipboard: false,
                filter: ['image'],
                view: 'mini',
                sources: ['native'],
                defaultValue: null
            }
        },
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...