-
Notifications
You must be signed in to change notification settings - Fork 134
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
call to callCommand with different selections #174
Comments
@lorenzoale Hi! Yes, at the moment there is a technical limitation that you cannot change the content control while it is selected.
I could not reproduce this problem. Can you send a test example of the document and the plugin on which this scenario is reproduced?
I think at the moment your solution is the best, if you want to implement in the body of the builder code first remove all elements, save one in memory and then put it back into the document. |
@askonev Hello, thanks for your answer. window.Asc.plugin.executeMethod("MoveCursorToEnd",
[true],
function(){
window.Asc.plugin.callCommand(
function() {
var oDocument = Api.GetDocument();
var contenu_CC=null;
var aContentControls = oDocument.GetAllContentControls();
for (var i = 0; i < aContentControls.length; i++) {
var tagName=aContentControls[i].GetTag();
if (tagName== "{content}"){
contenu_CC=aContentControls[i];
}
}
oDocument.RemoveAllElements();
oDocument.InsertContent([contenu_CC]);
},
false,
true,
function(){
}
);
}
); However I had to add call to the method MoveCursorToEnd because if the image in the conent control was selected before calling to this piece of code, everything is removed. Thanks, Alejandra. |
@lorenzoale I'm sorry, but your request is very hard to read and it take a lot of time to understand tham, please provide more readable piceces of code and more detailed description. I have not enought free time to help you if I need to format your code and dig in that myself |
@askonev I'm really sorry for the inconvenients. You do not need to test, I got the idea and I know how to overcome my problem. I edited the previous comment and tried to make it clearer anyway. Thanks again for your help. |
I close this issue. Feel free to comment or reopen it if you got further questions. |
Do you want to request a feature or report a bug?
What is the current behavior?
I need to get the content of a given control content with a given tag, let's say tag={content}. To do this I just remove all other elements from the document, but first I copy the content control. Then, after removing all elements I insert the control content.
The problem:
is that when there is an image inside this content control, and the image is selected (because it was the last action that the user did), it just removes everything.
In a similar way, if the user selected some content control, it does not remove anything.
To avoid this I just moved the cursor by means of the plugin method, but I wonder is this could not be solved other way.
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?
7.1.1
The text was updated successfully, but these errors were encountered: