1
1
import { Deck } from '../models/data/deck' ;
2
2
import { Doc } from '../models/data/doc' ;
3
3
import { Meta } from '../models/data/meta' ;
4
-
5
4
import { deckSelector } from './deck.utils' ;
6
5
import { docSelector } from './doc.utils' ;
7
6
import { getGoogleFontUrl , GoogleFont , googleFonts } from './fonts.utils' ;
@@ -30,36 +29,38 @@ export interface DocPublishData extends PublishData {
30
29
paragraphs : string [ ] ;
31
30
}
32
31
33
- export const deckPublishData = async ( { deck} : { deck : Deck } ) : Promise < DeckPublishData > => {
32
+ export const deckPublishData = async ( { deck, fallbackAuthor } : { deck : Deck ; fallbackAuthor : string } ) : Promise < DeckPublishData > => {
34
33
const { data} = deck ;
35
34
const { meta, background, footer, header} = data ;
36
35
37
36
return {
38
- ...( await publishData ( { meta, selector : deckSelector , fallbackName : data . name } ) ) ,
37
+ ...( await publishData ( { meta, selector : deckSelector , fallbackName : data . name , fallbackAuthor } ) ) ,
39
38
slides : getSlides ( ) ,
40
39
background : background ? `<div slot="background">${ background } </div>` : undefined ,
41
40
header : background ? `<div slot="header">${ header } </div>` : undefined ,
42
41
footer : background ? `<div slot="footer">${ footer } </div>` : undefined
43
42
} ;
44
43
} ;
45
44
46
- export const docPublishData = async ( { doc} : { doc : Doc } ) : Promise < DocPublishData > => {
45
+ export const docPublishData = async ( { doc, fallbackAuthor } : { doc : Doc ; fallbackAuthor : string } ) : Promise < DocPublishData > => {
47
46
const { data} = doc ;
48
47
const { meta} = data ;
49
48
50
49
return {
51
- ...( await publishData ( { meta, selector : docSelector , fallbackName : data . name } ) ) ,
50
+ ...( await publishData ( { meta, selector : docSelector , fallbackName : data . name , fallbackAuthor } ) ) ,
52
51
paragraphs : getParagraphs ( )
53
52
} ;
54
53
} ;
55
54
56
55
const publishData = async ( {
57
56
meta,
58
57
fallbackName,
58
+ fallbackAuthor,
59
59
selector
60
60
} : {
61
61
meta : Meta | undefined ;
62
62
fallbackName : string ;
63
+ fallbackAuthor : string ;
63
64
selector : string ;
64
65
} ) : Promise < PublishData > => {
65
66
const googleFontLink : string | undefined = getGoogleFontLink ( ) ;
@@ -76,7 +77,7 @@ const publishData = async ({
76
77
return {
77
78
title,
78
79
description : ( meta ?. description || fallbackName ) ?. trim ( ) ,
79
- author : meta ?. author ?. name || 'DeckDeckGo' ,
80
+ author : meta ?. author ?. name || fallbackAuthor ,
80
81
bio : meta ?. author ?. bio ,
81
82
photo_url : meta ?. author ?. photo_url ,
82
83
head_extra : head_extra . length > 0 ? head_extra . join ( '' ) : undefined ,
0 commit comments