| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <title>Inline Editing by Code — CKEditor Sample</title> |
|---|
| 5 | <meta charset="utf-8"> |
|---|
| 6 | <script src="../ckeditor.js"></script> |
|---|
| 7 | <link href="sample.css" rel="stylesheet"> |
|---|
| 8 | <style> |
|---|
| 9 | #editable |
|---|
| 10 | { |
|---|
| 11 | padding: 10px; |
|---|
| 12 | float: left; |
|---|
| 13 | } |
|---|
| 14 | </style> |
|---|
| 15 | </head> |
|---|
| 16 | <body> |
|---|
| 17 | |
|---|
| 18 | <div id="set-to-true" contenteditable="true"> |
|---|
| 19 | This has contenteditable set to true. |
|---|
| 20 | </div> |
|---|
| 21 | |
|---|
| 22 | <div id="not-set"> |
|---|
| 23 | This does not have contenteditable set at all. |
|---|
| 24 | </div> |
|---|
| 25 | |
|---|
| 26 | <script> |
|---|
| 27 | // We need to turn off the automatic editor creation first. |
|---|
| 28 | CKEDITOR.disableAutoInline = true; |
|---|
| 29 | |
|---|
| 30 | var setToTrue = CKEDITOR.inline('set-to-true'); |
|---|
| 31 | setToTrue.once('instanceReady', function(e){ |
|---|
| 32 | |
|---|
| 33 | setToTrue.setReadOnly(false); |
|---|
| 34 | |
|---|
| 35 | //NOTE: Key 8 is listed but set to false |
|---|
| 36 | console.log(setToTrue.keystrokeHandler.blockedKeystrokes); |
|---|
| 37 | }); |
|---|
| 38 | |
|---|
| 39 | var notSet = CKEDITOR.inline('not-set'); |
|---|
| 40 | notSet.once('instanceReady', function(e){ |
|---|
| 41 | |
|---|
| 42 | notSet.setReadOnly(false); |
|---|
| 43 | |
|---|
| 44 | //NOTE: Key 8 is listed and set to true |
|---|
| 45 | console.log(notSet.keystrokeHandler.blockedKeystrokes); |
|---|
| 46 | |
|---|
| 47 | //NOTE: If key 8 is set to false then backspace will work again |
|---|
| 48 | // notSet.keystrokeHandler.blockedKeystrokes['8'] = false; |
|---|
| 49 | }); |
|---|
| 50 | |
|---|
| 51 | </script> |
|---|
| 52 | </body> |
|---|
| 53 | </html> |
|---|