[seam-commits] Seam SVN: r7429 - in trunk/examples/wiki: src/etc/i18n and 11 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Feb 15 12:48:01 EST 2008
Author: christian.bauer at jboss.com
Date: 2008-02-15 12:48:01 -0500 (Fri, 15 Feb 2008)
New Revision: 7429
Modified:
trunk/examples/wiki/src/etc/WEB-INF/pages.xml
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/etc/i18n/messages_forum_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java
trunk/examples/wiki/view/docEdit_d.xhtml
trunk/examples/wiki/view/includes/searchControl.xhtml
trunk/examples/wiki/view/includes/wikiTextEditor.xhtml
trunk/examples/wiki/view/plugins/tags/plugin.xhtml
trunk/examples/wiki/view/themes/default/js/lacewiki.js
trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
Log:
Button for manual preview, force validation for comments/forum postings
Modified: trunk/examples/wiki/src/etc/WEB-INF/pages.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/pages.xml 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/etc/WEB-INF/pages.xml 2008-02-15 17:48:01 UTC (rev 7429)
@@ -30,6 +30,9 @@
<rule if-outcome="redirectToDocumentNoConversation">
<redirect url="#{wikiURLRenderer.renderURL(documentHome.instance)}"/>
</rule>
+ <rule if-outcome="redirectToComment">
+ <redirect url="#{wikiURLRenderer.renderURL(documentHome.instance)}#comment#{commentHome.instance.id}"/>
+ </rule>
</navigation>
</page>
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-02-15 17:48:01 UTC (rev 7429)
@@ -218,7 +218,7 @@
# Wiki Text Editor
lacewiki.label.wikiTextEditor.CharactersLeft=chars left
-lacewiki.msg.wikiTextEditor.EditThisTextPreviewUpdatesAutomatically=Click HELP for text formatting instructions. Then edit this text, this live preview updates if you stop typing for 3 seconds.
+lacewiki.msg.wikiTextEditor.EditThisText=Click HELP for text formatting instructions. Then edit this text and check the preview.
lacewiki.msg.wikiTextEditor.FormatSelection=Format selected text...
lacewiki.msg.wikiTextEditor.FormatInline=-------- Inline --------
lacewiki.msg.wikiTextEditor.FormatMonospace=Monospace/Code
@@ -237,6 +237,8 @@
lacewiki.msg.wikiTextEditor.FormatHeadline2=Headline 2
lacewiki.msg.wikiTextEditor.FormatHeadline3=Headline 3
lacewiki.msg.wikiTextEditor.FormatHeadline4=Headline 4
+lacewiki.button.wikiTextEditor.UpdatePreview=Update Pre<u>v</u>iew
+lacewiki.button.wikiTextEditor.UpdatePreview.accesskey=V
# Document Display
@@ -531,7 +533,7 @@
lacewiki.label.docEdit.PushOnFeeds=Push changes onto feeds
lacewiki.label.docEdit.PushOnParentFeeds=Push changes onto feeds of parent directories
lacewiki.label.docEdit.Content=Content
-lacewiki.label.docEdit.EnableLivePreview=Enable live preview
+lacewiki.label.docEdit.EnablePreview=Enable preview
lacewiki.label.docEdit.ShowPluginSettings=Show plugin settings in preview
lacewiki.label.docEdit.CreatedOn=Created on
lacewiki.label.docEdit.Options=Options
Modified: trunk/examples/wiki/src/etc/i18n/messages_forum_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_forum_en.properties 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/etc/i18n/messages_forum_en.properties 2008-02-15 17:48:01 UTC (rev 7429)
@@ -72,8 +72,8 @@
forum.button.RemoveReply=Remove
forum.button.PreviousPosting=Pre<u>v</u>ious
forum.button.PreviousPosting.accesskey=V
-forum.button.NextPosting=<u>N</u>ext
-forum.button.NextPosting.accesskey=N
+forum.button.NextPosting=Ne<u>x</u>t
+forum.button.NextPosting.accesskey=X
forum.label.replyForm.Name=Name
forum.label.replyForm.Email=E-mail address (optional)
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -8,6 +8,7 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.Component;
+import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.security.AuthorizationException;
import org.jboss.seam.security.Identity;
import org.jboss.seam.core.Events;
@@ -22,6 +23,8 @@
import org.jboss.seam.wiki.util.WikiUtil;
import static javax.faces.application.FacesMessage.SEVERITY_INFO;
+import javax.faces.application.FacesMessage;
+import javax.faces.validator.ValidatorException;
import java.util.Date;
@Name("commentHome")
@@ -93,7 +96,7 @@
comment.setSubject(documentHome.getInstance().getName());
// Default to help text
- comment.setContent(Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisTextPreviewUpdatesAutomatically"));
+ comment.setContent(Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisText"));
return comment;
}
@@ -108,6 +111,9 @@
@Override
public String persist() {
+
+ if (!validateContent()) return null;
+
String outcome = super.persist();
if (outcome != null) {
@@ -121,7 +127,7 @@
Events.instance().raiseEvent("Comment.persisted");
endConversation();
- return "redirectToDocumentNoConversation";
+ return "redirectToComment";
}
return null; // Prevent navigation
}
@@ -194,6 +200,22 @@
/* -------------------------- Internal Methods ------------------------------ */
+ protected boolean validateContent() {
+ FormattedTextValidator validator = new FormattedTextValidator();
+ try {
+ validator.validate(null, null, getInstance().getContent());
+ } catch (ValidatorException e) {
+ // TODO: Needs to use resource bundle, how?
+ getFacesMessages().addToControl(
+ getTextAreaId(),
+ FacesMessage.SEVERITY_WARN,
+ e.getFacesMessage().getSummary()
+ );
+ return false;
+ }
+ return true;
+ }
+
protected void endConversation() {
showForm = false;
Conversation.instance().end();
@@ -231,10 +253,14 @@
quoted.append(WikiUtil.formatDate(date)).append(":").append("_").append("<br/>\n\n");
quoted.append(text);
quoted.append("\n").append("</blockquote>").append("\n\n");
- quoted.append(Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisTextPreviewUpdatesAutomatically"));
+ quoted.append(Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisText"));
return quoted.toString();
}
+ protected String getTextAreaId() {
+ return "commentTextArea";
+ }
+
/* -------------------------- Public Features ------------------------------ */
public boolean isShowForm() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -129,6 +129,9 @@
public N afterNodeCreated(N node) {
+ if (parentNodeId == null)
+ throw new IllegalStateException("Missing parentNodeId parameter");
+
outjectCurrentLocation(node);
return node;
@@ -136,9 +139,6 @@
public N beforeNodeEditNew(N node) {
- if (parentNodeId == null)
- throw new IllegalStateException("Missing parentNodeId parameter");
-
getLog().debug("loading parent node with id: " + parentNodeId);
parentNode = findParentNode(parentNodeId);
if (parentNode == null)
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/renderer/WikiURLRenderer.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -18,6 +18,8 @@
import org.jboss.seam.wiki.core.model.Feed;
import org.jboss.seam.wiki.core.ui.FeedServlet;
+import java.io.Serializable;
+
/**
* Renders outgoing URLs in a unified fashion, see urlrewrite.xml for incoming URL GET request rewriting.
* <p>
@@ -30,7 +32,7 @@
@Name("wikiURLRenderer")
@Scope(ScopeType.CONVERSATION)
@AutoCreate
-public class WikiURLRenderer {
+public class WikiURLRenderer implements Serializable {
@In
String basePath;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -17,10 +17,6 @@
/**
* Store UI status of wiki text editor.
* <p>
- * This is called via Javascript when the user changes some visual properties of the wiki text editor,
- * atm this is only resizing of the text area. We need to store the UI properties so that we can restore
- * the UI when the user exits the page and comes back later in the conversation. Or, when we reRender the
- * wiki text editor we need to apply these properties so it looks the same as before the reRender.
*
* @author Christian Bauer
*/
@@ -28,17 +24,6 @@
@Scope(ScopeType.CONVERSATION) // TODO: Should be PAGE but doesn't work with Seam remoting!
public class WikiTextEditor implements Serializable {
- private Map<String, String> textAreaRows = new HashMap<String, String>();
-
- @WebRemote
- public void setTextAreaRows(String editorId, String textAreaRows) {
- this.textAreaRows.put(editorId, textAreaRows);
- }
-
- public String getTextAreaRows(String editorId) {
- return textAreaRows.get(editorId);
- }
-
public void validate(String textEditorId, String value) {
if (value == null) return;
FormattedTextValidator validator = new FormattedTextValidator();
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -54,7 +54,7 @@
}
@Override
public String getContentText() {
- return Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisTextPreviewUpdatesAutomatically");
+ return Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisText");
}
@Override
public void setOptions(WikiDocument newQuestion) {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -77,6 +77,10 @@
return "forumReplyFeedEntryManager";
}
+ protected String getTextAreaId() {
+ return "replyTextArea";
+ }
+
/* -------------------------- Messages ------------------------------ */
protected void createdMessage() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-02-15 17:48:01 UTC (rev 7429)
@@ -1,6 +1,7 @@
package org.jboss.seam.wiki.plugin.forum;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.annotations.*;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.core.Conversation;
@@ -14,6 +15,8 @@
import org.jboss.seam.wiki.preferences.Preferences;
import static javax.faces.application.FacesMessage.SEVERITY_INFO;
+import javax.faces.application.FacesMessage;
+import javax.faces.validator.ValidatorException;
@Name("topicHome")
@Scope(ScopeType.CONVERSATION)
@@ -66,7 +69,7 @@
}
@Override
public String getContentText() {
- return Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisTextPreviewUpdatesAutomatically");
+ return Messages.instance().get("lacewiki.msg.wikiTextEditor.EditThisText");
}
@Override
public String[] getFooterMacrosAsString() {
@@ -88,6 +91,23 @@
}
@Override
+ protected boolean preparePersist() {
+ FormattedTextValidator validator = new FormattedTextValidator();
+ try {
+ validator.validate(null, null, getInstance().getContent());
+ } catch (ValidatorException e) {
+ // TODO: Needs to use resource bundle, how?
+ getFacesMessages().addToControl(
+ "topicTextArea",
+ FacesMessage.SEVERITY_WARN,
+ e.getFacesMessage().getSummary()
+ );
+ return false;
+ }
+ return super.preparePersist();
+ }
+
+ @Override
protected boolean beforePersist() {
// TODO: Use macro parameters for "sticky" and "notify" options instead of additional macros
if (isSticky()) {
Modified: trunk/examples/wiki/view/docEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docEdit_d.xhtml 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/docEdit_d.xhtml 2008-02-15 17:48:01 UTC (rev 7429)
@@ -194,7 +194,7 @@
oncomplete="onAjaxRequestComplete()"
reRender="contentPreview, docEditForm:contentTextEditor, pluginSwitch"/>
</h:selectBooleanCheckbox>
- <h:outputText value="#{messages['lacewiki.label.docEdit.EnableLivePreview']}"/>
+ <h:outputText value="#{messages['lacewiki.label.docEdit.EnablePreview']}"/>
</div>
</s:div>
Modified: trunk/examples/wiki/view/includes/searchControl.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/searchControl.xhtml 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/includes/searchControl.xhtml 2008-02-15 17:48:01 UTC (rev 7429)
@@ -16,7 +16,6 @@
<h:commandButton id="submitSearch"
styleClass="searchControlButton sessionEventTrigger" tabindex="61"
- accesskey="#{messages['lacewiki.button.searchControl.Find.accesskey']}"
action="search" value="#{messages['lacewiki.button.searchControl.Find']}">
<s:defaultAction/>
</h:commandButton>
Modified: trunk/examples/wiki/view/includes/wikiTextEditor.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/wikiTextEditor.xhtml 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/includes/wikiTextEditor.xhtml 2008-02-15 17:48:01 UTC (rev 7429)
@@ -72,7 +72,7 @@
<h:panelGrid columns="1" cellpadding="0" cellspacing="0" border="0">
- <h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="0">
+ <h:panelGrid columns="3" cellpadding="0" cellspacing="0" border="0">
<s:fragment>
<select id="#{textEditorId}Formatter"
@@ -114,6 +114,24 @@
<ui:param name="helpDocument" value="Wiki Text Markup"/>
</ui:decorate>
+ <s:fragment>
+ <s:fragment rendered="#{not empty textPreviewId}">
+ <h:outputLink value="#"
+ tabindex="1" styleClass="buttonNonpersistent noWrapWhitespace"
+ accesskey="#{messages['lacewiki.button.wikiTextEditor.UpdatePreview.accesskey']}"
+ onclick="rememberCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea'); #{textEditorId}UpdatePreview(); return false;">
+ <h:outputText styleClass="buttonLabel" escape="false" value="#{messages['lacewiki.button.wikiTextEditor.UpdatePreview']}"/>
+ </h:outputLink>
+
+ <a:jsFunction name="#{textEditorId}UpdatePreview"
+ action="#{wikiTextEditor.validate(textEditorId, valueBinding)}"
+ status="globalStatus"
+ reRender="#{textEditorId}MessageLabel, #{textPreviewId}"
+ eventsQueue="ajaxEventQueue"
+ oncomplete="onAjaxRequestComplete();setRememberedCursorPosition('##{namingContainer}\\\\:#{textEditorId}TextArea');"/>
+ </s:fragment>
+ </s:fragment>
+
</h:panelGrid>
<s:div id="#{textEditorId}TextAreaDiv" styleClass="textEditResizable">
@@ -122,9 +140,7 @@
styleClass="ajaxSupport"
tabindex="1"
cols="#{empty textEditorColumns ? '58' : textEditorColumns}"
- rows="#{not empty wikiTextEditor.getTextAreaRows(textEditorId)
- ? wikiTextEditor.getTextAreaRows(textEditorId)
- : textEditorRows}"
+ rows="#{textEditorRows}"
required="#{valueRequired}"
value="#{valueBinding}">
<a:support event="onkeyup"
Modified: trunk/examples/wiki/view/plugins/tags/plugin.xhtml
===================================================================
--- trunk/examples/wiki/view/plugins/tags/plugin.xhtml 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/plugins/tags/plugin.xhtml 2008-02-15 17:48:01 UTC (rev 7429)
@@ -36,7 +36,8 @@
</h:column>
</h:dataTable>
- <s:span styleClass="undecoratedLink defaultColumn" rendered="#{preferences.get('Tags', currentMacro).linkToCurrentDocument}">
+ <s:span styleClass="undecoratedLink defaultColumn"
+ rendered="#{preferences.get('Tags', currentMacro).linkToCurrentDocument and not empty param.tag}">
<h:outputLink value="#{wikiURLRenderer.renderURL(currentDocument)}">
<h:outputText value="#{messages['tags.label.All']}"/>
</h:outputLink>
Modified: trunk/examples/wiki/view/themes/default/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-02-15 17:48:01 UTC (rev 7429)
@@ -108,3 +108,31 @@
}
}
+var cursorPosition;
+var scrollPosition;
+function rememberCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
+ cursorPosition = textArea.caretPos;
+ } else if (typeof(textArea.selectionStart) != "undefined") {
+ cursorPosition = textArea.selectionStart;
+ scrollPosition = textArea.scrollTop;
+ } else {
+ cursorPosition = textArea.value.length - 1;
+ }
+
+}
+function setRememberedCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if(textArea.createTextRange) {
+ var range = textArea.createTextRange();
+ range.move("character", cursorPosition);
+ range.select();
+ } else if(textArea.selectionStart) {
+ textArea.focus();
+ textArea.setSelectionRange(cursorPosition, cursorPosition);
+ textArea.scrollTop = scrollPosition;
+ } else {
+ textArea.focus(cursorPosition);
+ }
+}
\ No newline at end of file
Modified: trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-02-15 17:48:01 UTC (rev 7429)
@@ -108,3 +108,31 @@
}
}
+var cursorPosition;
+var scrollPosition;
+function rememberCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
+ cursorPosition = textArea.caretPos;
+ } else if (typeof(textArea.selectionStart) != "undefined") {
+ cursorPosition = textArea.selectionStart;
+ scrollPosition = textArea.scrollTop;
+ } else {
+ cursorPosition = textArea.value.length - 1;
+ }
+
+}
+function setRememberedCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if(textArea.createTextRange) {
+ var range = textArea.createTextRange();
+ range.move("character", cursorPosition);
+ range.select();
+ } else if(textArea.selectionStart) {
+ textArea.focus();
+ textArea.setSelectionRange(cursorPosition, cursorPosition);
+ textArea.scrollTop = scrollPosition;
+ } else {
+ textArea.focus(cursorPosition);
+ }
+}
\ No newline at end of file
Modified: trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-02-15 14:42:21 UTC (rev 7428)
+++ trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-02-15 17:48:01 UTC (rev 7429)
@@ -108,3 +108,31 @@
}
}
+var cursorPosition;
+var scrollPosition;
+function rememberCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
+ cursorPosition = textArea.caretPos;
+ } else if (typeof(textArea.selectionStart) != "undefined") {
+ cursorPosition = textArea.selectionStart;
+ scrollPosition = textArea.scrollTop;
+ } else {
+ cursorPosition = textArea.value.length - 1;
+ }
+
+}
+function setRememberedCursorPosition(textAreaId) {
+ var textArea = jQuery(textAreaId)[0];
+ if(textArea.createTextRange) {
+ var range = textArea.createTextRange();
+ range.move("character", cursorPosition);
+ range.select();
+ } else if(textArea.selectionStart) {
+ textArea.focus();
+ textArea.setSelectionRange(cursorPosition, cursorPosition);
+ textArea.scrollTop = scrollPosition;
+ } else {
+ textArea.focus(cursorPosition);
+ }
+}
\ No newline at end of file
More information about the seam-commits
mailing list