onlyoffice related parameter setting instructions

function initDoc(key, url, fileType, title, model, callbackUrl) {                 let config = {                     "document": {                         "documentType": "text",                         "width": "100%", //open window width                         "height" : "100%", //open window height                         "fileType": fileType, //document type                         "key": key, //defines the unique document identifier used to identify the document by the service. Every time a document is edited and saved, the key must be regenerated. The length is limited to 128 symbols.                         "title": title, //Define the desired filename for the document being viewed or edited, which will also be used as the filename when downloading the document. The length is limited to 128 symbols.                         "url": url, //Defines the absolute URL where the original viewed or edited document is stored                         "info":











                            "sharingSettings": [ //The operation permission configuration of the user corresponding to the file
                                {                                     "permissions": "Full Access", // Full operation permission-Full Access, read-only permission-Read Only Deny Access-Deny Access                                     "user": "Forest Chaoying" //A user with secondary permissions                                 },                                 {                                     "permissions": "Read Only",                                     "user": "Zhou Botong"                                 },                             ],                             "uploaded": "2010-07-07 3:46 PM"//File creation time                         },                         //Document permission parameters











                        "permissions": {                             "edit": true, //(Whether the file can be edited, if false, the file cannot be edited)                             "fillForms": true, //Define whether the form can be filled in the document                             "print": true, //Define Whether the document can be printed                             "review": false, //First whether to display the review document menu                             "comment": true, //Define whether the document can be commented. If the comment permission is set to "true", the document sidebar will contain a "Comment" menu option; it will only take effect if the mode parameter is set to edit, and the default value is consistent with the value of the edit parameter.                             "copy": true, //Whether you are allowed to copy content to the clipboard. The default value is true.                             "download": true, //Define if the document can be downloaded or only viewed or edited online. If the download permission is set to "false" the download as menu option will not be there. The default value is true.                             "modifyContentControl": true, // Defines whether content control settings can be changed. Content control modification is only available in the document editor when the mode parameter is set to edit. The default value is true.








                            "modifyFilter": true, //Defines whether the filter can be applied globally (true) to affect all other users, or locally (false), i.e. only for the current user. If the mode parameter is set to edit, filter modification is only available to the spreadsheet editor. The default value is true.
                        }
                    },
                    // type: "embedded",
                    //Open document type
                    // text corresponds to various document types (.doc, .docm, .docx, .dot, .dotm, .dotx, .epub, .fodt, . htm, .html, .mht, .odt, .ott, .pdf, .rtf, .txt, .djvu, .xps)
                    //spreadsheet corresponds to the form type (.csv, .fods, .ods, .ots, .xls , .xlsm, .xlsx, .xlt, .xltm, .xltx)
                    //presentation corresponds to the PPT type (.fodp, .odp, .otp, .pot, .potm, .potx, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx)
                    "editorConfig": { // edit configuration
                        "createUrl": "http://docServer:port/url-to-create-document/", //Specify the page to create a document. After adding this configuration, the document server plug-in will display the new document button "mode": model
                        , //document operation mode view view mode can not be edited edit edit mode can edit the document
                        "callbackUrl": callbackUrl, //callback address when saving the file
                        "lang": "zh-CN", //locale
                        "customization": { / The /customize section allows customizing the editor interface to look like your other products and changing the presence or absence of additional buttons, links, changing the logo and editor owner details.
                            "help": false, //Define whether to show or hide the "Help" menu button. The default value is true.
                            "hideRightMenu": false, //Define whether to show or hide the right menu when loading for the first time. The default value is false.
                            "autosave": false, // Defines whether to enable or disable the "Autosave" menu option. Note that if you change this option in the menu, it will be saved to the browser's localStorage. The default value is true.
                            "forcesave": true, //Define whether the save button is displayed Default false
                            "chat": false, //Define whether the "Chat" menu button is displayed or hidden; please note that if you hide the "Chat" button, the corresponding chat function will also be disabled. The default value is true.
                            "commentAuthorOnly": false, //Define if the user can only edit and delete his comments. The default value is false.
                            "comments": false, //Define whether to show or hide the "Comments" menu button; please note that if you hide the "Comments" button, the corresponding comment function will only be available for viewing, adding and editing comments will not be available. The default value is true.
                            "compactHeader": false, //Define whether to place the menu bar next to the logo to make the interface more compact. Default false.
                            "compactToolbar": false, //Defines whether the displayed top toolbar type is full (false) or compact true. The default value is false and the extra menu will collapse on the right to show.
                            "compatibleFeatures": false, //Define the use of features compatible only with the OOXML format. For example, don't use comments on the entire document. The default value is false.
                            "macros": false, //Define whether document macros will be run and the available macro settings. The default value is true.
                            "macrosMode": "warn", //Define whether document macros will be run. Can take the following values: disable - do not run at all; enable - automatically run all macros; warn - warn about macros and ask permission to run. The default value is original.
                            "plugins": false, //Defines whether plugins will be started and available. The default value is true.
                            "showReviewChanges": false, //Defines whether to automatically show or hide the review changes panel when loading the editor. The default value is false.
                            "spellcheck": false, //Defines whether to automatically turn on or off the spell checker when loading the editor. The spell checker is only available in the Docs editor and the Presentation editor. The default value is true.
                            "toolbarNoTabs": false, //The definition is to highlight the top toolbar tab style. The default value is false.
                            "unit": "cm", //Defines the unit of measure used in rulers and dialogs. Can take the following values: cm - centimeters, pt - points, inch - inches. The default is centimeters (cm).
                            "zoom": 100, //Define the document display zoom value in percentage. Can take a value greater than 0. For text documents and presentations, this parameter can be set to -1 (fit document to page option) or -2 (fit document page width to editor page). The default value is 100.
                            "customer": { // Display information about the document editor
                                "address": "My City, 123a-45", //The postal address of the company or individual who has access to the editor or editor author, "info": "
                                Some additional information", // some additional information about the company or person you want others to know,
                                "logo": "https://example.com/logo-big.png", //path to the image logo (this file There is no specific recommendation, but it would be better if you use a .png format with a transparent background). The image must have the following dimensions: 432x70,
                                "mail": "[email protected]", //the email address of the company or person who has access to the editor or the editor
                                "name": "Ouyang Feng",

                            },
                            "feedback": { //Feedback configuration information
                                "url": "https://example.com", //The absolute URL of the website address that will be opened when the "Feedback and Support" menu button is clicked, "
                                visible" : false //Show or hide the "Feedback and Support" menu button,
                            },
                            "goback": { //Define the settings for the "Open file location" menu button and the top right button. This object has the following parameters:
                                "blank": true, //Opens the website in a new browser tab/window (if the value is set to true) or in the current tab (if the value is set to false). The default value is true,
                                "requestClose": false, //Defines that if the "Open File Location" button is clicked, the events.onRequestClose event is called instead of opening a browser tab or window. The default value is false,
                                "text": "Open file location",
                                "url": "https://example.com" //The absolute URL of the website address that will be opened when the "Open File Location" menu button is clicked, }
                            ,
                            "logo": {                                 "image": "https:// example.com/logo.png", // Path to an image file for display in normal work mode (i.e. in view and edit modes of all editors). The image must have the following dimensions: 172x40,                                 "imageEmbedded": "https://example.com/logo_em.png", //path to the image file to display in embedded mode (see config section for how to define embedding format document type). The image must have the following dimensions: 248x40,                                 "url": "https://www.baidu.com" //The absolute URL that will be used when someone clicks on the logo image (can be used to go to your website, etc.). Leave as an empty string or null to make the logo non-clickable,                             },                         },                         "user":







                            "name": "operator" //full user name
                        },
                        "embedded": { //Embedded section applies only to embedded document types (see config section for how to define embedded document types). It allows changing the settings which define the behavior of the buttons in embedded mode.
                            "embedUrl": "https://example.com/embedded?doc=exampledocument1.docx", //Define the absolute URL of the document as the source file of the document embedded in the web page
                            "fullscreenUrl": "https:// example.com/embedded?doc=exampledocument1.docx#fullscreen", //Define the absolute URL of the document that will be opened in full screen mode.
                            "saveUrl": "https://example.com/download?doc=exampledocument1.docx", //Define the absolute URL that allows saving the document to the user's personal computer.
                            "shareUrl": "https://example.com/view?doc=exampledocument1.docx",
                            "toolbarDocked": "top" //Define the position of the embedded viewer toolbar, which can be top or bottom.
                        }
                    },

                    "events": { // Event configuration
                        // onAppReady, // - Function called when the app is loaded into the browser.
                        // onCollaborativeChanges // - Function called when the document is co-edited by another user in strict co-editing mode.
                        // onDocumentReady, // - Function called when the application is loaded into the browser.
                        // onDocumentStateChange, //-The function called when the document is modified. This is called with parameter: {true "data"} when the current user edits the document and with parameter: {"data": false} when the current user changes are sent to the document editing service.
                        // onDownloadAs, // - Function called with an absolute URL pointing to the edited file when the downloadAs method is called. Send the absolute URL of the document to download in the data parameter.
                        // onError, // - Function called when an error or other specific event occurs. Error messages are sent in the data parameter.
                        // onInfo, // - the function called when the application opens the file. The mode is sent in the data.mode parameter. Can be viewed or edited.
                        // onMetaChange, //-The function called when the meta information of the document is changed through the meta command. The document name is sent via the data.title parameter.
                        // onOutdatedVersion, // - Function called after an error is displayed when the document is opened for editing using the old document.key value, which was used to edit a previous document version and was successfully saved. When this event is called, the editor must be reinitialized with the new document.key.
                        // onReady, // - Function called when the application is loaded into the browser. Since version 5.0 is deprecated, please use onAppReady instead of
                        // onRequestClose, //- the function called when the editor is finished and the editor must be closed.
                        // onRequestCompareFile, // - Function called when the user tries to select a document to compare by clicking the "Documents in Storage" button. To select a document to compare, the setRevisedFile method must be called. If the method is not declared, the "From Stored Document" button will not be displayed.
                        // onRequestCreateNew, // - Function called when the user tries to create a document by clicking the "New" button. Use this method instead of the createUrl field. If the method is not declared and createUrl is not specified, the "Create New" button will not be displayed.
                        // onRequestEditRights, // - Function called when the user tries to switch the document from view to edit mode by clicking the "Edit Document" button. When calling this function, the editor must be initialized again in edit mode. If the method is not declared, the Edit button will not be displayed.
                        // onRequestHistory, // - Function called when the user tries to display the document version history by clicking the "Version History" button. To display the document version history, you must call the refreshHistory method. If this method and the onRequestHistoryData method are not declared, the "Version History" button will not be displayed.
                        // onRequestHistoryClose, // - Function called when the user tries to view the document version history by clicking the "Close History" button. When calling this function, the editor must be initialized again in edit mode. If the method is not declared, the "Close History" button will not be displayed.
                        // onRequestHistoryData, // - Function called when the user tries to click on a specific document version in the document version history.
                        // onRequestInsertImage, // - Function called when the user tries to insert an image by clicking the "Save Image" button. The type of image insertion is specified in the parameter data.c.
                        // onRequestRename, // - Function called when the user tries to rename a file by clicking the "Rename..." button.
                        // onRequestRestore, // - Function called when the user clicks the "Restore" button in the version history to restore a file version.
                        // onRequestSaveAs, // - Function called when the user tries to save a file by clicking the "Save As..." button. The title of the document and the absolute URL of the document to download are sent in the data parameter. If the method is not declared, the "Save As..." button will not be displayed.
                        // onRequestSharingSettings, // - Function called when the user clicks the "Change Access" button to manage document access. The setSharingSettings method must be called to update information about the settings that allow the document to be shared with other users. If the method is not declared, the "Change Access" button will not be displayed.
                        // onRequestUsers, // - Function to call when commenters can select other users to be mentioned in comments. To set the list of users, the setUsers method must be called.
                        // onWarning, // - function called when a warning occurs. Warning messages are sent in the data parameter.
                        // "onDocumentStateChange": function() {                         // }, //The callback after the document changes                         //"onDocumentReady" : onDocumentReady, //The callback after the document initialization is ready                     },                 };




                var docEditor = new DocsAPI.DocEditor("placeholder", config);
            }

Guess you like

Origin blog.csdn.net/cyulotus/article/details/128404264
Recommended