# @elan-ev/ep_resize

> Receive a postMessage when Etherpad Lite pad content size changes.

Latest version **0.1.0** (published 2021-06-08) · 0 weekly downloads

## Install

```sh
npm install @elan-ev/ep_resize
pnpm add @elan-ev/ep_resize
yarn add @elan-ev/ep_resize
bun add @elan-ev/ep_resize
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2021-06-08 |
| First published | 2021-06-08 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tgloeggl, luniki |

## Links

- npm: https://www.npmjs.com/package/@elan-ev/ep_resize
- Repository: https://github.com/elan-ev/ep_resize
- Homepage: https://github.com/elan-ev/ep_resize#readme
- Issues: https://github.com/elan-ev/ep_resize/issues
- npm.io page: https://npm.io/package/@elan-ev/ep_resize

## Recent versions

- 0.1.0 (latest) — 2021-06-08

## README

# ep_resize

An Etherpad Lite plugin that sends a [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage "postMessage documentation in MDN") to embedding page when pad size changes.

## What is it good for?

For example when you want to embed the Etherpad Lite in an iframe and want the iframe size to dynamically change so that all the contents would fit.

## Install

Run in your EP installion directory:
```
npm install ep_resize
```

## Usage example

Assuming you use JQuery you can receive the EP resize event as follows:

```javascript
    $(window).on('message onmessage', function (e) {
        var msg = e.originalEvent.data;
        if (msg.name === 'ep_resize') {
            var width = msg.data.width;
            var height = msg.data.height;
            console.log('ep_resize', 'new width:', width, 'new height:', height);
        }
    });
```

When making single page webapps, don't forget to remove the message handler when the view is destroyed

```javascript
    $(window).off('message onmessage');
```


## Credits

* [CitizenOS](https://citizenos.com) for funding the development

---
_Source: https://npm.io/package/@elan-ev/ep_resize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
