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

some document builder functions don't work with callCommand

Open lorenzoale opened this issue 2 years ago • 1 comments

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

What is the current behavior? some functions availables in the document builder documentation seems to be missing in the callCommand way of using it. For example Select() or Push() to select a content control or push data into it.

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? I would like to select and paste data (text or image) inside a content control or to replace the content control by the data i want to paste (because i want to delete it afterwards anyway).  I do it with pasteHtml for the moment but it would be nice to be able to do it directly inside the callCommand function. 

Which versions of sdkjs-plugins, and which browser / OS are affected by this issue? Did this work in previous versions of sdkjs-plugins? OO doc editor version 7.0.1

lorenzoale avatar Aug 10 '22 13:08 lorenzoale

Hi @lorenzoale ! You need to update the document editor to version 7.1.1

An example of using the callCommand function on version 7.1.1 to create a content control and insert text inside it:

        {
            this.callCommand(function () {
                var oDocument = Api.GetDocument();
                var oTextForm = Api.CreateTextForm({
                    "key": "Personal information",
                    "tip": "Enter your first name",
                    "required": true,
                    "placeholder": "First name",
                    "comb": true,
                    "maxCharacters": 10,
                    "cellWidth": 3,
                    "multiLine": false,
                    "autoFit": false
                });
                var oParagraph = oDocument.GetElement(0);
                oParagraph.AddElement(oTextForm);
                oTextForm.SetText("John Smith");
            }, true);
        }

l8556 avatar Aug 11 '22 12:08 l8556