Skip to content

Commit 9fa14a3

Browse files
authored
Merge pull request #189 from livingdocsIO/example-page-improvement
Example page improvement
2 parents 7dcf471 + 1540d8e commit 9fa14a3

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

examples/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import $ from 'jquery'
2-
import React, { Component, PropTypes } from 'react'
2+
import React, { Component } from 'react'
3+
import { PropTypes } from 'prop-types'
34
import ReactDOM from 'react-dom'
45
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
56

@@ -157,7 +158,6 @@ export default function (editable) {
157158
.on('paste', (elem, blocks, cursor) => {
158159
if (!isFromFirstExample(elem)) return
159160

160-
console.log(blocks)
161161
let text = blocks.join(' ')
162162
if (text.length > 40) text = text.substring(0, 38) + '...'
163163

@@ -201,7 +201,7 @@ export default function (editable) {
201201

202202
.on('switch', (elem, direction, cursor) => {
203203
if (!isFromFirstExample(elem)) return
204-
const content = direction === 'after'
204+
const content = direction === 'down'
205205
? 'Set the focus to the following block'
206206
: 'Set the focus to the previous block'
207207

examples/index.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,22 @@ <h2 class="example-title">iFrame</h2>
140140
<h2 class="example-title">Setup</h2>
141141

142142
<pre><code class="language-javascript">
143+
// create a new Editable object, and configure it as needed
143144
var editable = new Editable({
144-
// here you can pass an iframe window if required
145+
// here you can pass an iframe window if required (default: main window)
145146
window: window,
146147

147-
// activate the default behaviour for merge, split and insert
148+
// activate the default behaviour for merge, split and insert (default: true)
148149
defaultBehavior: true,
149150

150-
// fire selection events on mouse move
151+
// fire selection events on mouse move (default: false)
151152
mouseMoveSelectionChanges: false,
152153

153-
// control the 'spellcheck' attribute on editable elements
154+
// control the 'spellcheck' attribute on editable elements (default: true)
154155
browserSpellcheck: true
155156
});
156157

157-
// add and initialize a block element to be made editable
158+
// add and initialize a block element to make it editable
158159
editable.add(elem)
159160
</code></pre>
160161

@@ -204,7 +205,7 @@ <h2 class="example-title">Events</h2>
204205
<h4>
205206
<span>focus</span> <span>blur</span>
206207
</h4>
207-
<p>Fired when when editable block gets focus and after it is blurred. </p>
208+
<p>Fired when when an editable block gets focus and after it is blurred. </p>
208209

209210
<div class="code-example">
210211
<h3>Example:</h3>
@@ -253,7 +254,7 @@ <h3>Example:</h3>
253254
<h4>
254255
<span>cursor</span>
255256
</h4>
256-
<p>Fired when the user selects some text inside an editable block.</p>
257+
<p>Fired when the user moves the cursor within an editable block.</p>
257258

258259
<div class="code-example">
259260
<h3>Example:</h3>
@@ -275,7 +276,7 @@ <h3>Example:</h3>
275276
<h4>
276277
<span>change</span>
277278
</h4>
278-
<p>Fired when the user selects some text inside an editable block.</p>
279+
<p>Fired when the user changes the content of an editable block.</p>
279280

280281
<div class="code-example">
281282
<h3>Example:</h3>
@@ -336,7 +337,7 @@ <h3>Example:</h3>
336337
<h4>
337338
<span>insert</span>
338339
</h4>
339-
<p>Fired when the user presses enter (&#x23ce;) at the beginning or end of an editable (For example you can insert a new paragraph after the element if this happens).</p>
340+
<p>Fired when the user presses enter (&#x23ce;) at the beginning or end of an editable (for example you can insert a new paragraph after the element if this happens).</p>
340341

341342
<p class="edit-example">
342343
The end<span class="cursor">&nbsp;</span>
@@ -412,15 +413,15 @@ <h4>
412413
<span>switch</span>
413414
</h4>
414415

415-
<p>Fired when the user pressed an arrow key at the top or bottom so that you may want to set the cursor into the preceding or following editale element.</p>
416+
<p>Fired when the user presses an arrow key at the top or bottom so that you may want to set the cursor into the preceding or following editable element.</p>
416417

417418
<div class="code-example">
418419
<h3>Example:</h3>
419420
<pre><code class="language-javascript">
420421
editable.on('switch', (elem, direction, cursor) => {
421-
if (direction === 'after') {
422+
if (direction === 'down') {
422423
// your code...
423-
} else if (direction === 'before') {
424+
} else if (direction === 'up') {
424425
// your code...
425426
}
426427
})

0 commit comments

Comments
 (0)