1

第一次尝试将 PhotoEditorSDK 集成到 Angular 应用程序中时,我在控制台中看到了这个错误。

我的配置是:

const container = document.getElementById('editor');
const editor = new $window.PhotoEditorSDK.UI.DesktopUI({
    container: container,
    license: '{ .. }',
    assets: {
        baseUrl: '/js/pesdk/assets' // <-- This should be the absolute path to your `assets` directory
    },
    editor: {
        image: 'https://www.photoeditorsdk.com/assets/images/new/landingpage/platform_html5-4c8765e5.png',
    },
    style: {
        width: 500,
        height: 500,
    },
});

编辑器开始加载,许可调用成功完成,然后我看到:

react-dom.production.min.js:162 TypeError: t.addEventListener is not a function
    at e._loadSource (PhotoEditorSDK.js:6)
    at new e (PhotoEditorSDK.js:6)
    at e.setImage (PhotoEditorSDK.js:73)
    at e._setImage (PhotoEditorSDK.UI.DesktopUI.js:14)
    at c (PhotoEditorSDK.UI.DesktopUI.js:14)
    at e.setImage (PhotoEditorSDK.UI.DesktopUI.js:14)
    at e.componentDidMount (PhotoEditorSDK.UI.DesktopUI.js:27)
    at commitLifeCycles (react-dom.production.min.js:148)
    at b (react-dom.production.min.js:156)
    at t (react-dom.production.min.js:167)

未缩小的“开发”react-dom 文件看起来也缩小了,因此调试起来很痛苦。

4

1 回答 1

0

现在该image选项必须是实际的图像对象,而不是字符串 URL,这是错误的来源。因此,您需要首先加载图像,将其作为选项传递并加载编辑器。

如果您想结帐,有一个角度演示项目:

https://github.com/imgly/pesdk-angular-demo

于 2018-03-22T15:55:43.643 回答