Opened 13 years ago

Closed 12 years ago

#40 closed defect (invalid)

Add a CSS Stylesheet to Xinha component

Reported by: forgottentowers Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description (last modified by mokhet)

Hi there
In textarea only needs:

editor1.config.pageStyle = "@import url(mystyle.css);";

But now, using Xinha, I try but nothing happens
I used:

xinha_editors.config.myTextArea.pageStyle = "@import url(../css/mycss.css)";

but it didn??t work.
What can I import external css style sheets? some one can help me?

Change History (6)

comment:1 Changed 13 years ago by Dave

I found it didn't work either - what I have done is load my style sheet as a php var and load the contents into the file.

<?php

$myCSSString = str_replace("\n", "", @implode(" ", @file("$Stylesheet")));

?>

xinha_config.pageStyle = "@import <? echo $myCSSString; ?>";

This works ok for me.

comment:2 Changed 13 years ago by anzenews

I solved a similar problem by not using the FullPage? plugin. Hope it helps.

comment:3 Changed 13 years ago by gogo

  • Resolution set to invalid
  • Status changed from new to closed

Couple of things, you should use an absolute url to the stylesheet relative urls will be troublesome.

Second is that
xinha_editors.config.myTextArea.pageStyle
is incorrect (I'll fix that in the example) you want to use
xinha_editors.myTextArea.config.pageStyle

Third is that you may find it better to use xinha_editors.myTextArea.config.pageStyleSheets, example

xinha_editors.myTextArea.config.pageStyleSheets.push('/path/to/styles.css');

comment:4 Changed 12 years ago by Tim McGuire

  • Resolution invalid deleted
  • Status changed from closed to reopened

Not acceptable to use absolute url. what if code is being moved from development to production?

comment:5 Changed 12 years ago by Tim McGuire

I take that back. I guess I can build a "dynamic" absolute URL

comment:6 Changed 12 years ago by mokhet

  • Description modified (diff)
  • Resolution set to invalid
  • Status changed from reopened to closed

relative url is *always* leading to inconsistency especially when moving your code from development to production.

You can't ask Xinha to be aware of the structure of your files since Xinha is a 3rd party tool for your code.

Please, use absolute css url !

Note: See TracTickets for help on using tickets.