Deploy document editor component for mobile in Vue Document editor component

16 Mar 20231 minute to read

Document editor component for Mobile

At present, Document editor component is not responsive for mobile, and we haven’t ensured the editing functionalities in mobile browsers. Whereas it works properly as a document viewer in mobile browsers.

Hence, it is recommended to switch the Document editor component as read-only in mobile browsers. Also, invoke fitPage method with FitPageWidth parameter in document change event, such as to display one full page by adjusting the zoom factor.

The following example code illustrates how to deploy Document Editor component for Mobile.

<div id="app">
    <ejs-documenteditorcontainer ref="container" height="590px" :serviceUrl='serviceUrl' :enableToolbar='true' :documentChange='onDocumentChange'> </ejs-documenteditorcontainer>

  import Vue from 'vue';
  import { DocumentEditorContainerPlugin, DocumentEditorContainerComponent,Toolbar } from '@syncfusion/ej2-vue-documenteditor';

  export default {
      return { serviceUrl:'' }
    provide: {
      //Inject require modules.
      DocumentEditorContainer: [Toolbar]
      onDocumentChange: function (args) {
          //To detect the device
          let isMobileDevice = /Android|Windows Phone|webOS/i.test(navigator.userAgent);

          if (isMobileDevice) {
            this.$refs.container.ej2Instances.restrictEditing = true;
            setTimeout(() => {
            }, 50);
          else {
            this.$refs.container.ej2Instances.restrictEditing = false;
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-lists/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';
  @import "../node_modules/@syncfusion/ej2-vue-documenteditor/styles/material.css";

You can download the complete working example from this GitHub location

Note: You can use the restrictEditing in DocumentEditorContainer and isReadOnly in DocumentEditor based on your requirement to change component to read only mode.