admin管理员组

文章数量:1122846

I have onlyoffice/documentserver launched with Docker. Here's my docker-compose.yml file:

services:
  # ... definition of other services
  onlyoffice:
    image: onlyoffice/documentserver
    restart: always
    ports:
      - 80:80

I'm trying to add a DocEditor to my webpage, here's html:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DocEditor</title>
    <script type="text/javascript" src="http://localhost:80/web-apps/apps/api/documents/api.js"></script>
    <script>
        console.log("log 1");
        const docEditor = new DocsAPI.DocEditor("placeholder", {
            documentType: "word",
            document: {
                fileType: "docx",
                title: "document.docx",
                url: "http://localhost:8000/document.docx",
            },
            editorConfig: {
                debug: true,
                mode: "edit",
                width: "100vw",
                height: "100vh",
                onError: function (error) {
                    console.error(error);
                },
                onDocumentReady: function () {
                    console.log("Document Ready");
                }
            }
        });
        console.log("log 2");
    </script>
</head>

<body>
    <div id="placeholder"></div>
</body>

</html>

Both http://localhost:80/web-apps/apps/api/documents/api.js and http://localhost:8000/document.docx are accessible; I can easily open them in a browser

But there is no DocEditor on a webpage, moreover, there are no logs in the console (only "log 1" and "log 2"). So what am I doing wrong?

本文标签: How to create a DocEditor with onlyofficedocumentserver running on DockerStack Overflow