sdkjs-plugins icon indicating copy to clipboard operation
sdkjs-plugins copied to clipboard

GetAllOleObjects returned undefined

Open elkon028 opened this issue 1 year ago • 0 comments

https://api.onlyoffice.com/plugin/executemethod/text/getalloleobjects

  • config.json
{
  "name": "report",
  "guid": "asc.{4B8FEA54-6EDA-1B1B-EF2F-EF9F12248E44}",
  "version": "1.0.0",
  "baseUrl": "",

  "variations": [
    {
      "description": "test report",
      "url": "index.html",

      "icons": ["resources/light/icon.png", "resources/light/[email protected]"],
      "icons2": [
        {
          "style": "light",
          "100%": {
            "normal": "resources/light/icon.png"
          },
          "125%": {
            "normal": "resources/light/[email protected]"
          },
          "150%": {
            "normal": "resources/light/[email protected]"
          },
          "175%": {
            "normal": "resources/light/[email protected]"
          },
          "200%": {
            "normal": "resources/light/[email protected]"
          }
        },
        {
          "style": "dark",
          "100%": {
            "normal": "resources/dark/icon.png"
          },
          "125%": {
            "normal": "resources/dark/[email protected]"
          },
          "150%": {
            "normal": "resources/dark/[email protected]"
          },
          "175%": {
            "normal": "resources/dark/[email protected]"
          },
          "200%": {
            "normal": "resources/dark/[email protected]"
          }
        }
      ],

      "EditorsSupport": ["word"],
      "isSystem": false,
      "isViewer": false,
      "isVisual": true,
      "isModal": true,
      "isInsideMode": false,

      "initDataType": "none",
      "initData": "",

      "size": [700, 10000]
    }
  ]
}
  • code.js
// ....
plugin.init = function () {
  var plugin = window.Asc.plugin
  plugin.init = function () {
    plugin.executeMethod ("GetAllOleObjects", [plugin.guid], function (data) {
        console.info('GetAllOleObjects', data)  // data is undefined
    });
  }
}

// OR

plugin.init = function () {
  var plugin = window.Asc.plugin
  var image = {
    data: '',
    imgSrc: 'https://fanyi-cdn.cdn.bcebos.com/static/translation/img/header/logo_e835568.png',
    guid: plugin.guid,
    "width": 70,
    "height": 70,
    "widthPix": 60 * 36000,
    "heightPix": 60 * 36000
  }

  plugin.executeMethod('AddOleObject', [image], function () {
    plugin.executeMethod('GetAllOleObjects', [plugin.guid], function (data) {
      console.info('GetAllOleObjects', data)  // data is undefined
    })
  })
}

data is undefined, why?

elkon028 avatar Jul 07 '23 10:07 elkon028