Changeset 962 for trunk/modules


Ignore:
Timestamp:
02/04/08 00:43:21 (11 years ago)
Author:
ray
Message:
  • #1149 [Safari] retain editing position doesn't work
  • #1148 HTML entities break when cursor is inside when switching from HTML to WYSIWYG
  • #1147 getSelectedHTML() throws error when nothing is selected
  • #1146 [ExtendedFileManager?] IE6 doesn't show images
Location:
trunk/modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/Gecko/Gecko.js

    r957 r962  
    189189/*  This is now handled by a plugin   
    190190    case 13: // ENTER 
    191       if( !ev.shiftKey && editor.config.mozParaHandler == 'dirty' ) 
    192       { 
    193         this.dom_checkInsertP(); 
    194         Xinha._stopEvent(ev); 
    195       } 
     191 
    196192    break;*/ 
    197193 
     
    620616{ 
    621617  var sel = this.getSelection(); 
     618  if (sel.isCollapsed) return ''; 
    622619  var range = this.createRange(sel); 
    623620  return Xinha.getHTML(range.cloneContents(), false, this); 
     
    710707      var after = ta.value.substring( index, ta.value.length ); 
    711708 
    712       if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, and inside the body) 
     709      if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, entities, and inside the body) 
    713710      { 
    714711        var tagEnd = after.indexOf(">") + 1; 
     
    716713      } 
    717714      else ta.value = before + cc + after; 
     715      ta.value = ta.value.replace(new RegExp ('(&[^'+cc+']*?)('+cc+')([^'+cc+']*?;)'), "$1$3$2"); 
    718716      ta.value = ta.value.replace(new RegExp ('(<script[^>]*>[^'+cc+']*?)('+cc+')([^'+cc+']*?<\/script>)'), "$1$3$2"); 
    719717      ta.value = ta.value.replace(new RegExp ('^([^'+cc+']*)('+cc+')([^'+cc+']*<body[^>]*>)(.*?)'), "$1$3$2$4"); 
  • trunk/modules/InternetExplorer/InternetExplorer.js

    r943 r962  
    455455{ 
    456456  var sel = this.getSelection(); 
     457  if (this.selectionEmpty) return ''; 
    457458  var range = this.createRange(sel); 
    458459   
     
    542543    var after  = ta.value.substring( index + cc.length , ta.value.length ); 
    543544     
    544     if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, and inside the body) 
     545    if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, entities, and inside the body) 
    545546    { 
    546547      var tagEnd = after.indexOf(">") + 1; 
     
    548549    } 
    549550    else ta.value = before + cc + after; 
     551    ta.value = ta.value.replace(new RegExp ('(&[^'+cc+']*?)('+cc+')([^'+cc+']*?;)'), "$1$3$2"); 
    550552    ta.value = ta.value.replace(new RegExp ('(<script[^>]*>[^'+cc+']*?)('+cc+')([^'+cc+']*?<\/script>)'), "$1$3$2"); 
    551553    ta.value = ta.value.replace(new RegExp ('^([^'+cc+']*)('+cc+')([^'+cc+']*<body[^>]*>)(.*?)'), "$1$3$2$4"); 
  • trunk/modules/WebKit/WebKit.js

    • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
    r961 r962  
    1414    -- 
    1515    --  The file is loaded as a special plugin by the Xinha Core when 
    16     --  Xinha is being run under a Webkit based browser with the Midas 
    17     --  editing API. 
     16    --  Xinha is being run under a Webkit based browser such as Safari 
    1817    -- 
    1918    --  It provides implementation and specialisation for various methods 
     
    2625    --   that way. 
    2726    -- 
    28     --  $HeadURL: http://svn.xinha.webfactional.com/trunk/modules/Gecko/Gecko.js $ 
    29     --  $LastChangedDate: 2007-10-12 12:00:47 +0200 (Fr, 12 Okt 2007) $ 
    30     --  $LastChangedRevision: 901 $ 
    31     --  $LastChangedBy: ray $ 
     27    --  $HeadURL$ 
     28    --  $LastChangedDate$ 
     29    --  $LastChangedRevision$ 
     30    --  $LastChangedBy$ 
    3231    --------------------------------------------------------------------------*/ 
    3332                                                     
     
    3534  name          : "WebKit", 
    3635  origin        : "Xinha Core", 
    37   version       : "$LastChangedRevision: 901 $".replace(/^[^:]*: (.*) \$$/, '$1'), 
     36  version       : "$LastChangedRevision$".replace(/^[^:]*: (.*) \$$/, '$1'), 
    3837  developer     : "The Xinha Core Developer Team", 
    39   developer_url : "$HeadURL: http://svn.xinha.webfactional.com/trunk/modules/Gecko/Gecko.js $".replace(/^[^:]*: (.*) \$$/, '$1'), 
     38  developer_url : "$HeadURL$".replace(/^[^:]*: (.*) \$$/, '$1'), 
    4039  sponsor       : "", 
    4140  sponsor_url   : "", 
     
    4847} 
    4948 
    50 /** Allow Gecko to handle some key events in a special way. 
     49/** Allow Webkit to handle some key events in a special way. 
    5150 */ 
    5251   
     
    568567{ 
    569568  var sel = this.getSelection(); 
     569  if (sel.isCollapsed) return ''; 
    570570  var range = this.createRange(sel); 
    571571 
     
    651651}; 
    652652 
    653 //Control character for retaining edit location when switching modes 
    654 Xinha.prototype.cc = String.fromCharCode(173);  
     653Xinha.prototype.cc = String.fromCharCode(8286);  
    655654 
    656655Xinha.prototype.setCC = function ( target ) 
     
    666665      var after = ta.value.substring( index, ta.value.length ); 
    667666 
    668       if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, and inside the body) 
     667      if ( after.match(/^[^<]*>/) ) // make sure cursor is in an editable area (outside tags, script blocks, enities and inside the body) 
    669668      { 
    670669        var tagEnd = after.indexOf(">") + 1; 
     
    672671      } 
    673672      else ta.value = before + cc + after; 
     673      ta.value = ta.value.replace(new RegExp ('(&[^'+cc+']*?)('+cc+')([^'+cc+']*?;)'), "$1$3$2"); 
    674674      ta.value = ta.value.replace(new RegExp ('(<script[^>]*>[^'+cc+']*?)('+cc+')([^'+cc+']*?<\/script>)'), "$1$3$2"); 
    675675      ta.value = ta.value.replace(new RegExp ('^([^'+cc+']*)('+cc+')([^'+cc+']*<body[^>]*>)(.*?)'), "$1$3$2$4"); 
     
    685685Xinha.prototype.findCC = function ( target ) 
    686686{ 
    687   if (target == "textarea") 
    688   { // window.find() doesn't find text in textarea, neither does Safari's normal find feature 
    689         // hope they will fix this some time 
    690         // this mechanism to scroll into 
    691     var ta = this._textArea; 
    692     var val = ta.value; 
    693         ta.value =''; 
    694         var initialTaHeight = ta.scrollHeight; 
    695         var start = val.indexOf(this.cc); 
    696     var end = start + this.cc.length; 
    697     ta.value = val.substring( 0, start ); 
    698         var scrollTo = 0; 
    699         if ( ta.scrollHeight > initialTaHeight) 
    700         { 
    701                 scrollTo = ta.scrollHeight; 
    702         } 
    703         ta.value += val.substring( end, val.length ); 
    704     ta.selectionStart = start; 
    705     ta.selectionEnd = start; 
    706     ta.scrollTop = scrollTo; 
    707     ta.focus(); 
     687  if ( target == 'textarea' ) 
     688  { 
     689  var ta = this._textArea; 
     690  var pos = ta.value.indexOf( this.cc ); 
     691  if ( pos == -1 ) return; 
     692  var end = pos + this.cc.length; 
     693  var before =  ta.value.substring( 0, pos ); 
     694  var after = ta.value.substring( end, ta.value.length ); 
     695  ta.value = before ; 
     696 
     697  ta.scrollTop = ta.scrollHeight; 
     698  var scrollPos = ta.scrollTop; 
     699   
     700  ta.value += after; 
     701  ta.setSelectionRange(pos,pos); 
     702 
     703  ta.focus(); 
     704   
     705  ta.scrollTop = scrollPos; 
     706 
    708707  } 
    709708  else 
Note: See TracChangeset for help on using the changeset viewer.