change event doesn't fire

927 views
Skip to first unread message

ADV

unread,
Jul 5, 2011, 6:37:04 AM7/5/11
to cleditor
Hello, cleditor is realy cool control but i need to validate page on
text change, as i saw in documentaing i've just need to write smt like
this:

$("#Editor").change(fucntion() {
alert("changed!");
});

What i'm doing wrong?

younss AIT MOU

unread,
Jul 5, 2011, 1:17:50 PM7/5/11
to cled...@googlegroups.com
The event will fire when you click outside the editor:
example of use:

$("#mytextarea").cleditor().change(function (){alert("you are out of the editor")});

hope this helps ;)

2011/7/5 ADV <denis....@hotmail.com>

pierre lafitte

unread,
Jul 20, 2011, 2:25:03 AM7/20/11
to cleditor
Hi, I'm using version 1.3.0 of the cleditor,
the following code is unofficial,
I might be bad code, because I'm oop noob AND for many other reasons,
but until the next release it does the trick for me :
here is what I did :


In file jquery.cleditor.js :

add a trickyMethod option :
line 100 :

replace this
imagesPath: function() { return imagesPath(); },
by this :
imagesPath: function() { return imagesPath(); },
trickyMethod: function(){}


Make the trickyMethod be called on keyup event :
line :878

replace this :

$doc.click(hidePopups)
.bind("keyup mouseup", function() {
refreshButtons(editor);
});




by this :


$doc.click(hidePopups)
.bind("keyup mouseup", function() {
refreshButtons(editor);
editor.options.trickyMethod(editor);
});



Now you can go in your application code and invoke the cleditor with
the trickyMethod option :

$("#input").cleditor({
width: 600,
height: 600,
trickyMethod: function(){ alert("sdf"); }
});

Message has been deleted

Anthony Guzzo

unread,
Nov 14, 2011, 12:29:24 PM11/14/11
to cled...@googlegroups.com
I tried your suggestion in my code.  I'm received this message instead:
Object doesn't support this property or method.

To get the .change to work I had to write my code like this:

        $(document).ready(function() {
            var editor = $("#TestDescription").cleditor();
            editor.change(function() {
                alert("you are out of the editor");
            });
        });

Jake Barlow

unread,
Nov 14, 2011, 12:49:17 PM11/14/11
to cled...@googlegroups.com

Try:

$("#mytextarea").cleditor()[0].change(function (){alert("you are out of the editor")});

 

I'm not sure it will work or not

 

 

sig

Jake Barlow

 

From: cled...@googlegroups.com [mailto:cled...@googlegroups.com] On Behalf Of Anthony Guzzo
Sent: Monday, November 14, 2011 8:51 AM
To: cled...@googlegroups.com
Subject: Re: change event doesn't fire

 

 

I tried using this code:

$("#mytextarea").cleditor().change(function (){alert("you are out of the editor")});

 

I do not see the alert message.

 

Below is the code I am using.  Is there anything wrong here?

        $(document).ready(function() {

            $("#TestDescription").cleditor({

                width: 500, // width not including margins, borders or padding

                height: 250, // height not including margins, borders or padding

                controls:     // controls to add to the toolbar

                        "bold italic underline strikethrough subscript superscript ",

                //                        "| font size " +

                //                        "style | color highlight removeformat | bullets numbering | outdent " +

                //                        "indent | alignleft center alignright justify | undo redo | " +

                //                        "rule image link unlink | cut copy paste pastetext | print source",

                colors: "",      // colors in the color popup

                //                        "FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF " +

                //                        "CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F " +

                //                        "BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C " +

                //                        "999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C " +

                //                        "666 900 C60 C93 990 090 399 33F 60C 939 " +

                //                        "333 600 930 963 660 060 366 009 339 636 " +

                //                        "000 300 630 633 330 030 033 006 309 303",

                fonts: "",      // font names in the font popup

                //                        "Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," +

                //                        "Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",

                sizes: "",      // sizes in the font size popup

                //                        "1,2,3,4,5,6,7",

                styles: "",     // styles in the style popup

                //                        [["Paragraph", "<p>"], ["Header 1", "<h1>"], ["Header 2", "<h2>"],

                //                        ["Header 3", "<h3>"], ["Header 4", "<h4>"], ["Header 5", "<h5>"],

                //                        ["Header 6", "<h6>"]],

                useCSS: false, // use CSS to style HTML when possible (not supported in ie)

                docType:      // Document type contained within the editor

                        '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',

                docCSSFile:   // CSS file used to style the document contained within the editor

                        "",

                bodyStyle:    // style to assign to document body contained within the editor

                        "margin:4px; font:10pt Arial,Verdana; cursor:text"

            });

        });

        $("#TestDescription").cleditor().change(function() { alert("you are out of the editor") });

 

 

image001.gif

Anthony Guzzo

unread,
Nov 14, 2011, 4:03:38 PM11/14/11
to cled...@googlegroups.com, ja...@barlowshomes.com
Jake:
Changed my code.  The below code  works:

        $(document).ready(function() {
            var editor = $("#TestDescription").cleditor();
            editor.change(function() {
                alert("you are out of the editor");
            });
        });

Tamás Dezsö

unread,
Jan 15, 2013, 4:55:03 AM1/15/13
to cled...@googlegroups.com, ling...@gmail.com
Pierre,

Your workaround-code is great, there is one exception when it does not fire: if I drag selected text over the editor. I will live with this one glitch.

Thanks again,
Tamas

Pierre Lafitte

unread,
Jan 15, 2013, 5:12:44 AM1/15/13
to cled...@googlegroups.com, ling...@gmail.com
@Tamás Dezsö

I'm so glad this code could help you. That's a long time I have not used cleditor.
I have no fix for this, however I remember that I switched to http://imperavi.com/  redaktor's editor which I prefered over cleditor.
There are some interesting native behaviour you may be interested in.
I recommend you to give a look at it to see if it can help you or not.

Have a nice day.

Tamás Dezsö

unread,
Jan 15, 2013, 6:56:53 AM1/15/13
to cled...@googlegroups.com, ling...@gmail.com
Thanks for the tip. The biggest problem of imperavi is that is it not free :)

As alternative for cleditor we also tried jHtmlArea, which was an interesting alternative, but the source was a lot bigger and that made the decision. CLEditor could handle all the requirements until now: we could programatically paste into it, get noticed if the content changed and could disable it, has source view. The only thing it cannot handle is to have a "placeholder" (aka watermark) text such as: "enter your comments here", which would then disappear if the editor is focused.

Thanks for your tip and the reply.

Best wishes,
Tamas
Reply all
Reply to author
Forward
0 new messages