PEAK XOOPS - Integrating TinyMCE editor in englishin japanese

Integrating TinyMCE editor

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2005/1/1 5:14
ap1239  企霹始   Posts: 6
I wanted a different editor for TinyD (from http://tinymce.moxiecode.com/) to make it easier for my users to add content. I liked the TinyMCE editor that other CMs used and found that it's easy to get running.

I'm sure an expert XOOPS developer has a better way than this, but
to just get things running:
1) download TinyMCE and copy its jscript directory to /common
2) modify include/cp_functions.php around line 68 to insert the following TinyMCE jscript lines; it's explained in TinyMCE's manual.

<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="/common/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>
<!-- /tinyMCE -->

The issue I don't understand how to fix.
-- When you save the TinyD content, the content is saved to the database, but doesn't reload the page -- you have to manually reload.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/1/4 18:45
GIJOE  黎扦烦菱   Posts: 4110
hi ap1239.

Thank you for telling me a good information.

I heard that TinyMCE is a good WYSIWYG editor.
I'll try it as soon as possible.
Votes:1 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2005/4/30 2:11
raqxx  企霹始   Posts: 1
hi all
thanks for the module gijoe, I really like it.
I like to implement TinyMCE editor or any cross browser editor, it looks like TinyMCE is the easiest to do for people like me with no php knowledge. One very stupid question where is the directory /common to apply ap1239 hack ?

Quote:
1)download TinyMCE and copy its jscript directory to /common

also there is some instruccions with TinyEditor how to implement it in modules, but i'm very much lost. Has anyone done it?

Quote:
### Installation ###
Install Tinyeditor the way you do with
other xoops modules,then set the module's
preferences.

### Image manager functionalities ###
The image manager plugin features now a
thumbnail-to-popup function which enables you
to automatically add a link to view the full-size
image from its thumbnail.
To do so,you MUST enable Javascript code
in /xoops/class/module.textsanitizer.php file
since Xoops filters javascript code for security
purposes.
I obviously suggest you to do so either
if you are the only submitter of your site
or you have trusted contributors.
When decided,open
/xoops/class/module.textsanitizer.php
with your test editor and comment
lines 200 and 201
so they become
//$patterns[] = "/java script:/si";
//$replacements[] = "java script:";
After this you have to add the js code so open
/xoops/include/xoops.js
with your test editor and add the following
at the very top of the file:

____________START__COPY/CUT BELOW__________________


function myPopImage(imageURL,imageTitle) {

// Script Source: CodeLifter.com

//Set this values 20px larger
//than your biggest picture
PositionX = 100;
PositionY = 100;

defaultWidth = 680;
defaultHeight = 520;

var AutoClose = true;

// Do not edit below this line...

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
if (isNN){imgWin=window.open('about :blank','',optNN);}
if (isIE){imgWin=window.open('about :blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor="FFFFFF" scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor="FFFFFF" scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()" onClick="self.close()">');
writeln('<img name="George" alt="Clicca per chiudere" src='+imageURL+' style="display:block"></body></html>');
close();
}
}

__________STOP__COPY/CUT_______________________

You're done!

### How to use TinyEditor within other modules ###
TinyEditor now comes with a built-in class which makes
integration within other modules really QUICK and EASY.
An example of integration into News 1.2.1

1)Open /modules/news/include/storyform.inc.php
with your text editor and go to line 32;
Right below add:
include_once XOOPS_ROOT_PATH . "/modules/tinyeditor/formtinytextarea.php";

2)Then replace the original code which renders the textareas with TinyEditor instances;
so comment or remove line 61
$sform->addElement(new XoopsFormDhtmlTextArea(_NW_THESCOOP, 'hometext', $hometext, 15, 60, 'hometext_hidden'), true);
and add
$sform->addElement(new XoopsFormTinyTextArea( _NW_THESCOOP, 'hometext', $hometext, '100%', '300px'), true);
for hometext and
$sform->addElement(new XoopsFormTinyTextArea( _AM_EXTEXT, 'bodytext', $bodytext, '70%', '400px'), true);
for bodytext.
That's all!!!

You can easily adapt these instructions with other Xoops modules.


if you know of any info about how to do it or know of any links with more info, very much appreciate
thanks,
raqxx
Votes:2 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!