@contentful/field-editor-markdown 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-markdown@1.0.1...@contentful/field-editor-markdown@1.0.2) (2021-12-03)
7
+
8
+ ### Bug Fixes
9
+
10
+ - markdown upload asset domain url to ctfasset.net [] ([#946](https://github.com/contentful/field-editors/issues/946)) ([21ef606](https://github.com/contentful/field-editors/commit/21ef606e941feff1e8db1189c9cb48f9a82728a0))
11
+
6
12
  ## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-markdown@1.0.0...@contentful/field-editor-markdown@1.0.1) (2021-11-17)
7
13
 
8
14
  ### Bug Fixes
@@ -29,6 +29,7 @@ var Markdown = _interopDefault(require('markdown-to-jsx'));
29
29
  var DOMPurify = _interopDefault(require('dompurify'));
30
30
  var inRange = _interopDefault(require('lodash/inRange'));
31
31
  var isObject = _interopDefault(require('lodash/isObject'));
32
+ var hostnameTransformer = require('@contentful/hostname-transformer');
32
33
  var extend = _interopDefault(require('lodash/extend'));
33
34
  var isString = _interopDefault(require('lodash/isString'));
34
35
  var isFinite = _interopDefault(require('lodash/isFinite'));
@@ -3604,10 +3605,17 @@ function makeAssetLink(asset, _ref) {
3604
3605
 
3605
3606
  if (isObject(file) && file.url) {
3606
3607
  var title = get(asset, ['fields', 'title', localeCode]) || get(asset, ['fields', 'title', fallbackCode || '']) || get(asset, ['fields', 'title', defaultLocaleCode]) || fileNameToTitle(file.fileName);
3608
+ var assetDomainMap = {
3609
+ images: 'images.ctfassets.net',
3610
+ assets: 'assets.ctfassets.net',
3611
+ downloads: 'downloads.ctfassets.net',
3612
+ videos: 'videos.ctfassets.net'
3613
+ };
3614
+ var fileUrl = hostnameTransformer.toExternal(file.url, assetDomainMap);
3607
3615
  return {
3608
3616
  title: title,
3609
3617
  asset: asset,
3610
- url: file.url,
3618
+ url: fileUrl,
3611
3619
  // is normally localized and we should not warn about this file
3612
3620
  isLocalized: Boolean(localizedFile),
3613
3621
  // was fallback value used
@@ -3615,7 +3623,7 @@ function makeAssetLink(asset, _ref) {
3615
3623
  // it means we used a default locale - we filter empty values
3616
3624
  isFallback: Boolean(fallbackFile),
3617
3625
  // todo: tranform using fromHostname
3618
- asMarkdown: "![" + title + "](" + file.url + ")"
3626
+ asMarkdown: "![" + title + "](" + fileUrl + ")"
3619
3627
  };
3620
3628
  } else {
3621
3629
  return null;