sample12.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <!--
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2009 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * Sample page.
  23. -->
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <title>FCKeditor - Sample</title>
  27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  28. <meta name="robots" content="noindex, nofollow" />
  29. <link href="../sample.css" rel="stylesheet" type="text/css" />
  30. <script type="text/javascript" src="../../fckeditor.js"></script>
  31. <script type="text/javascript">
  32. <!--
  33. // The following function is used in this samples to reload the page,
  34. // setting the querystring parameters for the enter mode.
  35. function ChangeMode()
  36. {
  37. var sEnterMode = document.getElementById('xEnter').value ;
  38. var sShiftEnterMode = document.getElementById('xShiftEnter').value ;
  39. window.location.href = window.location.pathname + '?enter=' + sEnterMode + '&shift=' + sShiftEnterMode ;
  40. }
  41. -->
  42. </script>
  43. </head>
  44. <body>
  45. <h1>
  46. FCKeditor - JavaScript - Sample 12</h1>
  47. <div>
  48. This sample shows the different ways to configure the [Enter] key behavior on FCKeditor.
  49. </div>
  50. <hr />
  51. <table cellpadding="0" cellspacing="0" border="0">
  52. <tr>
  53. <td>
  54. When [Enter] is pressed:&nbsp;
  55. </td>
  56. <td>
  57. <select id="xEnter" onchange="ChangeMode();">
  58. <option value="p" selected="selected">Create new &lt;P&gt;</option>
  59. <option value="div">Create new &lt;DIV&gt;</option>
  60. <option value="br">Break the line with a &lt;BR&gt;</option>
  61. </select>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td>
  66. When [Shift] + [Enter] is pressed:&nbsp;
  67. </td>
  68. <td>
  69. <select id="xShiftEnter" onchange="ChangeMode();">
  70. <option value="p">Create new &lt;P&gt;</option>
  71. <option value="div">Create new &lt;DIV&gt;</option>
  72. <option value="br" selected="selected">Break the line with a &lt;BR&gt;</option>
  73. </select>
  74. </td>
  75. </tr>
  76. </table>
  77. <br />
  78. <form action="../php/sampleposteddata.php" method="post" target="_blank">
  79. <script type="text/javascript">
  80. <!--
  81. // Automatically calculates the editor base path based on the _samples directory.
  82. // This is usefull only for these samples. A real application should use something like this:
  83. // oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
  84. var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
  85. // The following are the default configurations for the Enter and Shift+Enter modes.
  86. var sEnterMode = 'p' ;
  87. var sShiftEnterMode = 'br' ;
  88. // Try to get the new configurations from the querystring, if available.
  89. if ( document.location.search.length > 1 )
  90. {
  91. var aMatch = document.location.search.match( /enter=(p|div|br)/ ) ;
  92. if ( aMatch )
  93. sEnterMode = aMatch[1] ;
  94. aMatch = document.location.search.match( /shift=(p|div|br)/ ) ;
  95. if ( aMatch )
  96. sShiftEnterMode = aMatch[1] ;
  97. }
  98. // Create the FCKeditor instance.
  99. var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
  100. oFCKeditor.BasePath = sBasePath ;
  101. oFCKeditor.Value = 'This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.' ;
  102. // Set the configuration options for the Enter Key mode.
  103. oFCKeditor.Config["EnterMode"] = sEnterMode ;
  104. oFCKeditor.Config["ShiftEnterMode"] = sShiftEnterMode ;
  105. oFCKeditor.Create() ;
  106. // Update the select combos with the current values.
  107. document.getElementById('xEnter').value = sEnterMode ;
  108. document.getElementById('xShiftEnter').value = sShiftEnterMode ;
  109. //-->
  110. </script>
  111. <br />
  112. <input type="submit" value="Submit" />
  113. </form>
  114. </body>
  115. </html>