安装照片编辑器SDK时出现问题



我们在网站上安装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>

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

然后,我们在索引处更改了JS文件名.html这与下载的文件不同。

<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.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>

最新更新