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

Support OnlyOffice viewer #14

Open
spoorun opened this issue Dec 18, 2020 · 5 comments
Open

Support OnlyOffice viewer #14

spoorun opened this issue Dec 18, 2020 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@spoorun
Copy link

spoorun commented Dec 18, 2020

OnlyOffice is an increasingly popular opensource viewer, which can be hosted on one's own server.
It would be ideal to include this as an option.

@jfcherng jfcherng added enhancement New feature or request help wanted Extra attention is needed labels Dec 31, 2020
@jfcherng
Copy link
Member

jfcherng commented Dec 31, 2020

I don't mind to have it included but I didn't have an experience with it so 🤷

Pull Request welcome. Or someone can provide patterns for viewing external online files.

@gentoosys
Copy link

@jfcherng
Copy link
Member

Is there a public/anonymous OnlyOffice viewer which can be used as test purpose?

@gentoosys
Copy link

It can be easily installed with docker
docker run --name oo -i -t -d -p 8081:80 onlyoffice/documentserver

@gentoosys
Copy link

gentoosys commented Nov 14, 2023

docker run --name oo --restart=always -i -t -d -p 8081:80 -e JWT_ENABLED=false -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver

updated code

<script type="text/javascript" src="%ONLYOFFICE%/web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript" charset="utf-8">
	const queryString = window.location.search;
	const urlParams = new URLSearchParams(queryString);

function get_url_extension( url ) {
	    return url.split(/[#?]/)[0].split('.').pop().trim();
}

    function LoadEditor(){
    Editor = new DocsAPI.DocEditor("office", {
        width: "100%",
        height: "100%",
        type: "embedded",
        embedded: {
            toolbarDocked: "bottom",
        },
        lang:   "en",
        mode:   "view",
        region: "en-US",
        token: "my_jwt_secret",
	
        document: {
            fileType: get_url_extension(urlParams.get('uri')),
            url: urlParams.get('uri'),
            title: ' ',
        },
    });
    console.log(Editor);
    }
    if (window.addEventListener) {
        window.addEventListener("load", LoadEditor);
    } else if (window.attachEvent) {
        window.attachEvent("load", LoadEditor);
    }
    </script>
    </head>
    <body id="odfcanvas">
            <div id="office"></div>
    </body>

working well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants