安装photoeditorSDK时出现问题

时间:2018-01-08 15:30:24

标签: html5 photoeditorsdk

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

我们已按照以下说明操作:

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 

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

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

1 个答案:

答案 0 :(得分: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>