API roundup: latest updates for ONLYOFFICE Docs
We have rolled out a series of API updates for ONLYOFFICE Docs, aimed at enhancing compatibility, customization, and security. Whether you’re building custom workflows, enabling secure document collaboration, or integrating with advanced APIs, these enhancements offer boundless possibilities. Here’s a breakdown of the latest additions and improvements.
Extended file format support
The Docs API now supports additional file formats, offering broader compatibility, to ensure a seamless experience for users working with varied file types. Among those are Apple iWork and Hancom Office formats:
pages
key
numbers
hwp
hwpx
These formats can be specified using the documentType property, for example:
const config = {
documentType: "pages",
Enhanced customization options
Developers now have more control over the editor’s behavior and appearance. Key updates include:
- Hiding feature tips
The editorConfig.customization.features.featuresTips parameter allows enabling or disabling tooltips about the new features during the first editor load upon updating. Default value is true
.
- Display of spreadsheet scrollbars
Starting from version 8.3, it’s possible to define if the horizontal/vertical scroll is automatically displayed or hidden when the spreadsheet editor is loaded. Check editorConfig.customization.showHorizontalScroll and editorConfig.customization.showVerticalScroll to control these parameters.
- Presentation slideshow background
Use the editorConfig.customization.slidePlayerBackground parameter to define the slideshow background color in HEX, RGB, or RGBA formats. For example, #ff0000, rgb(255, 0, 0), rgba(255, 0, 0, 0.5).
showHorizontalScroll: true,
showVerticalScroll: true,
slidePlayerBackground: "#000000",
- Document heading colors
Customize heading styles in the document editor with the editorConfig.customization.wordHeadingsColor parameter, allowing HEX color specifications.
- Mobile Info button
Toggle the display of the Document Info button for mobile editors using editorConfig.customization.mobile.info. Default value is false
.
- Pointer mode
Adjust the pointer mode (select or hand) in the presentation viewer using the editorConfig.customization.pointerMode parameter. Default value is select
.
- Compact toolbar for the viewer
The editorConfig.customization.compactToolbar parameter now supports the viewer mode, allowing switching between full and compact toolbars. Default value for view mode is true
.
Improved security features
The Docs API introduces handling of password-protected files with the added events.onUserActionRequired event. The function is called when a user action is required to open a document in the following cases:
- when the user needs to enter a password to open the protected document;
- when the user needs to select an encoding for the TXT file;
- when the user needs to select an encoding and a delimiter for the CSV file.
Here’s an example of how the event functions:
function onUserActionRequired() {
console.log("Enter a password")
};
const config = {
events: {
onUserActionRequired,
},
};
const docEditor = new DocsAPI.DocEditor("placeholder", config);
What else, you are now able to use the drop command to prohibit document editing for specific users:
{
"c": "drop",
"key": "Khirz6zTPdfd7",
"users": ["6d5a81d0"]
}
The full Docs API changelog is available here.
Get the latest version of ONLYOFFICE Docs Developer:
New Office API methods
The Office API receives significant updates for better document management, namely:
- Bookmarks
- Content Controls
- Sections
- Autofilters
- Selection
- And more
These enhancements enable richer interactions and editing experiences. For a detailed breakdown of commands, consult the Office API changelog.
Plugins API updates
Several new methods and properties expand the capabilities of plugins:
- Content retrieval
The GetSelectedContent method retrieves selected content in a specified format.
expression.GetSelectedContent(prop);
- Error messages
The ShowError method enables plugins to display error or warning messages.
expression.ShowError(error, level);
- Enhanced Content Control properties
New properties Shd
(background shading) and Border
enhance the ContentControlProperties object for better visual customization.
- Panel activation
The isActivated parameter allows you to specify whether a created plugin panel is expanded (true
) or collapsed (false
) on load.
Check the full list of the plugin API updates.
Create your free ONLYOFFICE account
View, edit and collaborate on docs, sheets, slides, forms, and PDF files online.