You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Do you want to request a feature or report a bug?
bug
- What is the current behavior?
string Fields in editor components that specify the default option don't get populated with the default value when a new component is added. Seems to happen with all widgets (I tried with string, number, and boolean).
- If the current behavior is a bug, please provide the steps to reproduce.
Declare an editor component that contains a field with a default:
CMS.registerEditorComponent({id: "youtube",label: "Youtube",fields: [{name: 'id',label: 'Youtube Video ID',widget: 'string',default: 'dQw4w9WgXcQ'}],pattern: /^youtube(\S+)$/,fromBlock: function(match){return{id: match[1]};},toBlock: function(obj){return'youtube '+obj.id;},// Preview output for this component. Can either be a string or a React component// (component gives better render performance)toPreview: function(obj){return('<img src="http://img.youtube.com/vi/'+obj.id+'/maxresdefault.jpg" alt="Youtube Video"/>');}});
Add an instance of the component to a markdown editor
Observe that the field is empty rather than being populated with the default value.
- What is the expected behavior?
That the field is populated with the specified default value, similar to how default values work for fields defined on collections.
As a sidecar feature request, it would be nice to be able to specify the default value as a function that returns it -- I would like to use a hidden field for automatically generating a uuid.
Don't know if that's related, but when you don't put something in a text or string field, it outputs "undefined" instead of an empty string as described in the docs:
default: accepts a string; defaults to an empty string
That means there is no way of adding a custom editor component where a field can just be left out by the user, which is really annoying
- Do you want to request a feature or report a bug?
bug
- What is the current behavior?
string
Fields in editor components that specify thedefault
option don't get populated with the default value when a new component is added. Seems to happen with all widgets (I tried withstring
,number
, andboolean
).- If the current behavior is a bug, please provide the steps to reproduce.
default
:Observe that the field is empty rather than being populated with the default value.
- What is the expected behavior?
That the field is populated with the specified default value, similar to how default values work for fields defined on collections.
As a sidecar feature request, it would be nice to be able to specify the default value as a function that returns it -- I would like to use a hidden field for automatically generating a uuid.
- Please mention your versions where applicable.
Netlify CMS version: 1.8.4
Browser version: Chrome 67.0.3396.62/OSX
Node.JS version: 9.5.0
Operating System: OSX 10.13.4 (High Sierra)
- Please link or paste your
config.yml
below if applicable.The text was updated successfully, but these errors were encountered: