Start the connection
⚠️ Make sure you have read 接入须知
it.
⚠️ Make sure to call as specified , 地址``方法
, ,HTTP Header
,
Application appId``secret
Contact Graphite to obtain the and for docking with Graphite SDK appId
secret
, and you can perform the following operations after obtaining it:
- Get app details
- Used to view details about the app
- Update the callback address of the app
- Update the callback address of the access party requested by the Graphite SDK (the update takes about 1 minute to take effect)
The accessing party needs to keep the obtained appId
and secret
.
Collaborative documentation
Before you start accessing the collaboration document, you need to understand or prepare the following items:
- The signature (see Signature Implementation Details) parameter that needs to be provided for access
- The web page developed by the accessing party is used to host the graphite editor
- Develop a number of callback interfaces
- It is used to obtain the corresponding information in the Graphite SDK
协作
or预览
scenes, and the callback interfaces that need to be implemented for common functions refer to the list of interfaces related to common function scenarios
- It is used to obtain the corresponding information in the Graphite SDK
⚠️ To achieve the most basic document collaboration, the access party needs to develop at least the following two interfaces:
If you want to use the full functionality, implement all of the 接入方实现接口
features or implement 常见功能场景相关接口清单
the features required by the department.
Access process
- Call the Create API to create a graphite document
- In the web page developed by the accessing party, the graphite JSSDK is introduced
- Follow the prompts to initialize the editor according to the README in the JSSDK npm package
File preview
The online preview function refers to the docx``xlsx
pptx
conversion of Office files such as , etc., into a form that can be previewed and viewed in the browser.
⚠️ This feature does not support editing documents, if you want to edit documents, please refer to 协同文档
.
Support format
file type | Supported extension formats |
---|---|
Word file | .doc .docx .wps .wpt |
Excel file | .xls .xlsx .xlsm .csv |
PPT file | .ppt .pptx |
PDF file | .pdf .rtf |
TXT file | .txt |
Audio files | .mp3 .mp4 |
Picture file | .jpg .jpeg .png .gif .bmp .svg .heic .heif |
Other documents | .ofd .rtf .md |
Before you start previewing the access file, you need to know or prepare the following items:
Access instructions
To create a preview task by using Create Preview, you need to specify the file download address in the downloadUrl field of the API to get file meta information, for example
http(s)://{domain}/static/files/2017.docx
, the graphite server will download the file from this address and process it. Make sure that the address can be accessed by the graphite server.Preview the file by visiting the preview page.
HTTP Response Header requirements
⚠️ Note:
In order to ensure that the file type can be correctly recognized, the HTTP response header when the download address is accessed must ensure one of the following conditions (if the return is incorrect, the preview will fail due to the incorrect identification of the file type).
Content-Disposition
The HTTP ResponseHeader needs to return the correct Content-Disposition information (see MDN Content-Disposition), as follows:
Content-Disposition: attachment; filename="yourfilename.docx"
Content-Type
The HTTP ResponseHeader needs to return the correct Content-Type information, as follows
Several types of Content-Type examples
Extension | The corresponding Content-Type value |
---|---|
Doc | application/msword |
docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
xls | application/vnd.ms-excel |
ppt | application/vnd.ms-powerpoint |
pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation |
application/pdf | |
txt | text/plain |
File extension field
The extension information of the file is returned in the Field of Get File Meta Information API - File Previewext
.
As:
The preview file download address (downloadUrl
) is , https://your-domain/static/files/1234
and the accessing party cannot return any of the following header information when requesting the download, which is used by the Graphite SDK to identify the file type:
Content-Type
Content-Disposition
This can be done via the field returned in the meta information ext
.
If you ext: "docx"
tell the Graphite SDK that the extension of this file is recognized as a Word file, see the following callback interface example highlighted line.
{
"id": "ba13551165cc5066",
"name": "示例文档.docx",
"type": "file",
"permissions": {
"readable": true
},
"downloadUrl": "http://example.com/download/test.docx",
"ext": "docx" // 用于标识文件类型
}