|
| 1 | +# WYSIWYG inline editor |
| 2 | + |
| 3 | +The "WYSIWYG inline editor" component is an extra component which will be use in the upcoming [DeckDeckGo] Studio. |
| 4 | + |
| 5 | +## Table of contents |
| 6 | + |
| 7 | +- [Showcase](#app-components-qrcode-showcase) |
| 8 | +- [Getting started](#app-components-qrcode-getting-started) |
| 9 | + - [Using from a CDN](#app-components-from-a-cdn) |
| 10 | + - [Install from NPM](#app-components-from-npm) |
| 11 | + - [Framework integration](#app-components-qrcode-framework-integration) |
| 12 | +- [Usage](#app-components-qrcode-usage) |
| 13 | + - [Properties](#app-components-qrcode-properties) |
| 14 | + - [Styling](#app-components-qrcode-styling) |
| 15 | + - [Examples](#app-components-qrcode-examples) |
| 16 | + |
| 17 | +## Showcase |
| 18 | + |
| 19 | +<div> |
| 20 | + <h1 style={{color: '#3880ff'}}>DeckDeckGo (editable title)</h1> |
| 21 | + |
| 22 | + <h2 style={{color: '#3880ff'}}>The Progressive Web App alternative for simple presentations 🚀 (editable subtitle)</h2> |
| 23 | + |
| 24 | + <p style={{color: '#3880ff'}}>Edit anywhere, display everywhere (editable paragraph)</p> |
| 25 | +</div> |
| 26 | + |
| 27 | +<deckgo-inline-editor sticky-desktop="true" sticky-mobile="true"></deckgo-inline-editor> |
| 28 | + |
| 29 | +## Getting started |
| 30 | + |
| 31 | +This Web Component is an inline WYSIWYG HTML Editor, It creates a floating editor bar or a sticky footer bar that shows up when you select a piece of text of your page. |
| 32 | + |
| 33 | +To add the component to your web applications, it could be use directly in your project from a CDN, using a simple script include, or could be installed from [npm](https://www.npmjs.com/package/deckdeckgo-qrcode). |
| 34 | + |
| 35 | +### Using from a CDN |
| 36 | + |
| 37 | +It's recommended to use [unpkg](https://unpkg.com/) to use the [DeckDeckGo] inline editor from a CDN. To do so, add the following include script in the main HTML file of your project: |
| 38 | + |
| 39 | +``` |
| 40 | +<script src="https://unpkg.com/deckdeckgo-inline-editor@latest/dist/deckdeckgo-inline-editor.js"></script> |
| 41 | +``` |
| 42 | +### Install from NPM |
| 43 | + |
| 44 | +Install it in your project from [npm](https://www.npmjs.com/package/deckdeckgo-qrcode) using the following command: |
| 45 | + |
| 46 | +```bash |
| 47 | +npm install deckdeckgo-inline-editor |
| 48 | +``` |
| 49 | + |
| 50 | +### Framework integration |
| 51 | + |
| 52 | +The [Stencil documentation](https://stenciljs.com/docs/overview) provide examples of framework integration for [Angular](https://stenciljs.com/docs/angular), [React](https://stenciljs.com/docs/react), [Vue](https://stenciljs.com/docs/vue) and [Ember](https://stenciljs.com/docs/ember). |
| 53 | + |
| 54 | +## Usage |
| 55 | + |
| 56 | +The `<deckgo-inline-editor/>` should be added once only in your page. It will interact with all elements of types `p`, `h1`, `h2` and `h3` you would have set as `contenteditable`. |
| 57 | + |
| 58 | +### Properties |
| 59 | + |
| 60 | +The `<deckgo-inline-editor/>` expose the following properties: |
| 61 | + |
| 62 | +| Property | Attribute | Description | Type | Default | |
| 63 | +| --------------------- | ----------------------- | ----------- | --------- | ----------- | |
| 64 | +| `mobile` | `mobile` | The mobile mode is automatically recognize, but just it case you would like to "force" it | `boolean` | `false` or `true` according the device | |
| 65 | +| `stickyDesktop` | `sticky-desktop` | Use a sticky footer toolbar on desktop | `boolean` | `false` | |
| 66 | +| `stickyMobile` | `sticky-mobile` | Use a sticky footer toolbar on mobile. Note: except iOS, feel free to send a PR if you know how to handle this with the software keyboard | `boolean` | `false` | |
| 67 | +| `toolbarOffsetStart` | `toolbar-offset-start` | A left offset for the toolbar when not sticky | `number` | `undefined` | |
| 68 | +| `toolbarOffsetTop` | `toolbar-offset-top` | A top offset for the toolbar when not sticky | `number` | `undefined` | |
| 69 | + |
| 70 | +### Styling |
| 71 | + |
| 72 | +The `<deckgo-inline-editor/>` could be styled using the following CSS4 variables which would only applies on the type `<svg/>`: |
| 73 | + |
| 74 | +| CSS4 variable | Default | Note | |
| 75 | +| -------------------------- |-----------------|-----------------| |
| 76 | +| --deckgo-inline-editor-background-top | rgba(56, 128, 255, .99) | The top background of the toolbar (linear gradient) | |
| 77 | +| --deckgo-inline-editor-background-bottom | #3171e0 | The bottom background of the toolbar (linear gradient) | |
| 78 | +| --deckgo-inline-editor-border-radius | 8px | The border radius of the toolbar | |
| 79 | +| --deckgo-inline-editor-padding | 0 8px | The padding of the toolbar | |
| 80 | +| --deckgo-inline-editor-zindex | 1 | The z-Index of the toolbar | |
| 81 | +| --deckgo-inline-editor-sticky-bottom | 0 | The bottom attribute of the sticky toolbar | |
| 82 | +| --deckgo-inline-editor-separator-background | rgba(255, 255, 255, .2) | The color of the separator | |
| 83 | +| --deckgo-inline-editor-button-color | #fff | The buttons color | |
| 84 | +| --deckgo-inline-editor-button-font-size | 1.4rem | The buttons font size | |
| 85 | +| --deckgo-inline-editor-button-font-family | inherit | The buttons font family | |
| 86 | +| --deckgo-inline-editor-button-font-size-h2 | 1.2rem | The button h2 font size | |
| 87 | +| --deckgo-inline-editor-button-font-size-h3 | 1rem | The button h3 font size | |
| 88 | +| --deckgo-inline-editor-button-color-active | #ffce00 | The color of the buttons when active | |
| 89 | +| --deckgo-inline-editor-button-color-disabled | #4c8dff | The color of the buttons when disabled | |
| 90 | +| --deckgo-inline-editor-link-color | #fff | The color of the input field for the url | |
| 91 | +| --deckgo-inline-editor-link-placeholder-color | #fff | Ther color of the placeholder of the input field for the url | |
| 92 | + |
| 93 | +Furthermore, the following variables are also available but only have an effects on mobile devices: |
| 94 | + |
| 95 | +| CSS4 variable | Default | Note | |
| 96 | +| -------------------------- |-----------------|-----------------| |
| 97 | +| --deckgo-inline-editor-mobile-box-shadow | 0 0px 1px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.15) | A box shadow for the toolbar | |
| 98 | +| --deckgo-inline-editor-mobile-background-top | #fff | ** | |
| 99 | +| --deckgo-inline-editor-mobile-background-bottom | #fff | ** | |
| 100 | +| --deckgo-inline-editor-button-mobile-color-active | #3880ff | ** | |
| 101 | +| --deckgo-inline-editor-button-mobile-color-disabled | #f4f5f8 | ** | |
| 102 | +| --deckgo-inline-editor-separator-mobile-background | #f4f5f8 | ** | |
| 103 | +| --deckgo-inline-editor-link-mobile-color | inherit | ** | |
| 104 | +| --deckgo-inline-editor-link-mobile-placeholder-color | inherit | ** | |
| 105 | + |
| 106 | +** like above but for mobile |
| 107 | + |
| 108 | +### Examples |
| 109 | + |
| 110 | +``` |
| 111 | +<p contenteditable>This text will be editable</p> |
| 112 | +
|
| 113 | +<h1 contenteditable>This title too</h1> |
| 114 | +
|
| 115 | +<deckgo-inline-editor></deckgo-inline-editor> |
| 116 | +``` |
| 117 | + |
| 118 | +[DeckDeckGo]: https://deckdeckgo.com |
0 commit comments