Ticket #40 (closed defect: invalid)

Opened 8 years ago

Last modified 7 years ago

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) (diff)

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

Changed 8 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.

Changed 8 years ago by anzenews

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

Changed 8 years ago by gogo

  • status changed from new to closed
  • resolution set to invalid

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');

Changed 7 years ago by Tim McGuire

  • status changed from closed to reopened
  • resolution deleted

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

Changed 7 years ago by Tim McGuire

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

Changed 7 years ago by mokhet

  • status changed from reopened to closed
  • resolution set to invalid
  • description modified (diff)

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.