ONLYOFFICE / sdkjs-plugins

The add-ons for ONLYOFFICE Document Server and ONLYOFFICE Desktop Editors.
https://www.onlyoffice.com
Apache License 2.0
136 stars 134 forks source link

Method "GetCurrentContentControlPr" return minified data #91

Closed flaminestone closed 4 years ago

flaminestone commented 4 years ago

Method "GetCurrentContentControlPr" return minified data. I think, it is wrong behaveor, data is must be full

Return example:

 {"Ga":100,"Mw":"CC_Tag","aA":"","vf":3,"fbb":"8_838","yYd":1,"Ux":1}

Plugin code example

(function(window, undefined) {
  window.Asc.plugin.init = function() {
    var type = 1;
    var properties = {
      "Id": 100,
      "Tag": "CC_Tag",
      "Lock": 3
    };
    window.Asc.plugin.executeMethod("AddContentControl", [type, properties], function() {

          window.Asc.plugin.executeMethod("GetCurrentContentControlPr", [], function (result) {
            console.log("Result: " + JSON.stringify(result))
            window.Asc.plugin.executeCommand("close", '')
          });
    });
  };
})(window, undefined);

Version: 5.3.2 (build:20)

tsmgodoi commented 4 years ago

I'm also having a lot of trouble with some APIs returning minified data. I think those core API methods and properties shouldn't be minified. For example, most of the methods of the asc_docs_api class are minified. Please don't minify those public methods and properties, so we can have access to more features of the editor through plugins.

tsmgodoi commented 4 years ago

@flaminestone any chance you guys could change it to not obfuscate the code. We really need to develop more advanced plugins but the obfuscated property names which get returned are really blocking us. Note: we have a corporate license.

flaminestone commented 4 years ago

@tsmgodoi, I agree with you, this problem really complicates plugin development. We will fix it in one of the upcoming versions. If you have a corporate license, you can write to sales@onlyoffice.com to speed up this process.

tsmgodoi commented 4 years ago

@flaminestone, I've managed to build the web-apps and sdkjs modules not obfuscating the js code, but minimizing it. The PR https://github.com/ONLYOFFICE/web-apps/pull/405 contains the changes I did to the web-apps to accomplish it. As for the sdkjs module, you can parameterize the grunt command with "--level=WHITESPACE_ONLY", so the closure-compiler will not obfuscate the code. We really could use those changes, because we're developing more complex plugins, which will need access to some of the obfuscated APIs.

K0R0L commented 4 years ago

Fixed https://github.com/ONLYOFFICE/sdkjs/commit/85e50e9ffc81639e78b95b589cc8a3a8fdaf4a66

K0R0L commented 4 years ago

tsmgodoi, we do not open all api, because not all methods are safe to use, calling "whatever". Always help/expand api for the necessary functionality. please contact us