Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InsertAndReplaceContentControls don't load images with CreateImage #172

Open
lorenzoale opened this issue Aug 12, 2022 · 3 comments
Open
Assignees
Labels
confirmed-bug Issues with confirmed bugs

Comments

@lorenzoale
Copy link

Do you want to request a feature or report a bug?

What is the current behavior?
When I use createimage with CallCommand, the image is created (either with url as the example:
Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000);
or with base64)
However when I add the same line of code inside InsertAndReplaceContentcontrols script, it creates the control, but doesn't load the image, even if it allows me to load it afterwards. I may be doing something wrong?
The idea is to replace several content controls dinamycally by texts or images. I could do it one by one going through the content controls in this case I would need to deal with the callbacks after each replacement. The insertAndReplace seems to be perfect for this task.
I tried:

  • creating a picture control:
    window.Asc.plugin.executeMethod("AddContentControlPicture", [{"Lock" : 3}]);
  • creating a normal one:
    window.Asc.plugin.executeMethod("AddContentControl", [2, {"Lock" : 3}]);
    And then
  • the script :
    _script = "var oDocument = Api.GetDocument(); var oParagraph =Api.CreateParagraph();var oDrawing = Api.CreateImage('https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png', 60 * 36000, 35 * 36000); oParagraph.AddDrawing(oDrawing); oDocument.InsertContent([oParagraph]);";
  • or the script inserts the image inside the control:
    _script = "var oDocument = Api.GetDocument(); var oDrawing = Api.CreateImage('https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png', 60 * 36000, 35 * 36000); oDrawing.InsertInContentControl(1);";
  • or even others combinations.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior?

Which versions of sdkjs-plugins, and which browser / OS are affected by this issue? Did this work in previous versions of sdkjs-plugins?
As recomended I installed 7.1.1
Many thanks in advance

@askonev
Copy link
Member

askonev commented Aug 15, 2022

@lorenzoale Hi! At the moment there is no way to install an image using the InsertAndReplaceContentControls method. Created a bug #58521 in our private repository.

@askonev askonev added the confirmed-bug Issues with confirmed bugs label Aug 15, 2022
@fr3fou
Copy link

fr3fou commented Apr 12, 2023

Any updates on this?

@zahari00
Copy link

Any updates?

@askonev askonev self-assigned this Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs
Projects
None yet
Development

No branches or pull requests

5 participants