0

我们在我们的网站twin-meme.com安装 photoeditorSDK 时发现了一些问题。

我们已遵循以下说明:

https://docs.photoeditorsdk.com/guides/html5/v4-DesktopUI/introduction/getting_started

<!DOCTYPE html>
<html>
  <head>
    <!-- React Dependencies for the SDK UI -->
    <script src="js/vendor/react.min.js"></script>
    <script src="js/vendor/react-dom.min.js"></script>
    <!-- PhotoEditor SDK-->
    <script src="js/PhotoEditorSDK.min.js"></script>
    <!-- PhotoEditor SDK UI -->
    <script src="js/PhotoEditorDesktopUI.min.js"></script>
    <link rel="stylesheet" href="css/PhotoEditorDesktopUI.min.css" />
  </head>

  <body>
    <div id="editor" style="width: 100vw; height: 100vh;"></div>
    <script>
      window.onload = function () {
        var container = document.getElementById('editor')
        var editor = new PhotoEditorSDK.UI.DesktopUI({
          container: container,
          license: 'YOUR_LICENSE', // <-- Please replace this with your license. Please make sure this is in *string* format, not *object*.
          assets: {
            baseUrl: '/assets' // <-- This should be the absolute path to your `assets` directory
          }
        })
      }
    </script>
  </body>
</html>

显然,我们更新了许可证;)

然后,我们更改了 index.html 中与下载文件不同的 JS 文件名。

<script src="js/PhotoEditorSDK.UI.DesktopUI.js"></script>
<link charset='utf-8' rel="stylesheet" href="css/PhotoEditorSDK.UI.DesktopUI.css" />

我们发现以下错误消息:

TypeError: t is undefined
PhotoEditorSDK.UI.DesktopUI.js:7:2237

之后,我们添加了默认图像以解决此问题:

var editor = new PhotoEditorSDK.UI.DesktopUI({
container: container,
license: 'MY_LICENSE', // <-- Please replace this with your license. Please make sure this is in *string* format, not *object*.
assets: {
baseUrl: '/assets' // <-- This should be the absolute path to your `assets` directory
},
editor: {
image: '/assets/test.png'
}
});

但随后,我们收到了另一条错误消息:

TypeError: e.addEventListener is not a function
PhotoEditorSDK.js:9:1859 

有谁知道如何解决这个问题?每次我们解决一些错误都会出现另一个错误。这真是令人沮丧:(

有人有任何在线演示项目吗?这将有助于我们了解正在发生的事情。

4

1 回答 1

0

您使用的是版本 4.1.4 https://github.com/imgly/pesdk-html5-build/tree/v4.1.4/js吗?

看来我们的文档不正确。我会相应地更新它们。

该错误似乎是由于 SDK 本身(而不是 UI)未正确加载造成的。

请试试这个

 <head>
    <!-- React Dependencies for the SDK UI -->
    <script src="js/vendor/react.min.js"></script>
    <script src="js/vendor/react-dom.min.js"></script>
    <!-- PhotoEditor SDK-->
    <script src="js/PhotoEditorSDK.js"></script>
    <!-- PhotoEditor SDK UI -->
    <script src="js/PhotoEditorSDK.UI.DesktopUI.js"></script>
    <link rel="stylesheet" href="css/PhotoEditorSDK.UI.DesktopUI.css" />
  </head>
于 2018-01-11T16:32:38.100 回答