This discussion is archived
3 Replies Latest reply: Jan 29, 2013 2:36 AM by SathishJS RSS

Apex 4.2 CKEditor template hit some errors

564403 Newbie
Currently Being Moderated
Dear all,

The first issue is my CKEditor templates work well in Apex 4.1, but after upgrade Apex4.1 to Apex4, click template icon and tick "Replace actual contents" and select my own template, the template has no response. if I un-select "Replace actual contents", my template works fine.

The second issue is if I un-select "Replace actual contents", my template content is displayed in textarea, then I save it to database, the page(let's say page1) is redirected to another page(let's say page2). In page2, there is button "Edit", click "Edit", page1 is opened and load data to textarea, but page1 appears to hang and gives a message that a script has stopped working :
Script: http://server/i/libraries/ckeditor/3.6.4/ckeditor.js:29

Thanks in advance.

Maggie
  • 1. Re: Apex 4.2 CKEditor template hit some errors
    SathishJS Explorer
    Currently Being Moderated
    I am confused with your Question, i need more information / clarification on what is the issue / expected behavior

    The first issue is my CKEditor templates work well in Apex 4.1, but after upgrade Apex4.1 to Apex4, click template icon and tick "Replace actual contents" and select my own template, the template has no response. if I un-select "Replace actual contents", my template works fine.

    Based on above question, want to know what do you mean by CkEditor Templates.
    Upgrade of exact version to version ? I see you are Upgrading Apex4.1 to Apex4, does not look like a upgrade to me.

    The second issue which you described here is completely confusing.

    Can you please give some detailed information on the issue with clear steps to recreate this issue.

    thanks
    JS
  • 2. Re: Apex 4.2 CKEditor template hit some errors
    564403 Newbie
    Currently Being Moderated
    Hi JS,

    Thanks for your reply and sorry for making you confused.

    Currently my apex version is 4.2.
    The first issue is: I created my template javascript file and put it on Apex server. In my apex application, let say page 1, there is a textarea with CKEditor, I can see my template. when I select my template, there is an option "Replace actual contents"(seems it's added by ckeditor ), if I select "Replace actual contents", my template does not work, but if I don't select it, my template works fine.

    The second issue is : In a page 1, I select my templates so that the content of my template is pulled into the textarea, then I save the contents which are in textarea, now the page 1 is closed. In page2, there is a button, if user clicks this button, page is redirected to page 1 for user to edit textarea.
    but page 1 appears to hang, and gives a message that a script has stopped working :
    Script: http://server/i/libraries/ckeditor/3.6.4/ckeditor.js:29
    Actually the second issue maybe caused by reloading my template javascript file.

    Hope my expression is clear.

    Thanks & Regards.
    Maggie
  • 3. Re: Apex 4.2 CKEditor template hit some errors
    SathishJS Explorer
    Currently Being Moderated
    Hi,

    Sorry for the delay and here are my findings and am unable to reproduce your issue. I have a Apex Upgrade and running on version 4.2.1.00.08.

    The steps which i followed are below.

    1. Copied the Templates under plugins/templates/templates/default.js to mytemplate.js and modified the content of mytemplate.js to the following
    // Register a template definition set named "default".
    CKEDITOR.addTemplates( 'default',
    {
        // The name of the subfolder that holds the preview images of the templates.
        imagesPath:CKEDITOR.getUrl(CKEDITOR.plugins.getPath('templates')+'templates/images/'),
    
        // The template definitions.
        templates :
            [
                {
                    title: 'My Template 1',
                    image: 'template1.gif',
                    description: 'Description of My Template 1.',
                    html:
                        '<h2>Template 1</h2>' +
                        '<p><img src="/logo.png" style="float:left" />Type your text here.</p>'
                },
                {
                    title: 'My Template 2',
                    image: 'template2.gif',
                    description: 'Description of My Template 2.',
                    html:
                        '<h3>Template 2</h3>' +
                        '<p>Type your text here.</p>'
                }
            ]
    });
    Step 2: Modified 3.6.4/config.js and added the following entry config.templates_files = [ CKEDITOR.plugins.getPath( 'templates' ) + 'templates/mytemplate.js' ];

    so your config file will look like
    CKEDITOR.editorConfig = function( config )
    {
        // Define changes to default configuration here. For example:
        // config.language = 'fr';
        // config.uiColor = '#AADC6E';
        config.templates_files = [ CKEDITOR.plugins.getPath( 'templates' ) + 'templates/mytemplate.js' ];
    };
    Step 3: Since i am using Embedded PL/SQL gateway modified imagelist.xml added the entry (for the mytemplate.js)
           <file>/libraries/ckeditor/3.6.4/plugins/templates/templates/mytemplate.js</file>        
    just below the following entry
      <file>/libraries/ckeditor/3.6.4/plugins/templates/templates/default.js</file>
    Step 4: Ran the apxldimg.sql with the necessary parameters and no issues.

    Step 5: Ran the page which has TextArea and clicked on the Templates icon can see the two custom templates which was added to mytemplates.js and selected one of the them with the "Replace Actual Contents" checkbox checked or selected, can see the content in the TextArea and submitted the page to Page 2 and clicked on the button which redirects back to page 1. I can see the HTML Template content in the textArea no issues.


    Step 6: The above step also tested with "Replace Actual Content" checkbox unchecked or not selected, works fine without errors or issues.

    The above testing is done on IE, FF, Chrome and Safari browsers.

    The issue maybe because of Browser cache, recommend to clear the browser cache and try again, also check whether the necessary entries and references in the config.js and mytemplates.js files are proper.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points