annotate sites/all/libraries/ckeditor/_samples/asp/events.asp @ 0:ff03f76ab3fe

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