updateframe() with latest version

631 views
Skip to first unread message

darklandz

unread,
Sep 16, 2010, 6:21:53 AM9/16/10
to cleditor
Hi,

I updated to the latest version.

When i used the old version i updated the contents with
cleditor.updateFrame();

Apparently this does not work anymore with the last version ? can
someone point me out how to fix this ?


David

Chris Landowski

unread,
Sep 16, 2010, 10:16:28 AM9/16/10
to cled...@googlegroups.com
Hi David,

The .updateFrame() method is used internally in CLEditor and it appears to
be working just fine in the latest version. If you go to the demo page,
click the HTML button to switch into HTML mode, add some html tags, then
click the HTML button again to switch back to design view, the
.updateFrame() method gets called and the changes are reflected in the
editor.

Could you provide a sample of the problem you describe so that I can look
into it further?

Chris

David Herregat

unread,
Sep 17, 2010, 3:13:59 AM9/17/10
to cled...@googlegroups.com
Hi Chris,

The situation; i have a list with newsitems, when i click on the newsitem (to edit the news) i get the data from the database and i update the editor (that's where it fails)...

the function:

function editBericht(id) {

    var dataString = 'nieuwsId=' + id + '&aktie=bewerken';


    $.ajax({
        type: 'POST',
        url: '_backend.php',
        dataType:'json',
        data: dataString,
        success: function(data)
        {

            $('#formWrapper').show('fast');
            $('#knop_nieuwsbericht_toevoegen').hide();


            $('input[name=nieuws_titel]').val(data['nieuws_titel']);
            $('textarea[name=nieuws_inhoud]').val(data['nieuws_bericht']);
            if (data['nieuws_publiceren'] == '1') {
                $('input[name=nieuws_publiceren]').attr('checked', true);
            } else {
                $('input[name=nieuws_publiceren]').attr('checked', false);
            }
                       
            if (exiteditor == null) {
              
                exiteditor = new $("#nieuws_inhoud").cleditor();
               
            }

            $('input[name=saveType]').val('update');
            $('input[name=berichtid]').val(data['bericht_id']);
            $('input[name=siteid]').val(data['site_id']);
           
           // The line under this worked with the old version of the editor, i updated to the last version and this does not work anymore
         
            cleditor.updateFrame();

           

           

        }
    });

    return false;
}

Chris Landowski

unread,
Sep 17, 2010, 9:05:29 AM9/17/10
to cled...@googlegroups.com

Hi David,

 

You must have been working with version 1.0 and might want to review the What’s New page ( http://premiumsoftware.net/cleditor/docs/WhatsNew.html ) and the Getting Started page ( http://premiumsoftware.net/cleditor/docs/GettingStarted.html ). There have been a ton of changes since then.

 

For starters, you now create new instances of cleditor using the new jquery cleditor method as follows:

 

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="jquery.cleditor.css" />
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.cleditor.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        $("#input").cleditor();
      });
    </script>
  </head>
  <body>
    <textarea id="input" name="input"></textarea>
  </body>
</html>

 

The .cleditor() method returns a jquery array of editors. So, to execute the .updateFrame() method, you would do something like this:

var editor = $("#input").cleditor()[0];

editor.updateFrame();

 

Hope this helps,

Chris

Reply all
Reply to author
Forward
0 new messages