You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by br...@apache.org on 2008/11/04 19:28:36 UTC

svn commit: r711343 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ChangeLog src/com/ecyrd/jspwiki/Release.java src/webdocs/scripts/jspwiki-edit.js src/webdocs/templates/default/editors/plain.jsp

Author: brushed
Date: Tue Nov  4 10:28:36 2008
New Revision: 711343

URL: http://svn.apache.org/viewvc?rev=711343&view=rev
Log:
 2.8.1-svn-6:  [JSPWIKI-381] Sneak-preview is now refreshed periodically as well as the section-list at the left of the screen. 
        

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/scripts/jspwiki-edit.js
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/templates/default/editors/plain.jsp

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog?rev=711343&r1=711342&r2=711343&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Tue Nov  4 10:28:36 2008
@@ -1,3 +1,10 @@
+2008-11-04  Dirk Frederickx <di...@gmail.com>
+
+        * 2.8.1-svn-6
+        
+        * JSPWIKI-381: Sneak-preview is now refreshed periodically as well as the
+        section-list at the left of the screen. 
+        
 2008-11-03  Dirk Frederickx <di...@gmail.com>
 
         * 2.8.1-svn-5

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=711343&r1=711342&r2=711343&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java Tue Nov  4 10:28:36 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "5";
+    public static final String     BUILD         = "6";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/scripts/jspwiki-edit.js
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/scripts/jspwiki-edit.js?rev=711343&r1=711342&r2=711343&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/scripts/jspwiki-edit.js (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/scripts/jspwiki-edit.js Tue Nov  4 10:28:36 2008
@@ -201,6 +201,9 @@
 			.addEvent('keyup', this.getSuggestions.bind(this))
 			.addEvent('change', this.onChangeTextarea.bind(this))
 			.focus();
+
+		/* regularly refresh section-edit toc and sneak-preview */		
+		this.textarea.fireEvent.periodical(3000,this.textarea,['change']);		
 	},
 
 	/* add textarea resize drag bar */
@@ -483,12 +486,15 @@
 	},
 
 	onPageLoadPreview : function(){
-		if( $$('#sneakpreview','#autopreview').length != 2) return;
-		$('autopreview')
+		var checkbox = $('autopreview');
+
+		if(!checkbox) return;
+
+		checkbox
 			.setProperty('checked', Wiki.prefs.get('autopreview') || false)
 			.addEvent('click', function(){ 
 				var ta = this.textarea,
-					isOn = $('autopreview').checked;
+					isOn = checkbox.checked;
 
 				$('sneakpreview').empty();
 				ta.removeEvents('preview');
@@ -501,22 +507,14 @@
 
 	refreshPreview: function(){
     	var	preview = $('sneakpreview');
-		this.bgcolor = this.bgcolor || preview.getStyle('background-color');
 
-    	var	bgcolorfx = (this.bgcolor == 'transparent' ) ? '#fff' : this.bgcolor,
-    		previewfx = preview.effect('background-color', {
-    			duration:2000,
-    			wait:false,
-    			onComplete:function(){ preview.setStyle('background-color', this.bgcolor); }
-    		});
-
-		//TODO: put a spinner in the preview result block
+		$('previewSpin').show();
 		new Ajax( Wiki.TemplateUrl + "/AJAXPreview.jsp?page="+Wiki.PageName, { 
 			postBody: 'wikimarkup=' + encodeURIComponent(this.textarea.value),
 			update: preview,
 			onComplete: function(){ 
+				$('previewSpin').hide();
 				Wiki.renderPage(preview, Wiki.PageName);
-				previewfx.start('#ffff88',bgcolorfx); 
 			}
 		}).request();
 	},
@@ -645,6 +643,7 @@
 	 * happens when 
 	 *  (i)  textarea is changed and deselected (click outside the textarea) 
 	 *  (ii) user clicks a toolbar-button
+	 *  (iii) periodical
 	 *  
 	 * 1) copy section textarea at the right offset of the main textarea
 	 * 2) refresh the section-edit menu
@@ -652,6 +651,9 @@
 	onChangeTextarea : function(){
 		var	ta = this.textarea,	ma = this.mainarea;
 
+		if(ta.value == this.cacheTextarea) return;
+		this.cacheTextarea=ta.value;
+
 		if( this.sections ){
 			var	s = ta.value;
 			if( s.lastIndexOf("\n") + 1 != s.length ) ta.value += '\n';

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/templates/default/editors/plain.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/templates/default/editors/plain.jsp?rev=711343&r1=711342&r2=711343&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/templates/default/editors/plain.jsp (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/webdocs/templates/default/editors/plain.jsp Tue Nov  4 10:28:36 2008
@@ -211,6 +211,7 @@
 <div id="sneakpreviewheader">
   <input type="checkbox" name="autopreview" id="autopreview" <%=TextUtil.isPositive((String)session.getAttribute("autopreview")) ? "checked='checked'" : ""%> />
   <label for="autopreview" title="<fmt:message key='editor.plain.sneakpreview.title'/>"><fmt:message key="editor.plain.sneakpreview"/></label>	  
+  <span id="previewSpin" class="spin" style="position:absolute;display:none;"></span>
 </div>
 <div id="sneakpreview" ></div>