ONLYOFFICE Docs is a free collaborative online office suite comprising viewers and editors for texts, spreadsheets and presentations, forms and PDF, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
Click the button to copy all the contents of the file on the right and paste it to the cursor of the file on the left,How should it be implemented?
This is a partial code block that I have implemented
insertElement() { var projectEditorConnector = this.projectEditor.createConnector(); var elementEditorConnector = this.elementEditor.createConnector(); elementEditorConnector.callCommand( function () { sessionStorage.removeItem("elementTemp"); var oDocument = Api.GetDocument(); sessionStorage.setItem( "elementTemp", oDocument.ToJSON(true, true, true, true, true, true) ); }, function () { console.log("callback command"); } ); projectEditorConnector.callCommand( function () { var oDocument = Api.GetDocument(); var json = Api.FromJSON(sessionStorage.getItem("elementTemp")); oDocument.InsertContent(json); }, function () { console.log("callback command"); } ); }
I have reviewed the document introducing the global variable GlobalVariable, but I may report an error stating that GlobalVariable is not defined, so I used sessionStorage. Is there a better solution to implement it?
Even so, if I configure config. type=“embedded”, the above method cannot be implemented, and callCommand will not execute
Click the button to copy all the contents of the file on the right and paste it to the cursor of the file on the left,How should it be implemented?
This is a partial code block that I have implemented
insertElement() { var projectEditorConnector = this.projectEditor.createConnector(); var elementEditorConnector = this.elementEditor.createConnector(); elementEditorConnector.callCommand( function () { sessionStorage.removeItem("elementTemp"); var oDocument = Api.GetDocument(); sessionStorage.setItem( "elementTemp", oDocument.ToJSON(true, true, true, true, true, true) ); }, function () { console.log("callback command"); } ); projectEditorConnector.callCommand( function () { var oDocument = Api.GetDocument(); var json = Api.FromJSON(sessionStorage.getItem("elementTemp")); oDocument.InsertContent(json); }, function () { console.log("callback command"); } ); }
I have reviewed the document introducing the global variable GlobalVariable, but I may report an error stating that GlobalVariable is not defined, so I used sessionStorage. Is there a better solution to implement it?
Even so, if I configure config. type=“embedded”, the above method cannot be implemented, and callCommand will not execute