How to use the @deckdeckgo/deck-utils.convertStyle function in @deckdeckgo/deck-utils

To help you get started, we’ve selected a few @deckdeckgo/deck-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deckgo / deckdeckgo / studio / src / app / utils / editor / parse-slides.utils.tsx View on Github external
return new Promise(async (resolve) => {
            if (!document) {
                resolve();
                return;
            }

            // Create a div to parse back to JSX its children
            const div = document.createElement('div');
            div.innerHTML = slide.data.content;

            const content = await ParseElementsUtils.parseElements(div, true, contentEditable);

            const attributes = {
                style: slide.data.attributes ? await convertStyle(slide.data.attributes.style) : undefined,
                src: slide.data.attributes && slide.data.attributes.src ? slide.data.attributes.src : undefined,
                'custom-background': slide.data.attributes && slide.data.attributes.customBackground ? slide.data.attributes.customBackground : undefined,
                'img-src': slide.data.attributes && slide.data.attributes.imgSrc ? slide.data.attributes.imgSrc : undefined,
                'img-alt': slide.data.attributes && slide.data.attributes.imgAlt ? slide.data.attributes.imgAlt : undefined
            };

            if (slide.data.template === SlideTemplate.QRCODE) {
                attributes['content'] = slide.data.attributes && slide.data.attributes.content ? slide.data.attributes.content : QRCodeUtils.getPresentationUrl(deck);
                attributes['custom-qrcode'] = slide.data.attributes && slide.data.attributes.content ? 'true' : undefined;
            }

            if (slide.data.template === SlideTemplate.CHART) {
                attributes['type'] = slide.data.attributes && slide.data.attributes.type ? slide.data.attributes.type : undefined;
                attributes['inner-radius'] = slide.data.attributes && slide.data.attributes.innerRadius ? slide.data.attributes.innerRadius : undefined;
                attributes['animation'] = slide.data.attributes && slide.data.attributes.animation ? slide.data.attributes.animation : undefined;
                attributes['date-pattern'] = slide.data.attributes && slide.data.attributes.datePattern ? slide.data.attributes.datePattern : undefined;
github deckgo / deckdeckgo / studio / src / app / pages / editor / app-editor / app-editor.tsx View on Github external
this.deckEditorService.watch().pipe(take(1)).subscribe(async (deck: Deck) => {
                if (deck && deck.data && deck.data.attributes && deck.data.attributes.style) {
                    this.style = await convertStyle(deck.data.attributes.style);
                } else {
                    this.style = undefined;
                }

                if (deck && deck.data && deck.data.attributes && deck.data.attributes.transition) {
                    this.transition = deck.data.attributes.transition;
                }

                this.background = await ParseBackgroundUtils.convertBackground(deck.data.background, true);

                resolve();
            });
        });
github deckgo / deckdeckgo / studio / src / app / utils / editor / parse-elements.utils.tsx View on Github external
return new Promise(async (resolve) => {
            const Elem: string = element.nodeName.toLowerCase();

            const attributes: any = this.getAttributes(element);
            if (attributes.style) {
                attributes.style = await convertStyle(attributes.style);
            }

            if (contentEditable && this.isContentEditable(element, attributes)) {
                if (contentEditable && SlotUtils.isNodeReveal(element) && element.firstElementChild) {
                    element.firstElementChild.setAttribute('contenteditable', `${true}`);
                } else {
                    attributes['contenteditable'] = true;
                }
            }

            resolve({content});
        });
    }
github deckgo / deckdeckgo / remote / src / app / utils / parse-elements.utils.tsx View on Github external
return new Promise(async (resolve) => {
            const Elem: string = element.nodeName.toLowerCase();

            const attributes: any = this.getAttributes(element);
            if (attributes.style) {
                attributes.style = await convertStyle(attributes.style);
            }

            resolve({content});
        });
    }
github deckgo / deckdeckgo / remote / src / app / utils / parse-attributes.utils.tsx View on Github external
return new Promise(async (resolve) => {
            const attr: any = {};

            if (attributes && attributes.length > 0) {
                for (const def of attributes) {
                    if (def.name === 'style') {
                        attr['style'] = await convertStyle(def.value);
                    } else {
                        attr[def.name] = def.value;
                    }
                }
            }

            resolve(attr);
        })
    }
github deckgo / deckdeckgo / studio / src / app / pages / core / app-dashboard / app-dashboard.tsx View on Github external
return new Promise(async (resolve) => {
            try {
                const slide: Slide = await this.slideService.get(deck.id, slideId);
                const element: JSX.IntrinsicElements = await ParseSlidesUtils.parseSlide(deck, slide, false);

                let style: any;
                if (deck.data && deck.data.attributes && deck.data.attributes.style) {
                    style = await convertStyle(deck.data.attributes.style);
                } else {
                    style = undefined;
                }

                const background: any = await ParseBackgroundUtils.convertBackground(deck.data.background, false);

                resolve({
                    deck: deck,
                    slide: element,
                    style: style,
                    background: background
                });
            } catch (err) {
                resolve(undefined);
            }
        });

@deckdeckgo/deck-utils

Utils for the DeckDeckGo presentations

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis