Tinymce """plugin"""

kookie

No avatar

2005-10-17 16:39

You can hardly call this one a plugin but as it looks there are some "problems" with Htmlarea not allowing tables and making trouble with line breaks i thought i was time to see if i could do a little hack and use TinyMCE instead of htmlarea.
Well as far as i have tested it works fine so here a short how to :)

- download Tinymce at sourceforge.net
there are several version but i used : http://sourceforge.net/projects/tinymce
2.0RC3
Unpack and put the dir: jscripts in you QC directory

then open /templates/admin/head.tpl and paste the code:
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "elm1,elm2",
//insertlink_callback : "customInsertLink",
//insertimage_callback : "customInsertImage",
save_callback : "customSave",
content_css : "example_advanced.css",
extended_valid_elements : "a[href|target|name]",
plugins : "table",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
//invalid_elements : "a",
theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific setting CSS classes
debug : false
});

// Custom insert link callback, extends the link function
function customInsertLink(href, target) {
var result = new Array();

alert("customInsertLink called href: " + href + " target: " + target);

result['href'] = "http://www.sourceforge.net";
result['target'] = '_blank';

return result;
}

// Custom insert image callback, extends the image function
function customInsertImage(src, alt, border, hspace, vspace, width, height, align) {
var result = new Array();

var debug = "CustomInsertImage called:\n"
debug += "src: " + src + "\n";
debug += "alt: " + alt + "\n";
debug += "border: " + border + "\n";
debug += "hspace: " + hspace + "\n";
debug += "vspace: " + vspace + "\n";
debug += "width: " + width + "\n";
debug += "height: " + height + "\n";
debug += "align: " + align + "\n";
alert(debug);

result['src'] = "logo.jpg";
result['alt'] = "test description";
result['border'] = "2";
result['hspace'] = "5";
result['vspace'] = "5";
result['width'] = width;
result['height'] = height;
result['align'] = "right";

return result;
}

// Custom save callback, gets called when the contents is to be submitted
function customSave(id, content) {
alert(id + "=" + content);
}
</script>
<!-- /tinyMCE -->

somewhere within the head tag.

Then go to: /plugins/htmleditor/htmleditor.php and replace this:
// old code

$kod .= '<TEXTAREA name="'.$nazwaArea.'" rows="20" cols="120" class="input" id="'.$nazwaArea.'">'.$zawartoscArea.'</TEXTAREA>';

$kod .= $tpl->tHtml( 'config.js' );

return $kod;
// end old code

With this:

// new code

$kod .= '<TEXTAREA name="'.$nazwaArea.'" rows="20" cols="120" class="input" id="elm2">'.$zawartoscArea.'</TEXTAREA></div>';

/*
$kod .= $tpl->tHtml( 'config.js' );
*/

return $kod;
// new code

I should work then.

hex

No avatar

2005-10-17 17:44

but it does not

hex

No avatar

2005-10-17 17:50

i get undefinied 'tinyMCE' while executing add product page and add category also

kookie

No avatar

2005-10-17 20:28

Sure the paths are allright?

it works fine here with just that... but 'll double check again

hex

No avatar

2005-10-18 10:08

kookie, maybe you can find out, how to prevent tinymce from changing ' to " in e.g. IMG src tag?

kookie

No avatar

2005-10-18 11:15

Well i tried and changed some of the code to img src=' ...' but have not found the right one i guess for the img. are still saved with img src=".."

hex

No avatar

2005-10-18 12:13

i have also searched a little for the right lines, but cant find out which are responsible for this change

if anyone find this please, let us know

thanks in advance

julia

No avatar

2005-10-22 08:59

I like it! although
it work partly
the link and the image doesn't work
but it is much more better than the defult html editor

kookie

No avatar

2005-10-24 10:46

Try the Editor with Firefox!

On contentpages in QC it works fine with images and links...
But not yet on products... somehow all gets tripped away and in the code the only thing that is left is: <p><img border="0" /> </p>

Maybe someone a clue why?... and what could we adjust so the stripping does not occur in that way?

gillweb

No avatar

2005-11-08 01:15

FireFox has a textarea WYSIWYG editor? Can I get a link?

gillweb

No avatar

2005-11-08 01:56

Also gettign same thing...images and links not working because of the code being saved like this:

<img src=' 'logo.jpg' '>


Those double single quotes just don't work!

gillweb@gmail.com

kookie

No avatar

2005-11-09 13:14

FireFox has a textarea WYSIWYG editor? Can I get a link?

@gillweb :
I meant: open your website with Firefox... there the Editor works fine..except indeed the things you mention on PRODUCT pages...
On content pages i see no problem really.

when i find the time... i will try and look into the " and ' that seem to cause the trouble in product pages..

gillweb

No avatar

2005-11-09 17:13

The editor doesn't even show up for me in FireFox. Only works in IE?

gillweb@gmail.com

kookie

No avatar

2005-11-10 10:20

at Gillweb: what DO you see then?? the old htmlarea editor? Nothing??
Installed as described in this topic it works for me on Ie and Firefox..... but again: some functions like insert image work only in the Content pages of QC not the product pages due to the " ' problem i might solve later but right now i have no time to dig through all the functions

Back to top
about us | contact