# ep_embed_floating_toolbar

> An Etherpad Lite plugin that enables floating toolbar & messages even when embedded and the frame height is always set to fit content (using ep_resize plugin https://github.com/tiblu/ep_resize).

Latest version **0.0.8** (published 2023-10-11) · 0 weekly downloads

## Install

```sh
npm install ep_embed_floating_toolbar
pnpm add ep_embed_floating_toolbar
yarn add ep_embed_floating_toolbar
bun add ep_embed_floating_toolbar
```

## 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.0.8 |
| Published | 2023-10-11 |
| First published | 2015-12-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tiblu |
| Maintainers | ilmart, tiblu, citizenos-owner |

## Links

- npm: https://www.npmjs.com/package/ep_embed_floating_toolbar
- Repository: https://github.com/tiblu/ep_embed_floating_toolbar
- Homepage: https://github.com/tiblu/ep_embed_floating_toolbar#readme
- Issues: https://github.com/tiblu/ep_embed_floating_toolbar/issues
- npm.io page: https://npm.io/package/ep_embed_floating_toolbar

## Recent versions

- 0.0.8 (latest) — 2023-10-11
- 0.0.7 — 2021-08-12
- 0.0.6 — 2021-05-18
- 0.0.4 — 2021-04-13
- 0.0.3 — 2017-04-27
- 0.0.2 — 2016-01-06
- 0.0.1 — 2015-12-16

## README

# ep_embed_floating_toolbar
An Etherpad Lite plugin that enables floating toolbar & messages even when embedded and the frame height is always set to fit content (using ep_resize plugin [https://github.com/tiblu/ep_resize]()).
Applies also to timeslider view.

## Usage example

In order to float the toolbars, the embedded frame needs to know about the embedding pages scroll position and the embedded frames position. ``postMessage`` ([https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage]()) is used for cross-domain communication between the parent page and the frame.

Assuming you use JQuery parent page can send the scroll positions to the child frame as follows:

```javascript
    $(window).on('scroll', function (e) {
        var $myPadFrame = $('#myPadFrame');
        var targetWindow = $myPadFrame.get(0).contentWindow;
        targetWindow.postMessage({
            name: 'ep_embed_floating_toolbar_scroll',
            data: {
                scroll: {
                    top: $(window).scrollTop(),
                    left: $(window).scrollLeft()
                },
                frameOffset: $myPadFrame.offset() // Iframe offset on the page so that we know when to start floating the toolbars
            }
        }, '*');
    });
```

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

```javascript
    $(window).off('scroll');
```

## Credits

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

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