This repository was archived by the owner on Nov 21, 2023. It is now read-only.
File tree 1 file changed +12
-12
lines changed
admin/app/editor/shortcodes
1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
1
/* global CMS */
2
- import { image_src } from '../../fields/image-src .js'
3
- import { image_alt } from '../../fields/image-alt.js'
4
- import { legend } from '../../fields/legend .js'
5
- import { credit } from '../../fields/credit .js'
6
- import { t } from "../../i18n/translater.js" ;
2
+ import { credit } from '../../fields/credit .js' ;
3
+ import { image_alt } from '../../fields/image-alt.js' ;
4
+ import { image_src } from '../../fields/image-src .js' ;
5
+ import { legend } from '../../fields/legend .js' ;
6
+ import { t } from "../../i18n/translater.js" ;
7
7
8
8
CMS . registerEditorComponent ( {
9
9
id : 'figure' ,
@@ -14,19 +14,19 @@ CMS.registerEditorComponent({
14
14
legend ,
15
15
credit
16
16
] ,
17
- pattern : / { { < f i g u r e ( .* ?) > } } / ,
17
+ pattern : / { { < f i g u r e s r c = " ( .* ?) " a l t = " ( . * ? ) " l e g e n d = " ( . * ? ) " c r e d i t = " ( . * ? ) " > } } / ,
18
18
fromBlock : function ( match ) {
19
19
return {
20
- src : match [ 1 ] ,
21
- alt : match [ 2 ] ,
22
- legend : match [ 3 ] ,
23
- credit : match [ 4 ]
20
+ src : match [ 1 ] ?? '' ,
21
+ alt : match [ 2 ] ?? '' ,
22
+ legend : match [ 3 ] ?? '' ,
23
+ credit : match [ 4 ] ?? ''
24
24
} ;
25
25
} ,
26
26
toBlock : function ( obj ) {
27
- return `{{< figure src="${ obj . src } " alt="${ obj . alt } " legend="${ obj . legend } " credit="${ obj . credit } " >}}` ;
27
+ return `{{< figure src="${ obj . src ?? '' } " alt="${ obj . alt ?? '' } " legend="${ obj . legend ?? '' } " credit="${ obj . credit ?? '' } " >}}` ;
28
28
} ,
29
29
toPreview : function ( obj ) {
30
- return `{{< figure src="${ obj . src } " alt="${ obj . alt } " legend="${ obj . legend } " credit="${ obj . credit } " >}}` ;
30
+ return `{{< figure src="${ obj . src ?? '' } " alt="${ obj . alt ?? '' } " legend="${ obj . legend ?? '' } " credit="${ obj . credit ?? '' } " >}}` ;
31
31
}
32
32
} ) ;
You can’t perform that action at this time.
0 commit comments