-
-
Save davglass/120044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.1" prefix="str" %> | |
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> | |
<%@ attribute name="rteData" type="java.lang.String" required="true" %> | |
<%@ attribute name="editorData" type="java.lang.String" required="true" %> | |
<%@ attribute name="formname" type="java.lang.String" required="true" %> | |
<%@ attribute name="readOnly" type="java.lang.String" required="true" %> | |
<link rel="stylesheet" type="text/css" href="<c:url value='/scripts/yui_2.7.0/yui/build/assets/skins/sam/skin.css'/>" /> | |
<link rel="stylesheet" type="text/css" href="<c:url value='/scripts/yui_2.7.0/yui/build/fonts/fonts-min.css'/>" /> | |
<link rel="stylesheet" type="text/css" href="<c:url value='/scripts/yui_2.7.0/yui/build/resize/assets/skins/sam/resize.css'/>" /> | |
<link rel="stylesheet" type="text/css" href="<c:url value='/scripts/yui_2.7.0/yui/build/editor/assets/skins/sam/editor.css'/>" /> | |
<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/rte.css'/>" /> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/yahoo-dom-event/yahoo-dom-event.js'/>"></script> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/animation/animation-min.js'/>"></script> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/element/element-min.js'/>"></script> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/dragdrop/dragdrop-min.js'/>"></script> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/resize/resize-min.js'/>"></script> | |
<script type="text/javascript" src="<c:url value='/scripts/yui_2.7.0/yui/build/editor/editor-debug.js'/>"></script> | |
<div class="yui-skin-sam"> | |
<textarea name="${rteData}" id="${rteData}" style="visibility: hidden;"> | |
<c:out value="${editorData}" escapeXml="false" /> | |
</textarea> | |
<span id="required" style="color: red;display:inline">*</span> | |
<strong><spring:message code="warning.word.copypaste"/></strong> | |
</div> | |
<script> | |
var Dom = YAHOO.util.Dom, | |
Event = YAHOO.util.Event, | |
editor = null, | |
resize = null; | |
(function() { | |
Event.onDOMReady(function() { | |
//Adding the resize config to the base config | |
BPS.defaultEditorAttrs.resize = true; | |
editor = new YAHOO.widget.Editor('<c:out value="${rteData}"/>',BPS.defaultEditorAttrs); | |
delete editor._defaultToolbar.titlebar; | |
editor.on('toolbarLoaded', function() { | |
var toolsConfig = { | |
label: 'Tools', | |
buttons: [ | |
{ | |
type: 'push', | |
label: 'Spell Check', | |
value: 'spellcheck' | |
} | |
] | |
}; | |
editor.toolbar.addButtonGroup(toolsConfig); | |
editor.toolbar.on('spellcheckClick', function(ev) { | |
editor.saveHTML(); | |
BPS.xscSpellcheck('<c:out value="${rteData}"/>'); | |
}); | |
editor.readOnly = false; | |
editor.on('afterRender', function() { | |
var iframe = editor._createIframe(); | |
iframe.set('id', iframe.get('id') + '_readonly'); | |
editor.get('iframe').get('parentNode').appendChild(iframe.get('element')); | |
editor._readOnlyFrame = iframe; | |
}); | |
editor.toggle = function() { | |
if (this.readOnly) { | |
this.readOnly = false; | |
this.set('disabled', false); | |
this.show(); | |
this._readOnlyFrame.setStyle('visibility', 'hidden'); | |
this.get('iframe').setStyle('visibility', 'visible'); | |
} else { | |
this.readOnly = true; | |
this.set('disabled', true); | |
this.hide(); | |
this.saveHTML(); | |
this.get('iframe').setStyle('visibility', 'hidden'); | |
var iframe = this.get('iframe'); | |
this.set('iframe', this._readOnlyFrame); | |
this.get('iframe').setStyle('visibility', 'visible'); | |
this.get('iframe').setStyle('height', '100%'); | |
this._setInitialContent(); | |
this.set('iframe', iframe); | |
} | |
}; | |
}); | |
editor.render(); | |
}); | |
})(); | |
addLoadEvent(function(){ | |
BPS.initializeSpellCheck( | |
"<%=org.springframework.web.servlet.support.RequestContextUtils.getLocale(request).getLanguage()%>", | |
"<c:url value='/common/xmlmind/xsc_server.jsp'/>", | |
"<c:out value="${formname}"/>"); | |
}); | |
function spellcheckFinish() { | |
var value = document.getElementById("iframehtmlcopy").value; | |
editor.setEditorHTML(value); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment