events.asp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <%@ codepage="65001" language="VBScript" %>
  2. <% Option Explicit %>
  3. <!-- #INCLUDE file="../../ckeditor.asp" -->
  4. <%
  5. ' You must set "Enable Parent Paths" on your web site
  6. ' in order for the above relative include to work.
  7. ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
  8. %>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <!--
  11. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  12. For licensing, see LICENSE.html or http://ckeditor.com/license
  13. -->
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <title>Sample - CKEditor</title>
  17. <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
  18. <link href="../sample.css" rel="stylesheet" type="text/css"/>
  19. </head>
  20. <body>
  21. <h1 class="samples">
  22. CKEditor Sample
  23. </h1>
  24. <!-- This <div> holds alert messages to be display in the sample page. -->
  25. <div id="alerts">
  26. <noscript>
  27. <p>
  28. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  29. support, like yours, you should still see the contents (HTML data) and you should
  30. be able to edit it normally, without a rich editor interface.
  31. </p>
  32. </noscript>
  33. </div>
  34. <!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
  35. <fieldset title="Output">
  36. <legend>Output</legend>
  37. <form action="sample_posteddata.asp" method="post">
  38. <p>
  39. <label>Editor 1:</label><br/>
  40. </p>
  41. <%
  42. ''
  43. ' Adds global event, will hide "Target" tab in Link dialog in all instances.
  44. '
  45. function CKEditorHideLinkTargetTab(editor)
  46. dim functionCode
  47. functionCode = "function (ev) {" & vbcrlf & _
  48. "// Take the dialog name and its definition from the event data" & vbcrlf & _
  49. "var dialogName = ev.data.name;" & vbcrlf & _
  50. "var dialogDefinition = ev.data.definition;" & vbcrlf & _
  51. "" & vbcrlf & _
  52. "// Check if the definition is from the Link dialog." & vbcrlf & _
  53. "if ( dialogName == 'link' )" & vbcrlf & _
  54. " dialogDefinition.removeContents('target')" & vbcrlf & _
  55. "}" & vbcrlf
  56. editor.addGlobalEventHandler "dialogDefinition", functionCode
  57. end function
  58. ''
  59. ' Adds global event, will notify about opened dialog.
  60. '
  61. function CKEditorNotifyAboutOpenedDialog(editor)
  62. dim functionCode
  63. functionCode = "function (evt) {" & vbcrlf & _
  64. "alert('Loading dialog: ' + evt.data.name);" & vbcrlf & _
  65. "}"
  66. editor.addGlobalEventHandler "dialogDefinition", functionCode
  67. end function
  68. dim editor, initialValue
  69. ' Create class instance.
  70. set editor = new CKEditor
  71. ' Set configuration option for all editors.
  72. editor.config("width") = 750
  73. ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
  74. ' editor.basePath = "/ckeditor/"
  75. ' If not set, CKEditor will default to /ckeditor/
  76. editor.basePath = "../../"
  77. ' The initial value to be displayed in the editor.
  78. initialValue = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://ckeditor.com/"">CKEditor</a>.</p>"
  79. ' Event that will be handled only by the first editor.
  80. editor.addEventHandler "instanceReady", "function (evt) { alert('Loaded editor: ' + evt.editor.name );}"
  81. ' Create first instance.
  82. editor.editor "editor1", initialValue
  83. ' Clear event handlers, instances that will be created later will not have
  84. ' the 'instanceReady' listener defined a couple of lines above.
  85. editor.clearEventHandlers empty
  86. %>
  87. <p>
  88. <label>Editor 2:</label><br/>
  89. </p>
  90. <%
  91. ' Configuration that will be used only by the second editor.
  92. editor.instanceConfig("width") = 600
  93. editor.instanceConfig("toolbar") = "Basic"
  94. ' Add some global event handlers (for all editors).
  95. CKEditorHideLinkTargetTab(editor)
  96. CKEditorNotifyAboutOpenedDialog(editor)
  97. ' Event that will be handled only by the second editor.
  98. editor.addInstanceEventHandler "instanceReady", "function (evt) { alert('Loaded second editor: ' + evt.editor.name );}"
  99. ' Create second instance.
  100. editor.editor "editor2", initialValue
  101. %>
  102. <p>
  103. <input type="submit" value="Submit"/>
  104. </p>
  105. </form>
  106. </fieldset>
  107. <div id="footer">
  108. <hr />
  109. <p>
  110. CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  111. </p>
  112. <p id="copy">
  113. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  114. Knabben. All rights reserved.
  115. </p>
  116. </div>
  117. </body>
  118. </html>