Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit aac2645

Browse files
feat: redo description from first slide
1 parent 4a57980 commit aac2645

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

studio/src/app/modals/editor/app-publish/app-publish.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Element, Listen, State} from '@stencil/core';
1+
import {Component, Element, Listen, Prop, State} from '@stencil/core';
22

33
import {take} from 'rxjs/operators';
44

@@ -22,11 +22,11 @@ export class AppPublish {
2222

2323
private authService: AuthService;
2424

25-
@State()
26-
private caption: string;
25+
@Prop()
26+
description: string;
2727

2828
@State()
29-
private description: string;
29+
private caption: string;
3030

3131
@State()
3232
private author: string;

studio/src/app/pages/editor/app-editor/app-editor.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,24 @@ export class AppEditor {
304304
});
305305
}
306306

307+
private getFirstSlideContent(): Promise<string> {
308+
return new Promise<string>(async (resolve) => {
309+
let content: string = '';
310+
311+
const slide: HTMLElement = this.el.querySelector('deckgo-deck > *:first-child');
312+
313+
if (slide && slide.tagName && slide.tagName.toLowerCase().indexOf('deckgo-slide') > -1) {
314+
const contentElement: HTMLElement = slide.querySelector('[slot="content"]');
315+
316+
if (contentElement) {
317+
content = contentElement.textContent;
318+
}
319+
}
320+
321+
resolve(content);
322+
});
323+
}
324+
307325
@Listen('actionOpenSlideAdd')
308326
async onActionOpenSlideAdd($event: CustomEvent) {
309327
if (!$event || !$event.detail) {
@@ -371,8 +389,13 @@ export class AppEditor {
371389
return;
372390
}
373391

392+
const content: string = await this.getFirstSlideContent();
393+
374394
const modal: HTMLIonModalElement = await this.modalController.create({
375-
component: 'app-publish'
395+
component: 'app-publish',
396+
componentProps: {
397+
description: content
398+
}
376399
});
377400

378401
modal.onDidDismiss().then(async (_detail: OverlayEventDetail) => {

studio/src/components.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import '@stencil/core';
99

1010
import '@ionic/core';
11+
import 'ionicons';
1112
import 'deckdeckgo';
1213
import 'deckdeckgo-inline-editor';
13-
import 'ionicons';
1414
import {
1515
EventEmitter,
1616
} from '@stencil/core';
@@ -120,8 +120,12 @@ export namespace Components {
120120
interface AppGif {}
121121
interface AppGifAttributes extends StencilHTMLAttributes {}
122122

123-
interface AppPublish {}
124-
interface AppPublishAttributes extends StencilHTMLAttributes {}
123+
interface AppPublish {
124+
'description': string;
125+
}
126+
interface AppPublishAttributes extends StencilHTMLAttributes {
127+
'description'?: string;
128+
}
125129

126130
interface AppSlideNavigate {
127131
'slides': string[];

0 commit comments

Comments
 (0)