Changeset 893 for trunk


Ignore:
Timestamp:
10/03/07 20:13:05 (12 years ago)
Author:
ray
Message:
  • #1079 Plugin DynamicCSS lists Xinha internal CSS
  • #1080 Some plugins leave behind stylesheet links in fullpage mode
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r888 r893  
    57515751  return true; 
    57525752}; 
    5753 /** Adds styles for internal use to the edited document 
     5753/** Adds the styles for table borders to the iframe during generation 
    57545754 *   
    57555755 *  @private 
     
    57615761{ 
    57625762    var coreCSS =  
    5763     "<style id=\"XinhaInternalCSS\" type=\"text/css\">" 
     5763    "<style title=\"XinhaInternalCSS\" type=\"text/css\">" 
    57645764    + ".htmtableborders, .htmtableborders td, .htmtableborders th {border : 1px dashed lightgrey ! important;}\n" 
    57655765    + "html, body { border: 0px; } \n" 
     
    57795779      return coreCSS; 
    57805780    } 
     5781} 
     5782/** Allows plugins to add a stylesheet for internal use to the edited document that won't appear in the HTML output 
     5783 *   
     5784 *  @see Xinha#stripCoreCSS 
     5785 *  @param {String} stylesheet URL of the styleshett to be added 
     5786 */ 
     5787Xinha.prototype.addEditorStylesheet = function (stylesheet) 
     5788{ 
     5789    var style = this._doc.createElement("link"); 
     5790    style.rel = 'stylesheet'; 
     5791    style.type = 'text/css'; 
     5792    style.title = 'XinhaInternalCSS'; 
     5793        style.href = stylesheet; 
     5794    this._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    57815795} 
    57825796/** Remove internal styles 
     
    57895803Xinha.stripCoreCSS = function(html) 
    57905804{ 
    5791   return html.replace(/<style[^>]+id="XinhaInternalCSS"(.|\n)*?<\/style>/i, '');  
     5805  return html.replace(/<style[^>]+title="XinhaInternalCSS"(.|\n)*?<\/style>/ig, '').replace(/<link[^>]+title="XinhaInternalCSS"(.|\n)*?>/ig, '');  
    57925806} 
    57935807/** Removes one CSS class (that is one of possible more parts  
  • trunk/examples/testbed.html

    r883 r893  
    3636 
    3737  <!-- Load up the actual editor core --> 
    38   <script type="text/javascript" src="../htmlarea.js"></script> 
     38  <script type="text/javascript" src="../Xinha.js"></script> 
    3939 
    4040  <script type="text/javascript"> 
     
    138138 
    139139    window.onload   = xinha_init; 
    140     // window.onunload = Xinha.collectGarbageForIE; 
    141140  </script> 
    142141</head> 
     
    144143<body> 
    145144 
    146   <form action="javascript:var x = document.getElementById('editors_here');alert(x.myTextArea.value);" id="editors_here" onsubmit="alert(this.myTextArea.value);"> 
     145  <form action="javascript:void(0);" id="editors_here" onsubmit="alert(this.myTextArea.value);"> 
    147146 <div> 
    148147     <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;"> 
  • trunk/plugins/Abbreviation/abbreviation.js

    r846 r893  
    4141 
    4242Abbreviation.prototype.onGenerate = function() { 
    43   var style_id = "Abbr-style" 
    44   var style = this.editor._doc.getElementById(style_id); 
    45   if (style == null) { 
    46     style = this.editor._doc.createElement("link"); 
    47     style.id = style_id; 
    48     style.rel = 'stylesheet'; 
    49     style.href = _editor_url + 'plugins/Abbreviation/abbreviation.css'; 
    50     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    51   } 
     43  this.editor.addEditorStylesheet(_editor_url + 'plugins/Abbreviation/abbreviation.css'); 
    5244}; 
    5345 
  • trunk/plugins/DefinitionList/definition-list.js

    r856 r893  
    5050 
    5151DefinitionList.prototype.onGenerate = function() { 
    52   var style_id = "DefinitionList-style" 
    53   var style = this.editor._doc.getElementById(style_id); 
    54   if (style == null) { 
    55     style = this.editor._doc.createElement("link"); 
    56     style.id = style_id; 
    57     style.rel = 'stylesheet'; 
    58     style.href = _editor_url + 'plugins/DefinitionList/definition-list.css'; 
    59     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    60   } 
     52  this.editor.addEditorStylesheet(_editor_url + 'plugins/DefinitionList/definition-list.css'); 
    6153}; 
    6254 
  • trunk/plugins/DynamicCSS/dynamiccss.js

    r856 r893  
    3636        for(i=0;i<iframe.styleSheets.length;i++) 
    3737        { 
    38             if(iframe.styleSheets[i].title == "table borders") continue; 
     38            if(iframe.styleSheets[i].title == "XinhaInternalCSS") continue; 
    3939             
    4040            // Mozilla 
  • trunk/plugins/Forms/forms.js

    r854 r893  
    7676 
    7777Forms.prototype.onGenerate = function() { 
    78   var style_id = "Form-style" 
    79   var style = this.editor._doc.getElementById(style_id); 
    80   if (style == null) { 
    81     style = this.editor._doc.createElement("link"); 
    82     style.id = style_id; 
    83     style.rel = 'stylesheet'; 
    84     style.href = _editor_url + 'plugins/Forms/forms.css'; 
    85     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    86   } 
     78  this.editor.addEditorStylesheet(_editor_url + 'plugins/Forms/forms.css'); 
    8779}; 
    8880 
  • trunk/plugins/InsertAnchor/insert-anchor.js

    r856 r893  
    3434 
    3535InsertAnchor.prototype.onGenerate = function() { 
    36   var style_id = "IA-style"; 
    37   var style = this.editor._doc.getElementById(style_id); 
    38   if (style == null) { 
    39     style = this.editor._doc.createElement("link"); 
    40     style.id = style_id; 
    41     style.rel = 'stylesheet'; 
    42     style.href = _editor_url + 'plugins/InsertAnchor/insert-anchor.css'; 
    43     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    44   } 
     36  this.editor.addEditorStylesheet(_editor_url + 'plugins/InsertAnchor/insert-anchor.css'); 
    4537}; 
    4638 
  • trunk/plugins/InsertSnippet/insert-snippet.js

    r681 r893  
    6060 
    6161InsertSnippet.prototype.onGenerate = function() { 
    62   var style_id = "IS-style"; 
    63   var style = this.editor._doc.getElementById(style_id); 
    64   if (style == null) { 
    65     style = this.editor._doc.createElement("link"); 
    66     style.id = style_id; 
    67     style.rel = 'stylesheet'; 
    68     style.href = _editor_url + 'plugins/InsertSnippet/InsertSnippet.css'; 
    69     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    70   } 
     62  this.editor.addEditorStylesheet(_editor_url + 'plugins/InsertSnippet/InsertSnippet.css'); 
    7163}; 
    7264 
  • trunk/plugins/SetId/set-id.js

    r851 r893  
    3434 
    3535SetId.prototype.onGenerate = function() { 
    36   var style_id = "ID-style"; 
    37   var style = this.editor._doc.getElementById(style_id); 
    38   if (style == null) { 
    39     style = this.editor._doc.createElement("link"); 
    40     style.id = style_id; 
    41     style.rel = 'stylesheet'; 
    42     style.href = _editor_url + 'plugins/SetId/set-id.css'; 
    43     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    44   } 
     36  this.editor.addEditorStylesheet(_editor_url + 'plugins/SetId/set-id.css'); 
    4537}; 
    4638 
  • trunk/plugins/Template/template.js

    r852 r893  
    3535 
    3636Template.prototype.onGenerate = function() { 
    37   var style_id = "Template-style" 
    38   var style = this.editor._doc.getElementById(style_id); 
    39   if (style == null) { 
    40     style = this.editor._doc.createElement("link"); 
    41     style.id = style_id; 
    42     style.rel = 'stylesheet'; 
    43     style.href = _editor_url + 'plugins/Template/template.css'; 
    44     this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); 
    45   } 
     37  this.editor.addEditorStylesheet(_editor_url + 'plugins/Template/template.css'); 
    4638}; 
    4739 
Note: See TracChangeset for help on using the changeset viewer.