The reference figure and the steps below explain the process of renaming a document in ONLYOFFICE Docs.
Specify the event handler for opening the Rename... menu in the configuration script for Document Editor initialization. When the onRequestRename event is called, the new name of the document without extension is sent to the software integrators which rename the document in the document storage service.
var onRequestRename = function(event) { var title = event.data; ... }; var docEditor = new DocsAPI.DocEditor("placeholder", { "events": { "onRequestRename": onRequestRename, ... }, ... });
In order to update the name of the document for all collaborative editors, send the request to the document command service, using the meta value for the c parameter:
{ "c": "meta", "key": "Khirz6zTPdfd7", "meta": { "title": "Example Document Title.docx" } }
When the name of the document is changed via the meta command, the onMetaChange event must be called in the document editor of each user. This event sends the name of the document in the data.title parameter.
var onMetaChange = function (event) { var title = event.data.title; ... }; var docEditor = new DocsAPI.DocEditor("placeholder", { "events": { "onMetaChange": onMetaChange, ... }, ... });