1
irmtfan
tiny editor - read default font from textarea in style.css of theme
  • 2006/12/13 8:33

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Quote:
frankblack wrote:
You can set up some default, by making your own CSS for the editor. ATM your default CSS will be taken, but there is textarea which applies to the editor, because the textarea is no textarea anymore. You have to redefine the body-tag for that in CSS file

i still cant unserstand why "body" tag and why not "textarea"?

just need 4 defaults to define.

font family
font size
font color
font background color

also it is needed to be changed by change language. so using textarea i can put the tag in fa.css for persians.

also if i defined my own css for body tag( i think you mean this?) it also take affect in all pages not the editor only? how to do it?

2
frankblack
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/13 13:52

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
i still cant unserstand why "body" tag and why not "textarea"?


Because the textarea isn't a textarea anymore when you do wysiwyg-editing. Roughly explained: The content will be moved to an iframe and when saving moved back, so that the post-data is at hand in order to put into the database. <- awful grammar

OK, things are getting now a bit complicated and I hope I could explain sufficiently.

The editor field uses the settings of the css file of your theme. So all formatting that is in this css file will be applied to the content inside the editor field. So the look-and-feel of your site will be preserved while writing articles.

There is no formatting for textarea to be used (see first explanation) in the editor field. textarea is only to put contents in, so when you have a textarea css this will not appear on your site's content, because there textarea isn't used anymore.

If you set all css right for your site AND the editor there will be no problem at all. It is highly recommended that you have a css file for the editor as well, because certain css command can have strange effects on the editor itself.

Language specific css should be no problem for you. Even for tinyeditor you can include a switch in initcode.php

3
irmtfan
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/13 16:20

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


long story short, you said in wysiwyg editor "body" is used for edit page and view page both. am i understand it correctly?

anyway i still have my problem in changing default font.
i only found these css files in package:
modules/tinyeditor/editor/themes/advanced/css
editor_content.css
editor_popup.css
editor_ui.css

but in source code i can see this class:
<body spellcheck="false" dir="rtl" class="mceContentBody">


where is this class?am i right in changing this?

i want to change default font.

4
frankblack
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/13 19:57

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Maybe I explained this wrong. Whatever you put in any css file that is connected changes/shows only the APPEARANCE in the editor field, but do NOT define how things will look when saved. Just one example:

In your theme css you have redefined the p-tag to 18px height and made it bold. Now the editor just grabs this setting and displays it accordingly in the editor field. The editor do not change anything: his code will stay a p-tag. The formatting is done by the css file. A different story is when you use the formatting abilities of the editor. E.g.: You have a p-tag and attach a css-style from the dropdown. Now the p-tag is formatted and will be displayed accordingly when the css-file for your site is set up correctly.

So the default font-size, font-name, font-weight etc. is defined in the css. I can look up where the defaults for the editor are defined when no css is attached.

Hmmm, weak explanation?

5
irmtfan
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/31 12:42

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


No i think its very clear now.
im very pleased for your work.

then i use p-tag to change font size and font family
and i use body-tag to change background color.
e.g. in my theme style.css:
p{FONTnormal 16px/120Tahoma;}
BODY {background-imageurl(images/bg.gif);}

the problems are:
1- body used in whole site as background and i still think its not good to use it for an editor background.
backgrounds conflict in some themes.

do you have any solution for this?

2- the language base story like direction: i want to have arail 12px in english and tahoma 16px in persian as default

why not add them like direction in main.php?
so if defines are empty it reads from the current theme.

define("_MD_TINY_RTL","rtl");
define("_MD_TINY_DEFAULT_FONT_FAMILY","tahoma");
define("_MD_TINY_DEFAULT_FONT_SIZE","16px");

6
frankblack
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/31 13:10

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Maybe this is the right solution for you. Create a CSS file for every language you want to use. Save them on the server. Then edit include/initcode.php and replace this code:

if ($moduleConfig['tinyedcss'] == '') {
            
$fallbackcssfile str_replace(XOOPS_THEME_URLXOOPS_THEME_PATHxoops_getcss($xoopsConfig['theme_set']));
            
$handle fopen ($fallbackcssfile"r");
            
$buffer fgets($handle);
            
$pos strpos ($buffer"@");
            if (
$pos === false) {
                echo 
'content_css: "'.xoops_getcss($xoopsConfig['theme_set']).'",';
                
fclose($handle);
            } else {
            
$buffer preg_replace('/(.*)(|)(.*)/msU'''trim($buffer));
            
$buffer str_replace(';'''$buffer);
            
$fallbackcssfile str_replace(XOOPS_THEME_PATHXOOPS_THEME_URL$fallbackcssfile);
            
$cssfilename end(explode("/"$fallbackcssfile));
            
$fallbackcssfile str_replace($cssfilename$buffer$fallbackcssfile);
            
fclose($handle);
            echo 
'content_css: "'.$fallbackcssfile.'",';
            }
        } else {
            echo 
'content_css: "'.XOOPS_URL.$moduleConfig['tinyedcss'].'",';
        }


with this code:

echo 'content_css: "'._MD_TINY_CSS.'",';


Save it and upload the file. Then edit main.php for every language and insert something like this:

define("_MD_TINY_CSS","http://www.thepathtothelanguagespecific.css");


The language specific css file should contain e.g.:

body background-colorwhitefont-familyTahomafont-weightnormalfont-size16pxline-height120%; }
and 
so on and so forth...


HTH

7
irmtfan
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/31 14:19

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Thank you frank
you point me to the right place!

but i do it in a different and IMHO better way.

i just add these lines to include/initcode.php after your code:
$tiny_lang_css_file_url'/modules/tinyeditor/language/'.$GLOBALS['xoopsConfig']['language'].'/css/'._LANGCODE.'.css';
    if ( 
file_exists(XOOPS_ROOT_PATH.$tiny_lang_css_file_url) ){
                echo 
'content_css: "'.XOOPS_URL.$tiny_lang_css_file_url.'",';
    }


then i just put my css in:
modules/tinyeditor/language/persian/css/fa.css

lol it works perfect now without any more touch

8
frankblack
Re: tiny editor - read default font from textarea in style.css of theme
  • 2006/12/31 15:29

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Cool! Maybe ralf57 asked the wrong person to work on his editor?

9
irmtfan
Re: tiny editor - read default font from textarea in style.css of theme
  • 2007/1/1 3:51

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


its just a try from a child to write something useful...
my lack of php coding...
thank you frank

off topic: why you dont follow developing this module with ralf57?
IMHO you are the right man!
also it is still a tiny one as before!

10
frankblack
Re: tiny editor - read default font from textarea in style.css of theme
  • 2007/1/1 9:47

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
off topic: why you dont follow developing this module with ralf57?
IMHO you are the right man!
also it is still a tiny one as before!


I want to start again working on debaser to fulfill some promises I made a "while" ago. I don't have the power or time to work on two projects at the same time - this is the reason why.

Login

Who's Online

375 user(s) are online (145 user(s) are browsing Support Forums)


Members: 0


Guests: 375


more...

Donat-O-Meter

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

Latest GitHub Commits