magicfinger.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  4. For licensing, see LICENSE.md or http://ckeditor.com/license
  5. -->
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <title>Lineutils &mdash; CKEditor Sample</title>
  10. <script src="../../../ckeditor.js"></script>
  11. <link href="../../../samples/old/sample.css" rel="stylesheet">
  12. </head>
  13. <body>
  14. <h1 class="samples">
  15. <a href="../../../samples/old/index.html">CKEditor Samples</a> &raquo; Lineutils
  16. </h1>
  17. <h3>Classic (iframe-based) Editor</h3>
  18. <textarea id="editor1" cols="10" rows="10">
  19. <table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
  20. <tbody>
  21. <tr>
  22. <td>This table</td>
  23. <td>is the</td>
  24. <td>very first</td>
  25. <td>element of the document.</td>
  26. </tr>
  27. <tr>
  28. <td>We are still</td>
  29. <td>able to acces</td>
  30. <td>the space before it.</td>
  31. <td style="padding: 25px">
  32. <table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
  33. <tbody>
  34. <tr>
  35. <td>This table is inside of a cell of another table.</td>
  36. </tr>
  37. <tr>
  38. <td>We can type&nbsp;either before or after it though.</td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. <p>Two succesive horizontal lines (<tt>HR</tt> tags). We can access the space in between:</p>
  47. <hr />
  48. <hr />
  49. <ol style="width: 300px">
  50. <li>This numbered list...</li>
  51. <li>...is a neighbour of a horizontal line...</li>
  52. <li style="padding: 20px;">
  53. <ol>
  54. <li>Nested list!</li>
  55. </ol>
  56. </li>
  57. </ol>
  58. <ul style="width: 450px">
  59. <li>We can type between the lists...</li>
  60. <li>...thanks to <strong>Magicline</strong>.</li>
  61. </ul>
  62. <p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>
  63. <p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>
  64. <p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>
  65. <div id="last" style="padding: 10px; text-align: center;">
  66. <p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
  67. </div>
  68. </textarea>
  69. <h3>Inline Editor</h3>
  70. <div id="editor2" contenteditable="true" style="outline: 2px solid #ccc">
  71. <table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
  72. <tbody>
  73. <tr>
  74. <td>This table</td>
  75. <td>is the</td>
  76. <td>very first</td>
  77. <td>element of the document.</td>
  78. </tr>
  79. <tr>
  80. <td>We are still</td>
  81. <td>able to acces</td>
  82. <td>the space before it.</td>
  83. <td style="padding: 25px">
  84. <table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
  85. <tbody>
  86. <tr>
  87. <td>This table is inside of a cell of another table.</td>
  88. </tr>
  89. <tr>
  90. <td>We can type&nbsp;either before or after it though.</td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. </td>
  95. </tr>
  96. </tbody>
  97. </table>
  98. <p>Two succesive horizontal lines (<tt>HR</tt> tags). We can access the space in between:</p>
  99. <hr />
  100. <hr />
  101. <ol style="width: 300px">
  102. <li>This numbered list...</li>
  103. <li>...is a neighbour of a horizontal line...</li>
  104. <li style="padding: 20px;">
  105. <ol>
  106. <li>Nested list!</li>
  107. </ol>
  108. </li>
  109. </ol>
  110. <ul style="width: 450px">
  111. <li>We can type between the lists...</li>
  112. <li>...thanks to <strong>Magicline</strong>.</li>
  113. </ul>
  114. <p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>
  115. <p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>
  116. <p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>
  117. <div id="last" style="padding: 10px; text-align: center;">
  118. <p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
  119. </div>
  120. </div>
  121. <h3>Extreme inline</h3>
  122. <div id="editor3" contenteditable="true" style="left: 123px; outline: 1px solid red; border: 15px solid green; position: relative; top: 30; left: 30px;">
  123. <div style="padding: 20px; background: gray; width: 300px" class="1">Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim.</div>
  124. <div style="background: violet; padding: 30px;" class="static">
  125. Position static
  126. <div style="background: green; padding: 30px; border: 14px solid orange">foo</div>
  127. </div>
  128. <dl class="2">
  129. <dt>Key</dt><dd>Value</dd>
  130. </dl>
  131. <div>Whatever</div>
  132. <hr id="hr">
  133. <p>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies</p>
  134. <hr>
  135. <hr>
  136. <p>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies</p>
  137. <div style="background: green; padding: 30px; width: 200px">foo</div>
  138. </div>
  139. <h3>Classic (iframe-based) Editor, H-scroll</h3>
  140. <textarea id="editor4" cols="10" rows="10">
  141. <hr />
  142. <hr />
  143. <ol style="width: 1500px">
  144. <li>This numbered list...</li>
  145. <li>...is a neighbour of a horizontal line...</li>
  146. <li style="padding: 20px;">
  147. <ol>
  148. <li>Nested list!</li>
  149. </ol>
  150. </li>
  151. </ol>
  152. <ul style="width: 450px">
  153. <li>We can type between the lists...</li>
  154. <li>...thanks to <strong>Magicline</strong>.</li>
  155. </ul>
  156. <p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>
  157. <p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>
  158. <p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>
  159. <div id="last" style="padding: 10px; text-align: center;">
  160. <p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
  161. </div>
  162. </textarea>
  163. <script>
  164. CKEDITOR.addCss(
  165. '.cke_editable * { outline: 1px solid #BCEBFF }'
  166. );
  167. function callback() {
  168. var helpers = CKEDITOR.plugins.lineutils;
  169. var liner = new helpers.liner( this );
  170. var locator = new helpers.locator( this );
  171. var finder = new helpers.finder( this, {
  172. lookups: {
  173. 'is block and first child': function( el ) {
  174. if ( el.is( CKEDITOR.dtd.$listItem ) )
  175. return;
  176. if ( el.is( CKEDITOR.dtd.$block ) )
  177. return CKEDITOR.LINEUTILS_BEFORE | CKEDITOR.LINEUTILS_AFTER;
  178. }
  179. }
  180. } ).start( function( relations, x, y ) {
  181. locator.locate( relations );
  182. var locations = locator.locations,
  183. uid, type;
  184. liner.prepare( relations, locations );
  185. for ( uid in locations ) {
  186. for ( type in locations[ uid ] )
  187. liner.placeLine( { uid: uid, type: type } );
  188. }
  189. liner.cleanup();
  190. } );
  191. }
  192. CKEDITOR.disableAutoInline = true;
  193. CKEDITOR.replace( 'editor1', {
  194. extraPlugins: 'lineutils',
  195. height: 450,
  196. removePlugins: 'magicline',
  197. allowedContent: true,
  198. contentsCss: [ '../../../contents.css' ],
  199. on: {
  200. contentDom: callback
  201. }
  202. } );
  203. CKEDITOR.inline( 'editor2', {
  204. extraPlugins: 'lineutils',
  205. removePlugins: 'magicline',
  206. allowedContent: true,
  207. contentsCss: [ '../../../contents.css' ],
  208. on: {
  209. contentDom: callback
  210. }
  211. } );
  212. CKEDITOR.inline( 'editor3', {
  213. extraPlugins: 'lineutils',
  214. removePlugins: 'magicline',
  215. allowedContent: true,
  216. contentsCss: [ '../../../contents.css' ],
  217. on: {
  218. contentDom: callback
  219. }
  220. } );
  221. CKEDITOR.replace( 'editor4', {
  222. extraPlugins: 'lineutils',
  223. removePlugins: 'magicline',
  224. allowedContent: true,
  225. contentsCss: [ '../../../contents.css' ],
  226. on: {
  227. contentDom: callback
  228. }
  229. } );
  230. </script>
  231. <div id="footer">
  232. <hr>
  233. <p>
  234. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  235. </p>
  236. <p id="copy">
  237. Copyright &copy; 2003-2015, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  238. Knabben. All rights reserved.
  239. </p>
  240. </div>
  241. </body>
  242. </html>