Changeset 6831


Ignore:
Timestamp:
05/01/11 17:12:10 (3 years ago)
Author:
wwalc
Message:

Corrected samples, renamed addEvent into addEventHandler

Location:
CKEditor.Java
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CKEditor.Java/ckeditor-java-core/trunk/src/main/java/com/ckeditor/EventHandler.java

    r6796 r6831  
    3535         * @param jsCode JavaScript anonymous function or a function name 
    3636         */ 
    37         public void addEvent(final String event, final String jsCode) {  
     37        public void addEventHandler(final String event, final String jsCode) { 
    3838                if (events.get(event) == null) { 
    3939                        events.put(event, new LinkedHashSet<String>()); 
  • CKEditor.Java/ckeditor-java/trunk/src/main/webapp/_samples/advanced.jsp

    r6791 r6831  
    2222                CKEditor Sample &mdash; Creating CKEditor Instances 
    2323        </h1> 
     24        <div class="description"> 
     25        <p> 
     26                This sample shows how to add event handlers to CKEditor with PHP. 
     27        </p> 
     28        <p> 
     29                A snippet of the configuration code can be seen below; check the source code of this page for 
     30                the full definition: 
     31        </p> 
     32        <pre class="samples"> 
     33&lt;%  
     34CKEditorConfig settings = new CKEditorConfig(); 
     35settings.addConfigValue("skin", "office2003"); 
     36EventHandler eventHandler = new EventHandler(); 
     37eventHandler.addEventHandler("instanceReady", "function (ev) { alert(\"Loaded: \" + ev.editor.name); }"); 
     38%&gt; 
     39 
     40&lt;ckeditor:editor basePath="/ckeditor/" config="&lt;%=settings %&gt;" editor="editor1" events="&lt;%=eventHandler %&gt;"/&gt; 
     41 
     42&lt;% 
     43settings.removeConfigValue("skin"); 
     44settings.addConfigValue("uiColor", "#ADE82E"); 
     45settings.addConfigValue("toolbar", "[['Format'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript']]"); 
     46%&gt; 
     47 
     48&lt;ckeditor:replace basePath="/ckeditor/" config="&lt;%=settings %&gt;" replace="editor2" /&gt; 
     49        </pre> 
     50        </div> 
    2451        <!-- This <div> holds alert messages to be display in the sample page. --> 
    2552        <div id="alerts"> 
     
    4168                        <%  
    4269                                String value = "My first CKEditor Java tag";  
    43                                 CKEditorConfig config2 = new CKEditorConfig(); 
    44                                 config2.addConfigValue("width", "80%"); 
    45                                 config2.addConfigValue("toolbar", "Basic"); 
     70                                CKEditorConfig settings = new CKEditorConfig(); 
     71                                settings.addConfigValue("skin", "office2003"); 
    4672                                EventHandler eventHandler = new EventHandler(); 
    47                                 eventHandler.addEvent("instanceReady", "function (ev) { alert(\"Loaded: \" + ev.editor.name); }"); 
     73                                eventHandler.addEventHandler("instanceReady", "function (ev) { alert(\"Loaded: \" + ev.editor.name); }"); 
    4874                        %> 
    49                         <ckeditor:editor basePath="../ckeditor/" config="<%=config2 %>" 
     75                        <ckeditor:editor basePath="../ckeditor/" config="<%=settings %>" 
    5076                                 editor="editor1" value="<%= value %>" 
    5177                                 events="<%=eventHandler %>"/> 
     
    5783                </p> 
    5884                <% 
    59                         config2.removeConfigValue("width"); 
    60                         config2.addConfigValue("toolbar", "[['Styles'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript']]"); 
    61                         config2.addConfigValue("stylesSet", "[{name : 'Strong Emphasis', element : 'strong'}, {name : 'Emphasis', element : 'em'}, {name : 'Computer Code', element : 'code'}]"); 
     85                        settings.removeConfigValue("skin"); 
     86                        settings.addConfigValue("uiColor", "#ADE82E"); 
     87                        settings.addConfigValue("toolbar", "[['Format'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript']]"); 
    6288                %> 
    63                 <ckeditor:replace basePath="../ckeditor/" config="<%=config2 %>" replace="editor2" /> 
     89                <ckeditor:replace basePath="../ckeditor/" config="<%=settings %>" replace="editor2" /> 
    6490                <input type="submit" value="Submit"/> 
    6591        </form> 
  • CKEditor.Java/ckeditor-java/trunk/src/main/webapp/_samples/index.jsp

    r6775 r6831  
    2424                <li><a class="samples" href="standalone.jsp">Create CKEditor instances in Java</a><br /> 
    2525                Creating a CKEditor instance (no initial textarea element is required).</li> 
    26                 <li><a class="samples" href="advanced.jsp">Create CKEditor instances in Java with eventHandler</a><br /> 
     26        </ul> 
     27        <h2 class="samples"> 
     28                Advanced Samples 
     29        </h2> 
     30        <ul> 
     31                <li><a class="samples" href="advanced.jsp">Create CKEditor instances in Java with event handler</a><br /> 
    2732                Creating a CKEditor instance (no initial textarea element is required) with advanced settings.</li> 
    2833        </ul> 
  • CKEditor.Java/ckeditor-java/trunk/src/main/webapp/_samples/replace.jsp

    r6790 r6831  
    2222                This sample shows how to replace a selected <code>&lt;textarea&gt;</code> element 
    2323                with a CKEditor instance by using Java code. 
     24        </p> 
     25        <p> 
     26                To replace a <code>&lt;textarea&gt;</code> element, place the following call at any point 
     27                after the <code>&lt;textarea&gt;</code> element: 
     28        </p> 
     29        <pre class="samples"> 
     30&lt;ckeditor:replace replace="textarea_id" basePath="/ckeditor/" /&gt;</pre> 
     31        <p> 
     32                Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of 
     33                the <code>&lt;textarea&gt;</code> element to be replaced. 
    2434        </p> 
    2535        </div> 
  • CKEditor.Java/ckeditor-java/trunk/src/main/webapp/_samples/replaceAll.jsp

    r6790 r6831  
    2525                after the last <code>&lt;textarea&gt;</code> element: 
    2626        </p>     
     27        <pre class="samples"> 
     28&lt;ckeditor:replaceAll basePath="/ckeditor/" /&gt;</pre> 
    2729        </div> 
    2830        <!-- This <div> holds alert messages to be displayed in the sample page. --> 
  • CKEditor.Java/ckeditor-java/trunk/src/main/webapp/_samples/standalone.jsp

    r6791 r6831  
    3030                        </p> 
    3131                </noscript> 
     32        </div> 
     33        <div class="description"> 
     34        <p> 
     35                This sample shows how to create a CKEditor instance with Java. 
     36        </p> 
     37        <pre class="samples"> 
     38&lt;%  
     39String value = "My first &lt;strong>CKEditor&lt;/strong&gt; Java tag"; 
     40 
     41CKEditorConfig settings = new CKEditorConfig(); 
     42settings.addConfigValue("width", "500"); 
     43settings.addConfigValue("toolbar", "Basic"); 
     44%&gt; 
     45 
     46&lt;ckeditor:editor basePath="/ckeditor/" config="&lt;%=settings %&gt;" editor="textarea_id" value="&lt;%= value %&gt;"/&gt;</pre> 
     47        <p> 
     48                Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of 
     49                the <code>&lt;textarea&gt;</code> element that will be created. 
     50        </p> 
    3251        </div> 
    3352        <!-- This <fieldset> holds the HTML code that you will usually find in your pages. --> 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy