使用sharepoint自带的文本编辑器2
首先贴出参考文章链接
http://kb.cnblogs.com/a/1222221/
抛砖引玉:关于 SharePoint 内容编辑器中的文件上传
先照抄第一篇链接的一些东西吧…
sharepoint里面自带的编辑器2种样式.第一个为:FullHtml , 第二个为:Compatible
直接调用Sharepoint控件:SharePoint中的富文本编辑器控件
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePoint:InputFormTextBox Title="" class="ms-input" Width="800px" ID="txtTestRecord" Runat="server" TextMode="MultiLine" Rows="15" RichText="true" AllowHyperlink="true" RichTextMode="FullHtml" />
<%@ Register Tagprefix="SharePointPublish" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePointPublish:HtmlEditor Width="800px" ID="txtTestRecord" Runat="server" id="editor1" />
<%@PageLanguage="C#"%> <%@AssemblyName="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ImportNamespace="Microsoft.SharePoint"%><!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><scriptrunat="server">protected voidPage_Load(objectsender, EventArgse){ } </script><%--引用sharepoint里面的JS文件 当初没有init.js报browseris 未定义的错误,把init.js引用后问题解决--%><scripttype="text/javascript"language="javascript"src="/_layouts/1033/INIT.js"></script> <scripttype="text/javascript"language="javascript"src="/_layouts/1033/form.js"></script><htmlxmlns="http://www.w3.org/1999/xhtml"> <headid="Head1"runat="server"><title></title> </head> <body><formid="form1"runat="server"><div><!--这里写的行内样式好像没有效果--><textareaname="txtTextArea1"rows="6"cols="60"id="txtTextArea1"title="Please Input"style="border: 1px solid blue"></textarea><p></p><asp:TextBoxID="TextBox1"runat="server"style="width:300px;"></asp:TextBox><scriptlanguage="javascript"type="text/javascript">RTE_ConvertTextAreaToRichEdit("txtTextArea1", false, false, "", "1033", null, null, null, null, null, "Compatible", "\u002f", null, null, null, null);//如果使用服务器控件,则需要用<%=TextBox1.ClientID%>, 1033:为美国,2052为中国 可以看你的安装目录 ,[Compatible,FullHtml]RTE_ConvertTextAreaToRichEdit("<%=TextBox1.ClientID%>", true, false, "", "1033", null, null, null, null, null, "FullHtml", "\u002f", null, null, null, null); </script></div></form> </body> </html>
txtTextArea1的效果图: RTE_ConvertTextAreaToRichEdit("txtTextArea1", false, false, "", "1033", null, null, null, null,null, "Compatible", "\u002f", null, null, null, null);
TextBox1的效果图:RTE_ConvertTextAreaToRichEdit("<%=TextBox1.ClientID%>", true, false, "", "1033", null, null, null,null, null, "FullHtml", "\u002f", null, null, null, null);
注意对比他的参数, 第二个参数和 后面的 [Compatible,FullHtml] , 当第二个参数为false ,他的上传图片功能就可以使用Browse的方式了! 不过上面的文章提到过不能保存,这个我还没有测试的!
上面的东西样式不是很好看! 写行内样式没有效果,我想应该在其他参数里面可以设置,看RTE_ConvertTextAreaToRichEdit函数可以知道, 待研究… [如果你知道,请告诉我,谢谢]
如何调整SharePoint InputformTextbox的宽度
var name = "<%= ReportTextBox.ClientID %>";
(document.getElementById(name + "_toolbar")).style.width = "100%";
(document.getElementById(name + "_iframe")).style.width = "100%";
附:RTE_ConvertTextAreaToRichEdit方法源码 【可以在C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\FORM.js】
注意如果你安装的sharepoint为中文,请把 1033 改为 2052
functionRTE_ConvertTextAreaToRichEdit(strBaseElementID,fRestrictedMode,fAllowHyperlink,strDirection,strWebLocale,fSimpleTextOnly,fEditable,fUseDynamicHeightSizing,iMaxHeightSize,iMinHeightSize,strMode,urlWebRoot,strThemeUrl,strBodyClassName,fAllowRelativeLinks,strBaseUrl,fUseDynamicWidthSizing,iMaxWidthSize,iMinWidthSize,fEnforceAccessibilityMode,fPreserveScript,fHookUpEvents,fGenerateToolbar) {;if(!(browseris.ie5up && browseris.win32)) {return;}fEnforceAccessibilityMode = (fEnforceAccessibilityMode == null|| fEnforceAccessibilityMode);if(IsAccessibilityFeatureEnabled() && fEnforceAccessibilityMode) {return;}fSimpleTextOnly = (fSimpleTextOnly != null&& fSimpleTextOnly);fRestrictedMode = (fSimpleTextOnly) ? true: fRestrictedMode;fEditable = (null== fEditable) ? true: fEditable;fUseDynamicHeightSizing = (fUseDynamicHeightSizing != null&& fUseDynamicHeightSizing);iMaxHeightSize = (null== iMaxHeightSize || iMaxHeightSize <= 0) ?g_iDefaultMaxHeightSize : iMaxHeightSize;iMinHeightSize = (null== iMinHeightSize || iMinHeightSize <= 0 || iMinHeightSize > iMaxHeightSize) ?g_iDefaultMinHeightSize : iMinHeightSize;fUseDynamicWidthSizing = (fUseDynamicWidthSizing != null&& fUseDynamicWidthSizing);iMaxWidthSize = (null== iMaxWidthSize || iMaxWidthSize <= 0) ?g_iDefaultMaxWidthSize : iMaxWidthSize;iMinWidthSize = (null== iMinWidthSize || iMinWidthSize <= 0 || iMinWidthSize > iMaxWidthSize) ?g_iDefaultMinWidthSize : iMinWidthSize;fHookUpEvents = (null== fHookUpEvents || fHookUpEvents);fGenerateToolbar = (null== fGenerateToolbar || fGenerateToolbar);if(strMode != "FullHtml")strMode = "Compatible";if(null== strBodyClassName) {strBodyClassName = "ms-formbody";}aSettings = newArray();RTE_InitializeExtendedRichTextSupport(strBaseElementID);varvariables = RTE_GetEditorInstanceVariables(strBaseElementID);varfFullHtml = false;if(strMode == "FullHtml") {fFullHtml = true;fAllowHyperlink = false;variables.overrides.GetToolBarDefinition = RTE_FullHtmlToolBarDefinitionFactory(fEnforceAccessibilityMode);aSettings.fRestrictedMode = true;aSettings.fAllowHyperlink = false;aSettings.fIsVisible = true;}else{aSettings.fRestrictedMode = fRestrictedMode;aSettings.fAllowHyperlink = fAllowHyperlink;aSettings.fIsVisible = !fSimpleTextOnly;}aSettings.urlWebRoot = (urlWebRoot == null|| urlWebRoot == "/") ?"": urlWebRoot;aSettings.fAllowRelativeLinks = (fAllowRelativeLinks == null) ? false: fAllowRelativeLinks;aSettings.fPreserveScript = (fPreserveScript == null) ? false: fPreserveScript;variables.aSettings = aSettings;varelemTextArea = RTE_GetEditorTextArea(strBaseElementID);varstrHtmlToEdit = elemTextArea.innerText;if((null== strHtmlToEdit) || (0 == strHtmlToEdit.length)) {strHtmlToEdit = "<div></div>";}g_elemRTELastTextAreaConverted = elemTextArea;window.attachEvent("onload",newFunction("RTE_TextAreaWindow_OnLoad('"+ strBaseElementID + "');"));varaHtmlToAppend = newArray();if(fGenerateToolbar) {aHtmlToAppend.push(RTE_GenerateToolBarHtmlFromSettings(strBaseElementID, strWebLocale, elemTextArea, aSettings));}aHtmlToAppend.push(RTE_GenerateIFrameEditorHtml(strBaseElementID, elemTextArea, fRestrictedMode, fAllowHyperlink));varstrHtmlToAppend = aHtmlToAppend.join("");elemTextArea.insertAdjacentHTML("afterEnd", strHtmlToAppend);if(fHookUpEvents) {elemTextArea.onfocus = newFunction("RTE_TextArea_OnFocus('"+ strBaseElementID + "')");elemTextArea.style.display = "none";variables.onBeforeUnloadFunc = newFunction("RTE_TransferIFrameContentsToTextArea('"+ strBaseElementID + "');");window.attachEvent("onbeforeunload", variables.onBeforeUnloadFunc);varfindForm = elemTextArea;while(findForm.tagName != "FORM"&& findForm.tagName != "WINDOW") {findForm = findForm.parentElement;}findForm.attachEvent("onsubmit",newFunction("RTE_TransferIFrameContentsToTextArea('"+ strBaseElementID + "');"));}varaEditorHtml = newArray();aEditorHtml.push("<html><head>");if(null!= strBaseUrl && true== fAllowRelativeLinks) {aEditorHtml.push("<base href=\"");aEditorHtml.push(strBaseUrl);aEditorHtml.push("\"/>");}aEditorHtml.push("<link rel=\"stylesheet\" type=\"text/css\" href=\"");aEditorHtml.push(RTE_GetServerRelativeStylesheetUrl("core.css", strWebLocale));aEditorHtml.push("\">");if(null!= strThemeUrl) {aEditorHtml.push("<link rel=\"stylesheet\" type=\"text/css\" href=\"");aEditorHtml.push(strThemeUrl);aEditorHtml.push("\">");}aEditorHtml.push("</head><body class=\"");aEditorHtml.push(strBodyClassName);aEditorHtml.push("\" style=\"background-color: white;border:none;\"></body></html>");varstrEditorHtml = aEditorHtml.join("");vardocEditor = RTE_GetEditorDocument(strBaseElementID);docEditor.designMode = (fEditable ? "on": "off");docEditor = RTE_GetEditorDocument(strBaseElementID);docEditor.open("text/html", "replace");docEditor.write(strEditorHtml);docEditor.close();docEditor.body.scroll = "yes";docEditor.body.wordWrap = false;docEditor.body.contentEditable = true;docEditor.body.innerHTML = strEditorHtml;if(fHookUpEvents) {RTE_EventHookUp(strBaseElementID);}if(fRestrictedMode) {docEditor.body.ondragenter = newFunction("RTE_OnDragEnter(this);");docEditor.body.ondragover = newFunction("RTE_OnDragOver(this);");docEditor.body.ondragdrop = newFunction("RTE_OnDrop(this);");}if(strDirection != ""&&strDirection != "None") {docEditor.dir = strDirection;}else{docEditor.dir = document.dir;}if(fRestrictedMode && !fFullHtml) {docEditor.body.setAttribute(g_strRTERestrictedModeAttributeName, "true");docEditor.body.onpaste = newFunction("RTE_OnPaste_Restricted('"+ strBaseElementID + "', this);");}if(fSimpleTextOnly) {docEditor.body.setAttribute(g_strRTESimpleTextOnlyAttributeName, "true");}if(fUseDynamicHeightSizing || fUseDynamicWidthSizing) {varstrFuncCall = "";if(fUseDynamicHeightSizing) {docEditor.body.style.wordWrap = "break-word";docEditor.body.setAttribute(g_strRTEUseDynamicHeightSizing, "true");docEditor.body.setAttribute(g_strRTEMinHeightSizeAttributeName, iMinHeightSize);docEditor.body.setAttribute(g_strRTEMaxHeightSizeAttributeName, iMaxHeightSize);strFuncCall = "RTE_DocEditor_AdjustHeight('"+ strBaseElementID + "');";}if(fUseDynamicWidthSizing) {docEditor.body.style.wordWrap = "normal";docEditor.body.setAttribute(g_strRTEUseDynamicWidthSizing, "true");docEditor.body.setAttribute(g_strRTEMaxWidthSizeAttributeName, iMaxHeightSize);docEditor.body.setAttribute(g_strRTEMinWidthSizeAttributeName, iMinHeightSize);strFuncCall += "RTE_DocEditor_AdjustWidth('"+ strBaseElementID + "');";}varifmEditor = RTE_GetEditorIFrame(strBaseElementID);docEditor.attachEvent("onkeydown",newFunction(strFuncCall));ifmEditor.attachEvent("onscroll",newFunction(strFuncCall));window.attachEvent("onload",newFunction(strFuncCall));if(fHookUpEvents) {if(fUseDynamicHeightSizing) {RTE_DocEditor_AdjustHeight(strBaseElementID);}if(fUseDynamicWidthSizing) {RTE_DocEditor_AdjustWidth(strBaseElementID);}}}if(fAllowHyperlink) {docEditor.body.setAttribute(g_strRTEAllowHyperlinkAttributeName, "true");}docEditor.body.setAttribute(g_strRTEBaseElementIDAttributeName, strBaseElementID);docEditor.body.setAttribute(g_strRTEWebLocaleAttributeName, strWebLocale);g_rgstrRTEAllEditorsInThePage[g_rgstrRTEAllEditorsInThePage.length] = strBaseElementID;if(fGenerateToolbar) {RTE_DisableToolBar(strBaseElementID);varifmEditorObj = RTE_GetEditorElement(strBaseElementID);ifmEditorObj.tabIndex = elemTextArea.tabIndex;RTE_ToolBarMnemonicInitialization(strBaseElementID);}}
另: sharepoint mysite 的edit profile的编辑页面 用的控件, 我试图把Portal.css也引用到我的页面上,但是编辑器依然没有效果!
<Sharepoint:CssRegistration name="portal.css" runat="server"/>
<img src="/_layouts/images/trans.gif" height="8" width="1" alt=""><br clear="all">
<SPSWC:ProfilePropertyLoader runat="server" />
<table width="1px" cellpadding=0 cellspacing=0>
<tr><td width="100%"><SPSWC:ProfileEditor id="ProfileEditor" runat="server" /></td><td width="20"> </td></tr>
</table>
<Sharepoint:FormDigest runat="server" id="FormDigest" />
转载于:https://www.cnblogs.com/Areas/archive/2011/09/30/2196465.html
使用sharepoint自带的文本编辑器2相关推荐
- SharePoint中的富文本编辑器控件
在sharepoint中,自带一个html文本编辑器,可以对字体的大小,颜色甚至复制和粘贴都可以.这次做项目我们准备通过spd把这个编辑器放到自定义的aspx页面中.费了很大的力气,终于在博客堂()和 ...
- linux自带的文本编辑器,linux自带文本编辑器
python2.x直接中文字符串用u'你好',这样 刚刚测试了一下#-*-coding:cp936-*-原因导致错误的改变,是因为改了windows行尾在windows的python自带编辑器run, ...
- 10.18.1 linux文本编辑器vim
vi和vim的区别 编辑一个文本时,vi不会显示颜色,而vim会显示颜色,vi 有点类似windows记事本,简单,那么就是vim复杂编辑器,功能复杂,高亮,自动缩进(写shell/python脚本用 ...
- 文本编辑器查看 cprintf颜色_做生信,你需要一款好用的文本编辑器
"工欲善其事,必先利其器",选择合适的工具很重要.在做生物信息分析过程中,经常需要查看序列,编辑文本,修改程序代码等,这个过程中就需要使用文本编辑器.一般系统自带的文本编辑器都过于 ...
- 随堂笔记4——文本编辑器Vim
文本编辑器:vi / vim / gvim,gedit,emac(完全不能使用鼠标),以上都是原生态自带的文本编辑器,目的是让开发者脱离鼠标. Vim文本编辑器 使用场景:单文件编辑:vim + 插件 ...
- php去除编辑器html标签,js处理富文本编辑器转义、去除转义、去除HTML标签
富文本编辑器生成的HTML标签,进行转义,然后写入数据库,防止脚本注入: function htmlEncode(value){ return $(' } 从数据库拿出的转义后的HTML标签内容,先得 ...
- 【8086汇编】DOS系统中 edit 文本编辑器详解
1.edit介绍 edit是DOS系统自带的文本编辑器. 2.edit启动 仅仅启动edit 在命令行中直接输入edit启动edit文本编辑器: 启动后edit文本编辑器界面如下: 使用edit打开文 ...
- Vi文本编辑器的使用方法
一.什么是vi 是一种文本编辑器,是Visual interface的简称: 而vim则是vi的强化版vi plus,专业全称Vi improved. 二.vi的优势 所有的类Unix系统(Unix ...
- JForum论坛添加UEditor文本编辑器
在使用JForum论坛中发现论坛自带的文本编辑器不好用,不能上传图片,样式编辑也很麻烦,就想着把这个文本编辑器替换掉,我这里选用的是百度的开源富文本编辑器UEditor 替换后的效果图 替换方法如下 ...
最新文章
- AI一分钟|AI聊机器人“Shibuyu Mirai”获日本居住权,传今日头条3亿美元收购Faceu激萌
- 常见java考试题与面试题一
- 一文聊“图”,从图数据库到知识图谱
- Python-类与文件读取结合
- centos7无GUI情况安装Xvfb、selenium、chrome
- JS判断UA动态加载CSS的方法
- Java并发编程-ReentrantLock可重入锁
- Node.js怎么处理数据库中日期类型
- 云豹直播源码v8.2
- High Score
- 计算机更改开机密码快捷方法,win7怎么修改开机密码(最快) win7修改开机密码最便捷的方法...
- Linux dns劫持程序,linux的dns被劫持(解决方案)
- C语言输入一个数,看它能否被3和5同时整除
- 有没有能排列待办事项无广告的Windows版便签软件推荐
- Hygon C86 7xxx处理器在Windows 10下无法开启虚拟化支持的问题
- 开发快手爬票项目(中)
- 玛格丽特·米德2019下半年EI会议与人格理论初探
- 一篇文章构建你的 NodeJS 知识体系(W字长文)
- 《咸鱼分享》咸鱼在线TOP
- Python数据预处理——格式转换及抽取数据文本信息
热门文章
- java程序实验报告_实验报告一
- 选择排序java代码_JAVA简单选择排序算法原理及实现
- c51随机数不重复_怎么让51单片机产生随机数?
- centos6.8安装mysql6.5_centos6.8 yum安装mysql 5.6 (完整)
- 计算机丢失lib.dll,libprotobuf.dll
- xMind思维导图软件如何合并多个导图
- Spring写第一个程序HelloSpring
- QT程序在windows下部署发布
- 在View页面,使用@if(){ }输出判断正确的内容
- asp.net的decimal保留两位小数