0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Merge pull request #48 from cvrebert/events

README: hyperlink DOM event refs to MDN docs
This commit is contained in:
Neil Jenkins 2015-03-05 15:15:45 +08:00
commit 39fd173c6a

View file

@ -30,7 +30,7 @@ Installation and usage
would like the editor to use (or link to an external stylesheet). would like the editor to use (or link to an external stylesheet).
3. In your application, instead of a `<textarea>`, use an 3. In your application, instead of a `<textarea>`, use an
`<iframe src="path/to/document.html">`. `<iframe src="path/to/document.html">`.
4. In your JS, attach an event listener to the `load` event of the iframe. When 4. In your JS, attach an event listener to the [`load` event](https://developer.mozilla.org/en-US/docs/Web/Events/load) of the iframe. When
this fires you can grab a reference to the editor object through this fires you can grab a reference to the editor object through
`iframe.contentWindow.editor`. `iframe.contentWindow.editor`.
5. Use the API below with the `editor` object to set and get data and integrate 5. Use the API below with the `editor` object to set and get data and integrate
@ -61,9 +61,9 @@ Attach an event listener to the editor. The handler can be either a function or
* **focus**: The editor gained focus. * **focus**: The editor gained focus.
* **blur**: The editor lost focus * **blur**: The editor lost focus
* **keydown**: Standard DOM keydown event. * **keydown**: Standard [DOM keydown event](https://developer.mozilla.org/en-US/docs/Web/Events/keydown).
* **keypress**: Standard DOM keypress event. * **keypress**: Standard [DOM keypress event](https://developer.mozilla.org/en-US/docs/Web/Events/keypress).
* **keyup**: Standard DOM keyup event. * **keyup**: Standard [DOM keyup event](https://developer.mozilla.org/en-US/docs/Web/Events/keyup).
* **input**: The user inserted, deleted or changed the style of some text; in other words, the result for `editor.getHTML()` will have changed. * **input**: The user inserted, deleted or changed the style of some text; in other words, the result for `editor.getHTML()` will have changed.
* **pathChange**: The path (see getPath documentation) to the cursor has changed. The new path is available as the `path` property on the event object. * **pathChange**: The path (see getPath documentation) to the cursor has changed. The new path is available as the `path` property on the event object.
* **select**: The user selected some text. * **select**: The user selected some text.