@symbo.ls/atoms 2.11.351 → 2.11.353

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.
Files changed (2) hide show
  1. package/Img.js +10 -1
  2. package/package.json +2 -2
package/Img.js CHANGED
@@ -4,7 +4,16 @@ export const Img = {
4
4
  tag: 'img',
5
5
 
6
6
  attr: {
7
- src: ({ props }) => props.src,
7
+ src: ({ props, context }) => {
8
+ const src = props.src
9
+ let isUrl
10
+ try { isUrl = new URL(src) } catch (e) {}
11
+ if (isUrl) return src
12
+ const file = context.files && context.files[src]
13
+ if (src.startsWith('/') && file) {
14
+ return file.content.src
15
+ }
16
+ },
8
17
  alt: ({ props }) => props.alt,
9
18
  title: ({ props }) => props.title || props.alt
10
19
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.351",
3
+ "version": "2.11.353",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "7467ad3cc2fb752e3a484df743e88422938756f7",
6
+ "gitHead": "c5d01a30797fc044b539a5309a879f6b249e3888",
7
7
  "dependencies": {
8
8
  "@domql/state": "latest",
9
9
  "@domql/utils": "latest",