Skip to content

Commit

Permalink
Merge pull request 'Calling editor methods in the frameworks' from fe…
Browse files Browse the repository at this point in the history
…ature/frameworks-call-methods into develop

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/api.onlyoffice.com/pulls/83
  • Loading branch information
LinneyS committed Dec 9, 2024
2 parents 6d6aa62 + 08167be commit 206c70e
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Change Log

- docs api: added the information about calling editor methods in the frameworks
- docs api: added the Checking PDF forms page
- docspace backend: added the Removed user page

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ Test the application using the Node.js development server:

- To stop the development server, select on the command line or command prompt and press *Ctrl+C*.

## Calling editor methods in the Angular component

1. Add the `DocEditor.instances` parameter to the `window` object and get the editor object from it by the editor ID:

```ts
const documentEditor = window.DocEditor.instances["docxEditor"]
```

2. Call any editor [method](../../../Usage%20API/Methods/index.md) from this object:

```ts
documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
```

Example:

```ts
onDocumentReady = () => {
const documentEditor = window.DocEditor.instances["docxEditor"]

documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
}
```

## Deploying the demo Angular application

To deploy the application to a production environment, create the build-specific configuration options for Angular projects:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@ This procedure creates a [basic React application](https://github.com/facebook/c

- To stop the development server, select on the command line or command prompt and press *Ctrl+C*.

## Calling editor methods in the React component

1. Add the `DocEditor.instances` parameter to the `window` object and get the editor object from it by the editor ID:

```tsx
const documentEditor = window.DocEditor.instances["docxEditor"]
```

2. Call any editor [method](../../../Usage%20API/Methods/index.md) from this object:

```tsx
documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
```

Example:

```tsx
const onDocumentReady = () => {
const documentEditor = window.DocEditor.instances["docxEditor"]
documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
}
```

## Deploying the demo React application

The easiest way to deploy the application to a production environment is to install [serve](https://github.com/vercel/serve) and create a static server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ This procedure creates a [basic Vue.js application](https://cli.vuejs.org/guide/

- To stop the development server, select on the command line or command prompt and press *Ctrl+C*.

## Calling editor methods in the Vue.js application

1. Add the `DocEditor.instances` parameter to the `window` object and get the editor object from it by the editor ID:

```vue
const documentEditor = window.DocEditor.instances["docEditor"]
```

2. Call any editor [method](../../../Usage%20API/Methods/index.md) from this object:

```vue
documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
```

Example:

```vue
onDocumentReady() {
const documentEditor = window.DocEditor.instances["docEditor"]
documentEditor.showMessage("Welcome to ONLYOFFICE Editor!")
}
```

## Deploying the demo Vue.js application

The easiest way to deploy the application to a production environment is to install [serve](https://github.com/vercel/serve) and create a static server:
Expand Down

0 comments on commit 206c70e

Please sign in to comment.