# @lovepop/note-editor

> A [Svelte](https://svelte.technology/guide) component for editing the contents of a Lovepop insert

Latest version **2.7.0** (published 2021-04-27) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @lovepop/note-editor
pnpm add @lovepop/note-editor
yarn add @lovepop/note-editor
bun add @lovepop/note-editor
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.0 |
| Published | 2021-04-27 |
| First published | 2018-12-05 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 3.9 MB |
| Known vulnerabilities | 0 (+7 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | lovepop-engineering |

## Links

- npm: https://www.npmjs.com/package/@lovepop/note-editor
- Repository: https://github.com/lovepopcards/galdr
- Homepage: https://github.com/lovepopcards/galdr#readme
- Issues: https://github.com/lovepopcards/galdr/issues
- npm.io page: https://npm.io/package/@lovepop/note-editor

## Dependencies (5)

- [braces](https://npm.io/package/braces.md) ^2.3.2
- [marked](https://npm.io/package/marked.md) ^0.6.3
- [set-value](https://npm.io/package/set-value.md) ^2.0.1
- [serialize-javascript](https://npm.io/package/serialize-javascript.md) ^2.1.2
- [websocket-extensions](https://npm.io/package/websocket-extensions.md) ^0.1.4

## Recent versions

- 2.7.0 (latest) — 2021-04-27
- 2.5.2-alpha.12 (canary) — 2019-06-12
- 2.6.27 — 2020-07-17
- 2.6.26 — 2020-07-01
- 2.6.25 — 2020-06-30
- 2.6.24 — 2020-06-30
- 2.6.23 — 2020-06-11
- 2.6.22 — 2020-06-10
- 2.6.21 — 2020-03-16
- 2.6.20 — 2020-03-16
- 2.6.19 — 2020-03-13
- 2.6.18 — 2020-03-13
- 2.6.17 — 2020-03-12
- 2.6.16 — 2020-03-12
- 2.6.15 — 2020-03-12
- … 368 more at https://npm.io/package/@lovepop/note-editor/versions

## README

# @lovepop/note-editor

A [Svelte](https://svelte.technology/guide) component for editing the contents of a Lovepop insert

## Local development

If you're only working on note-editor, you can run `lerna run build` to build all sub-packages and then `yarn dev` in the note-editor directory to start the dev server. This will launch the storybook instance to preview your changes in.

If you cannot connect to the localhost files for colors and fonts, you can replace them in `stores.js` with the equivalent test fixtures, i.e. `../tests/fixtures/colors`.

If you're working on typesetter or svg-writer at the same time, you should open each of those in a terminal and run `yarn dev`. This is order dependent so do typesetter -> svg-writer -> note-editor

`yarn run info` for a description of available npm scripts

## TDD

For a tdd style workflow, you can run `yarn watch:test` to have your tests automaticaly update file changes. Run `yarn testem` to run all the tests in the browser. Note: You may have to run `yarn watch:test` before each new instance of `yarn testem` after any changes for the tests to run properly.

## Useful links

* [Svelte](https://svelte.technology/guide) - disapearing framework for generating shareable js components
* [Testem](https://github.com/testem/testem) - our test runner for this package
* [QUnit](https://api.qunitjs.com/) - our test framework for this package
* [Storybook](https://storybook.js.org/basics/guide-svelte/) - WIP component playground/dev/doc site

## Docs - WIP

`yarn run dev` will launch a Storybookjs instance with examples of how to consume note-editor


## Using Notifications component externally (shopify, admin app, etc...)

```html
  <div id="notifications"></div>
```

```js
  import { Notifications } from '@lovepop/note-editor';

  const notifications = new Notifications({ target: document.getElementById('notifications') });

  /*
   * adds a notification with type `error`.
   * can be styled with `.ne-error` class
   */
  notifications.error('Some error message', /* optional timeout in ms */);

  /*
   * adds a notification with type `warn`.
   * can be styled with `.ne-warn` class
   */
  notifications.warn('Some warning with optional timeout of 3 seconds', 3000);

  /*
   * adds a notification with type `success`.
   * can be styled with `.ne-success` class
   */
  notifications.success('Some success', /* optional timeout in ms */);


  /*
   * removes all notifications
   */
  notifications.clearAll();

  /* Removes the component from the DOM and removes any
   * event listeners that were created. This will also
   * fire a destroy event e.g. `notifications.on('destory', () => console.log('bye'))`
   */
  notifications.destroy();
```

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