We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8790
    • 526 Posts
    Hi,


    I tried to find some clues here about his issue, but still unsuccessful :

    On a fresh Modx install, with the two Tinymce release I tried (3.0.8 and 3.1.0.1a), the img insertion is corrupted with NO "/>" self closing tag so page is invalid when :


    • Using Tiny editor from frontend (Quickedit is on) saving (applying) the page changes (mostly the html code is ok before I click apply)
      When the page reload the self clog slash is gone !!
    • Using the backend, editing the page, and inserting any image, the code is always bad (no self closing tag) even before applying the changes.

    Am I alone ??

    Thank you
      Schtroumpf Grognon - Grouchy Smurf
      ---------------------------------
      Faites pas attention.. - Don't pay attention
      http://www.dzi-neo.net
      • 10298
      • 53 Posts
      Does anybody know how to enable the template feature in tinyMCE. I have enabled the template button but i can not figure out how to load my own predifined templates.

      And futhermore would it be possible to load chunks
        • 15160
        • 5 Posts
        As described in topic http://modxcms.com/forums/index.php?topic=27889 I’m struggling
        with TinyMCE to get ALLOWTRANSPARENCY accepted as a valid IFRAME attribute.


        First I tried adding the following to /assets/plugins/tinymce212/xconfig.js

        var tinymce_extended_valid_elements = "iframe[allowtransparency]";

        That caused TinyMCE to completely strip my IFRAME definition, all it left was "<IFRAME></IFRAME>"


        After that I changed the above statement to:
        var tinymce_extended_valid_elements = ""
        +"iframe[align<bottom?left?middle?right?top"
        +"|allowtransparency|class|frameborder|height|id"
        +"|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
        +"|title|width]";

        But that didn’t seem to work either, because after that ALLOWTRANSPARENCY still was removed by TinyMCE

        Am I missing something here? huh undecided

          • 4018
          • 1,131 Posts
          @elz64 What OS and browser (plus version) are you using? No problems here but it might be a bug that is browser specific on a certain OS.

          @funkybuddah The template plugin is documented on Moxiecode’s wiki (http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template), however it does require a bit of hacking to the plugin itself. I can see how a plugin like this might be useful for repetitive chunks of code though. I plan on rewriting the TinyMCE plugin as a class so that I can take advantage of a few things. This is one of the things on my list...the ability to completely customize the functionality of a specific TinyMCE instance.

          @jwvdhoek My guess as to why you’r enot able to get the allowtransparency attribute to stick is because it’s not a valid attribute begin with. Rather, it’s not an attribute that is an official part of any HTML specification. Being that TinyMCE tries to keep the code standards compliant, it’ll strip it out every time. Personally I wouldn’t use a proprietary attribute anyways but if you really need it try adding a class to the iframe (called ’transparent’ or something) then use some DOM scripting (using jQuery, Mootools, or the like) and simply have it add the allowtransparency attribute onto any iframe that has a class of ’transparent’. Much easier solution that trying to fuss with all this muck. smiley

          Here’s a thread with more info on the whole ALLOWSTRANPARENCY debate: http://lists.w3.org/Archives/Public/www-validator/2005Apr/0043.html
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
            • 31178
            • 128 Posts
            3.1.0.1a is working very nicely for me laugh ... just one minor niggle that keeps cropping up.

            When editing a document and clicking save I get the ’Are you sure you want to navigate away....’ message. Even though I am not navigating away, I’m clicking Save.

            It seems to be browser specific, the bug only shows up on IE7, FF3 is fine. I have several modx installs all behave the same.

            Richard
              • 31178
              • 128 Posts
              Quote from: funkybuddah at Aug 06, 2008, 09:16 AM

              Does anybody know how to enable the template feature in tinyMCE. I have enabled the template button but i can not figure out how to load my own predifined templates.

              And futhermore would it be possible to load chunks

              What I do is create a document to contain all the TinyMCE Templates I want:

              Alias=TinyMCEtemplates.js
              Set the MODx Template to ’(blank)’
              Uncheck Rich text
              Set the document content as:
              var tinyMCETemplateList = [
              [!Ditto? &sortBy=`menuindex` &display=`all` &sortDir=`asc` &tpl=`@CODE:["[+longtitle+]", "/[+alias+]", "[+description+]"],` &tplLast=`@CODE:["[+longtitle+]", "/[+alias+]", "[+description+]"]` !]
              ];


              Then I can create child documents which will be dynamically picked up by the TinyMCE template feature. The LongTitle and Description fields are used to populate the TinyMCE template dropdown list and descriptions.
              It works fine, though any chunks within a template page are resolved at the point you include the template, which can be a problem.

              ... oh and the TinyMCE Plugin configuration is as follows, assuming friendly urls:
              &customparams=Custom Params;text;template_external_list_url : "/TinyMCEtemplates.js" 
                • 30100
                • 58 Posts
                I have written a function to make images autoresized if the width or height are larger than the value of the variable $max_size. It was made to make it possible to upload images directly from a camera without resizing the image in a image editor. The function requires possibility to set ini_set("memory_limit","128M"); on the server.

                To use it, you need to add four calls an a function for it to work. In /manager/media/browser/mcpuk/connectors/php/Commands/FileUpload.php add the below function at the end of the file right before the last "?>" line.
                function resize($src_name, $max_size)
                {
                	//Get info from file
                	if(!$info=getimagesize($src_name)) {return false;}
                
                	//Allocate more memory for resizing function, this can be limited by your web host
                	ini_set("memory_limit","128M");
                
                	// Load image and get image size
                	switch ($info['mime'])
                	{
                		case 'image/jpeg':
                			$img=imagecreatefromjpeg($src_name);
                			break;
                		case 'image/gif':
                			$img=imagecreatefromgif($src_name);
                			break;
                		case 'image/png':
                			$img=imagecreatefrompng($src_name);
                			break;
                		default:
                		return false;
                	}
                
                	//Get image size
                	$width=imagesx($img);
                	$height=imagesy($img);
                
                	// Calculate new size
                	if (($width>$max_size) or ($height>$max_size))
                	{
                		$ratio=($height*100)/$width;
                		if ($ratio>=100) {    //Portrait or square
                			$new_height=$max_size;
                			$new_width=($max_size*$ratio)/100;
                		}
                		else {    //Landscape
                			$new_width=$max_size;
                			$new_height=($max_size*$ratio)/100;
                		}
                	}
                	else {return false;}	//If image is smaller or equal to the max size, return to program without resizing
                
                	// Create a new temporary image
                	$tmp_img = imagecreatetruecolor( $new_width, $new_height );
                
                	// Copy and resize old image into new image
                	imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
                
                	// Save resized image into a file
                	switch ($info['mime'])
                	{
                		case 'image/jpeg':
                			imagejpeg($tmp_img, $src_name, 90); //100 is the quality settings, values range from 0-100.
                			break;
                		case 'image/gif':
                			imagegif($tmp_img, $src_name, 90); //100 is the quality settings, values range from 0-100.
                			break;
                		case 'image/png':
                			imagepng($tmp_img, $src_name, 90); //100 is the quality settings, values range from 0-100.
                			break;
                	}
                
                	//Clean up temporary images
                	imagedestroy($img);
                	imagedestroy($tmp_img); // NOTE: PHP will clean up the temp file it created when the request has completed.
                	echo '<script language="JavaScript" type="text/javascript">alert("The image has been resized to '.$new_width.'x'.$new_height.'pixels.");</script>';
                	return true;
                }

                Next, add
                resize(($this->real_cwd."$filename($i).$ext"), 800);

                after the line
                @chmod(($this->real_cwd."/$filename($i).$ext"),$this->fckphp_config['modx']['file_permissions']); //modified for MODx

                around line 140 and then add the same line after the next @chmod line around line 150.

                Finally, add
                resize(($this->real_cwd."$filename.$ext"), 800);

                after the line
                @chmod(($this->real_cwd."/$filename.$ext"),$this->fckphp_config['modx']['file_permissions']); //modified for MODx

                around line 168 and then add the same line after the next @chmod line around line 176.

                The second parameter of the resize function that is set to 800 (pixels) can be changed to a different value to resize images larger to that value to the set value.
                  • 22797
                  • 134 Posts
                  Quote from: uxello at Aug 14, 2008, 10:24 AM

                  3.1.0.1a is working very nicely for me laugh ... just one minor niggle that keeps cropping up.

                  When editing a document and clicking save I get the ’Are you sure you want to navigate away....’ message. Even though I am not navigating away, I’m clicking Save.

                  It seems to be browser specific, the bug only shows up on IE7, FF3 is fine. I have several modx installs all behave the same.

                  Richard

                  Has this issue been resolved yet? I’ve been having the same problem with version 3.1.0.1.(2008-06-18). I haven’t tried 3.1.0.1a, but I could, if the problem has been addressed there.
                    • 31178
                    • 128 Posts
                    Quote from: paulb at Sep 08, 2008, 07:27 PM

                    Quote from: uxello at Aug 14, 2008, 10:24 AM

                    3.1.0.1a is working very nicely for me laugh ... just one minor niggle that keeps cropping up.

                    When editing a document and clicking save I get the ’Are you sure you want to navigate away....’ message. Even though I am not navigating away, I’m clicking Save.

                    It seems to be browser specific, the bug only shows up on IE7, FF3 is fine. I have several modx installs all behave the same.

                    Richard

                    Has this issue been resolved yet? I’ve been having the same problem with version 3.1.0.1.(2008-06-18). I haven’t tried 3.1.0.1a, but I could, if the problem has been addressed there.

                    No, I still have the same issue with 3.1.0.1a
                      • 31178
                      • 128 Posts
                      I’ve just upgraded a MODx installation to 0.9.6.2 and it has installed TinyMCE 3.1.0.1a as expected.

                      However I notice it does not use the MCPUK installed in the plugins/tinymce3101/mcpuk folder, but uses manager/media/browser/mcpuk, which makes sense. But there is inconsistancy of the 3.1.0.1a installation, depending on if it is installed as part of MODx 0.9.6.2 or installed as a pluging upgrade from the MODx resource downloads.

                      Richard