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?
Feature
- What is the current behavior?
- What is the proposed behavior?
an alternative to uploading an image to Netlify CMS, by referencing an external image instead.
This is partially possible by registering another editor component (see below), but this new editor component gets in conflict with the existing image editor component (as it's using the same pattern match). However, this component calls the toBlock function correctly when first added into the rich editor block, but after changing context, the text is matched to the existing image component.
CMS.registerEditorComponent({id: 'image_by_url',label: 'Image by URL',fields: [{name: 'url',label: 'Image URL',widget: 'string'},{name: 'alt',label: 'Alternative text',widget: 'string'}],pattern: /^!\[(.*)\]\((.*)\)$/,fromBlock: function(match){// Netlify CMS doesn't seem to execute this functionreturn{image: match[2],alt: match[1]};},toBlock: function(obj){varurl=obj.url||'';varalt=obj.alt||'';return'';},toPreview: function(obj){// Netlify CMS doesn't seem to execute this functionvarurl=obj.url||'';varalt=obj.alt||'';return'<img src="'+obj.url+'" alt="'+obj.alt+'" />';}});
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
- Do you want to request a feature or report a bug?
Feature
- What is the current behavior?
- What is the proposed behavior?
This is partially possible by registering another editor component (see below), but this new editor component gets in conflict with the existing image editor component (as it's using the same pattern match). However, this component calls the
toBlock
function correctly when first added into the rich editor block, but after changing context, the text is matched to the existing image component.The text was updated successfully, but these errors were encountered: