We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    Jason--

    This is built into MCE-- there is an onchange_callback that gets called each time TinyMCE adds something to the undo buffer, so there is no need to deal w/ onkeypress, you just give MCE the name of the function you want executed. Your function could then set the CMS's isDirty function.

    BTW, each MCE instance has an isDirty method that can be checked to boot:
    tinyMCE.getInstanceById('yourid').isDirty();
      • 22303 MODX Staff
      • 10,725 Posts
      Jason--

      This is built into MCE-- there is an onchange_callback that gets called each time TinyMCE adds something to the undo buffer, so there is no need to deal w/ onkeypress, you just give MCE the name of the function you want executed. Your function could then set the CMS's isDirty function.

      BTW, each MCE instance has an isDirty method that can be checked to boot:
      tinyMCE.getInstanceById('yourid').isDirty();

      right, the problem is the original textarea contains the onchange code that needs to be triggered, but it never get's triggered, since it has been replaced by the editor --> the onchange callback simply triggers the onchange of the editor instance from what I can tell
        • 32963
        • 1,732 Posts
        Hi Jason,


        Here's the fix to get the TVs to save with TinyMCE:

        mutate_content.dynamic.action.php line 975 to 991:

        			<script language="javascript" type="text/javascript">
        			   tinyMCE.init({
        					theme : "advanced",
        					mode : "exact",
        					plugins : "advimage,advlink,table,searchreplace",
        					theme_advanced_toolbar_location : "top",
        					<?php echo !empty($element_list) ? "elements : '$element_list'," : "" ?>
        					<?php echo !empty($tiny_css_path) ? "content_css : '$tiny_css_path'," : "" ?>
        					<?php echo !empty($tiny_css_selectors) ? "theme_advanced_styles : '$tiny_css_selectors'," : "" ?>
        					debug : false,
        					onchange_callback: "tvOnchangeCallBack"
        			   });
        			   
        			   function tvOnchangeCallBack(i){
        			   		i.oldTargetElement.onchange();			   
        			   }
        			</script>
        



        The tvOnchangeCallBack function did the trick.

        Tested in IE. Please test in FF and the others

        PS. TinyMCE works great in standalone mode but it slows down when used inside the CMS. With that aside it's a very cool html editor smiley
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 22303 MODX Staff
          • 10,725 Posts
          The tvOnchangeCallBack function did the trick.

          Tested in IE. Please test in FF and the others

          PS. TinyMCE works great in standalone mode but it slows down when used inside the CMS. With that aside it's a very cool html editor smiley

          Thanks for the assist Raymond...works like a charm shockedops: I obviously need to study up on the Javascript event model.

          FCK ready soon.
            • 32963
            • 1,732 Posts
            Sounds great!

            Also check out these settings:

            	tinyMCE.init({
            		theme : "advanced",
            		plugins : "table,advhr,advimage,advlink",
            		theme_advanced_buttons1_add_before : "save,separator",
            		theme_advanced_buttons1_add : "fontselect,fontsizeselect",
            		theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
            		theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
            		theme_advanced_buttons3_add_before : "tablecontrols,separator",
            		theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
            		theme_advanced_toolbar_location : "top",
            		theme_advanced_toolbar_align : "left",
            		theme_advanced_path_location : "bottom",
            	    plugin_insertdate_dateFormat : "%Y-%m-%d",
            	    plugin_insertdate_timeFormat : "%H:%M:%S",
            		extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
            		mode : "exact",
            		<?php echo !empty($element_list) ? "elements : '$element_list'" : "" ?>
            	});
            
            


            These settings seem to work faster. I think TinyMCE has a problem with updating the interface.
              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 22303 MODX Staff
              • 10,725 Posts
              Alright, almost there with FCK, but having some problems getting multiple instances to work correctly (e.g. for content and richtext TV's). Some instances work when on the same page, and others don't; plus it's inconsistent which ones do work, and which ones don't. huh

              In addition, I can't find a mechanism in FCK to set the documentDirty flag or set the TV's when they change as TinyMCE has. Has anyone else had luck getting this to work so we can enable the Save button? I know Susan said she had it working for content in a Eto/MODx installation?
                • 22303 MODX Staff
                • 10,725 Posts
                Alright, almost there with FCK, but having some problems getting multiple instances to work correctly (e.g. for content and richtext TV's). Some instances work when on the same page, and others don't; plus it's inconsistent which ones do work, and which ones don't. huh

                Found the problem here -- I'll need to create each instance with a different object; and I'm probably being dense here, but how can I dynamically generate an object name to instantiate each instance on? Is there an easy way to do this in PHP?
                  • 22303 MODX Staff
                  • 10,725 Posts
                  I have committed the following changes into my branch of the project:

                  * TinyMCE 1.44: configuration changes to avoid sluggishness, thanks Raymond
                  * TinyMCE 1.44: onchange_callback, again, thanks Raymond
                  * FCKeditor 2.0RC3: integration with manager content and richtext TV's and client-side richtext controls (integrated using JavaScript ReplaceTextarea() method)


                  Known issues with FCKeditor 2.0RC3:

                  * TV's not saving -- unsuccessful at triggering onchange event so far...
                  * If you have multiple instances on a single page, only one instance will allow editing, and even then is buggy in Gecko and Firefox browsers, but works fine in IE6


                  I may back up to RC2 to see if the problem disappears with Gecko and Firefox, as this seems to be a new issue with RC3 based on my review of their forums. And I'll keep hacking away until I solve the onchange issue with FCK.

                  Time for some client work now... :shock:
                    • 34162
                    • 1 Posts
                    Jason:

                    Just in case you hadn't seen it yet, FCK Final Candidate was released yesterday. Might want to give it a shot; has a LOT of fixes. Also, the new templates feature and file manager are quite nice.

                    According to changelog:
                    The editor now uses the same method used on version RC2 to load its contents on Gecko. It is now possible to have more than one editor in the page. This change has a negative impact: the BaseHref property is not working.
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Jason:

                      Just in case you hadn't seen it yet, FCK Final Candidate was released yesterday. Might want to give it a shot; has a LOT of fixes. Also, the new templates feature and file manager are quite nice.

                      Wierd, I had been on there site all day and didn't see anything about it. Thanks for the tip.