General Community > Off-Topic
HTMLArea stylesheet not working?
Argos:
Yes! I found out how to include the stylesheet in HTMLArea so that it really exactly shows in the editor how it will look like on the site. And in fact it is a very simple solution once you know it :-)
1. Open htmlarea.js
2. Search for:
--- Code: ---// style included in the iframe document
this.pageStyle = "";
--- End code ---
3. Change into:
--- Code: ---// style included in the iframe document
this.pageStyle = '@import url(/cms/include/htmlarea/iframe.css);';
--- End code ---
Presto!
I made a separate stylesheet based on the template stylesheet, and put it into the htmlarea folder. I left some things out and compressed it a bit by removing spaces and returns. But I guess you can just as well link to your template stylesheet, using some WSB tag.
Works like a charm! I tried it before but without succes. I suddenly realized it maybe needed the "@import url" bit added, and indeed that did the trick :-)
fienieg:
Thanks jurgen...
It really works like charm, even on Firefox :wink:
Stefan:
Works on IE for me but not on Firefox 1.0.1 :?
Strange...
fienieg:
I've got Firefox 1.0.1
And IE6, i never had any problems with IE... only with firefox.
And now it seems if it's broken again. It worked like 10 minutes.... :evil:
Stefan:
I have written a rough draft of a possible interaction of WB with htmlarea. No big deal, just a first step...
It queries the pages table for the template of the page being modified and sets the htmlarea option accordingly.
If the page doesn't have a specific template, the default template is used.
In WB_PATH/modules/wysiwyg/modify.php change lines 66 to 69:
--- Code: ---
$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'wysiwyg'");
if($query_wysiwyg->numRows() > 0) {
while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
echo 'var editor = new HTMLArea("content'.$wysiwyg_section["section_id"].'");'
--- End code ---
to the following
--- Code: ---$query_pages=$database->query("SELECT template FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
$page_row=$query_pages->fetchRow();
$templatename=$page_row['template'];
if ($templatename=='')
$templatename=DEFAULT_TEMPLATE;
echo 'var config = new HTMLArea.Config();
config.pageStyle = "@import url('.WB_PATH.'/templates/'.$templatename.'/screen.css);";';
$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'wysiwyg'");
if($query_wysiwyg->numRows() > 0) {
while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
echo 'var editor = new HTMLArea("content'.$wysiwyg_section["section_id"].'",config);'
--- End code ---
Have fun!
Too bad Firefox is having an issue here...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version