1
kerkyra
Making tiny the default xoops editor...
  • 2006/12/22 16:17

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


is there any way to do that? Thanks
www.guidemap.gr - Beta is out...

2
frankblack
Re: Making tiny the default xoops editor...
  • 2006/12/22 16:44

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


YESSS, tinyeditor 1.0 FINAL will be released until the end of year and so will be the updated documentation. Just hold on for a little while.

3
McDonald
Re: Making tiny the default xoops editor...
  • 2006/12/22 19:25

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


If you're running XOOPS 2.0.15 or higher you can edit the file /class/xoopsform/formdhtmltexteditor.php and change the line

var $htmlEditor = array();


into

var $htmlEditor = array('XoopsFormTinyeditorTextArea''/class/xoopseditor/tinyeditor/formtinyeditortextarea.php');


Otherwise you have to do it per module by editing the xoops_version.php files and set tinyeditor as the default editor.

4
kerkyra
Re: Making tiny the default xoops editor...
  • 2006/12/23 10:24

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


thank you veeryyy much! nice one!
www.guidemap.gr - Beta is out...

5
irmtfan
Re: Making tiny the default xoops editor...
  • 2007/1/10 5:25

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


i bookmark this thread.
now the next question it how to change all textarea to tinyeditor?

6
frankblack
Re: Making tiny the default xoops editor...
  • 2007/1/10 10:12

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:

irmtfan wrote:
i bookmark this thread.
now the next question it how to change all textarea to tinyeditor?


Does this makes sense? To change ALL textarea to tinyeditor?

Here a short hack (not tested) which turns plain textareas to a reduced tinyeditor (reduced means has the same features as the standard dthml-editor):

Edit class/xoopsform/formtextarea.php and replace function render with this new function render:

function render(){

    
$ret '    <script language="javascript" type="text/javascript" src="'.XOOPS_URL.'/modules/tinyeditor/editor/tiny_mce.js"></script><script language="javascript" type="text/javascript">
    tinyMCE.init({
    mode : "textareas",
    editor_selector : "mceEditor",
    theme : "advanced",
    language : "en",
    convert_urls : false,
    theme_advanced_toolbar_align : "left",
    plugins : "ximagemanager,xcode,xquote,emotions",
    theme_advanced_toolbar_location : "top",
    theme_advanced_buttons1 : "link,unlink,image,ximagemanager,xcode,xquote,forecolor,bold,italic,strikethrough,emotions",
    theme_advanced_buttons2 : "fontsizeselect,fontselect",
    theme_advanced_buttons3 : "",
    valid_elements : "a[href|target=_blank],b,i,u,strike,font[face|size|color],img[src|align],p",
    width: "100%",
    height: "400px",
    cleanup: "true",
    debug : "false"
    });</script>'
;        
        
$ret .= "<textarea name='".$this->getName()."' id='".$this->getName()."' rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra()." style='width:100%; height:400px;' class='mceEditor'>".$this->getValue()." </textarea>";
                return 
$ret;
    }


You can add more plugins and button. Good luck!

7
irmtfan
Re: Making tiny the default xoops editor...
  • 2007/1/10 10:41

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


thank you now it works!

but is there any way to change it to mimic form easily?
i mean xeditor = 0

also it seems you use "textarea" in toolset page so it is all messy after change textareas!!!

i think we must leave this textarea and get it for the reason it is used for.

Quote:
Does this makes sense? To change ALL textarea to tinyeditor?


yes!
some modules like "xhelp" use textarea in all fields and i dont want to find them one by one.
also security reason when i enable html in some modules:
e.g.: in cbb quick reply.of course i can change the quick reply editor in cbb to "tinyeditor" but IMHO its better to change all "textarea".
why not if it still can be very tiny

8
frankblack
Re: Making tiny the default xoops editor...
  • 2007/1/10 11:30

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


I programmed the reduced instruction initcode for manually editing specific areas. But anyway you can do that quite easily with the code already provided in this post.

Before the output is starting set up an array of all the fields (ids or names of the textareas) that should be NOT converted into WYSIWYG. Then make an if-statement combined with !in_array to make the textareas WYSIWYG. The else part contains the code that was originally in the function render to display the textarea.

Hope it is clear what I want to say?

9
irmtfan
Re: Making tiny the default xoops editor...
  • 2007/1/10 13:40

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


follow your advise i change it to this:

function render(){
    
$except_area=array('tinyedbuts1','tinyedbuts2','tinyedbuts3');
    if (!
in_array($this->getName(), $except_area)){
        

    
$ret '    <script language="javascript" type="text/javascript" src="'.XOOPS_URL.'/modules/tinyeditor/editor/tiny_mce.js"></script><script language="javascript" type="text/javascript">
    tinyMCE.init({
    mode : "textareas",
    editor_selector : "mceEditor",
    theme : "advanced",
    language : "fa",
    convert_urls : false,
    theme_advanced_toolbar_align : "right",
    plugins : "ximagemanager,xcode,xquote,emotions",
    theme_advanced_toolbar_location : "top",
    theme_advanced_buttons1 : "link,unlink,image,ximagemanager,xcode,xquote,forecolor,bold,italic,strikethrough,emotions",
    theme_advanced_buttons2 : "fontsizeselect,fontselect",
    theme_advanced_buttons3 : "",
    valid_elements : "a[href|target=_blank],b,i,u,strike,font[face|size|color],img[src|align],p",
    width: "100%",
    height: "400px",
    cleanup: "true",
    debug : "false"
    });</script>'
;        
        
$ret .= "<textarea name='".$this->getName()."' id='".$this->getName()."' rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra()." style='width:100%; height:400px;' class='mceEditor'>".$this->getValue()." </textarea>";
                return 
$ret;
    }else{
        return 
"<textarea name='".$this->getName()."' id='".$this->getName()."' rows='".$this->getRows()."' cols='".$this->getCols()."'".$this->getExtra().">".$this->getValue()."</textarea>";
    }

}}


but still doest recognize it.
what is the problem?

10
frankblack
Re: Making tiny the default xoops editor...
  • 2007/1/10 14:29

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Very tricky everything. Try to change:

mode "textareas",
    
editor_selector "mceEditor",


to:

mode "exact",
    
elements "'.$this->getName().'",


Unfortunately I cannot test this myself right now.

Login

Who's Online

197 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 197


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits