Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Lucidchart #12

Open
hampussanden opened this issue Oct 6, 2023 · 4 comments
Open

Add support for Lucidchart #12

hampussanden opened this issue Oct 6, 2023 · 4 comments

Comments

@hampussanden
Copy link

I would really like to have support for embeddings of the tool https://www.lucidchart.com/. It should like this example: https://help.nuclino.com/a5bfb729-embed-diagrams-from-lucidchart

Let me know if you if you need more info or a link to an example chart .

@craftzdog
Copy link
Contributor

I've personally never used Lucidchart and don't know how popular it is to decide if I should support it.
Pull requests would be appreciated!

@0NotApplicable0
Copy link
Contributor

I don't think this is possible due to Lucidchart CSP settings.
Following this to allow embeds on a document you then get some code:

<div style="width: 640px; height: 480px; margin: 10px; position: relative;"><iframe allowfullscreen frameborder="0" style="width:640px; height:480px" src="https://lucid.app/documents/embedded/75ce5af1-9646-45da-883b-70e0ed447672" id="V7HPwtSW.1Zv"></iframe></div>

Then if you pull out the URL https://lucid.app/documents/embedded/75ce5af1-9646-45da-883b-70e0ed447672

And try to use it, this error shows up: Refused to frame 'https://lucid.app/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors https: http:".

If anyone has any ideas/more knowledge on CSP?

Here is my code.

import * as React from 'react'
import {useRef, useState} from 'react'

const BASE_URL = 'https://lucid.app/'
const EMBED_PROVIDER_URL = 'https://lucid.app/documents/embedded/'

// https://lucid.app/documents/embedded/75ce5af1-9646-45da-883b-70e0ed447672

export function test(url) {
    return url.startsWith(BASE_URL)
}

export default function Lucidchart(props) {
    const {href} = props
    const contentFrame = useRef()
    const [frameId] = useState('lucidchart-' + Math.random())
    const chartId = href.substring(href.lastIndexOf('/') + 1);
    const url = `${EMBED_PROVIDER_URL}${chartId}`

    console.log("ChartID: " + chartId);
    console.log("URL: ", url);

    return (
        // <div style={{width: "640px", height: "480px", margin: "10px", position: "relative"}}>
        //     <iframe
        //         allowFullScreen
        //         frameBorder="0"
        //         style={{width: "640px", height: "480px"}}
        //         className="embed-frame"
        //         ref={contentFrame}
        //         src={url}
        //         id={frameId}
        //     >
        //     </iframe>
        // </div>

        <div style={{width: "640px", height: "480px", margin: "10px", position: "relative"}}>
            <iframe allowFullScreen frameBorder="0" style={{width: "640px", height: "480px"}}
                    src="https://lucid.app/documents/embedded/75ce5af1-9646-45da-883b-70e0ed447672"
                    id="V7HPwtSW.1Zv"></iframe>
        </div>
    )
}

@craftzdog
Copy link
Contributor

that is because Electron's origin URL protocol is file:.
So, you have to host a page that loads the embedded iframe...which sounds awkward though.

@0NotApplicable0
Copy link
Contributor

Hmm, okay. I guess I can try some things, see if I can get it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants