Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.editor.get
on get (msgText="", fieldName="body", rows=9, pta=nil, toolabrImgUrl="/mainresponderResources/toolbars/htmlEditor", cols=70, baseUrl="/mainresponderResources/toolbars/mozillaEditor/", formName="editPostForm", adrLanguageTable=nil) { <<Add the HTML Editor buttons and scripts. <<02/14/00; 9:13:54 AM by PBS <<Changes: <<8/5/03; 5:02:19 PM by JES <<New optional parameter, baseUrl, used for supporting the Mozilla rich text editor. <<New optional parameter, formName, used for supporting the Mozilla rich text editor. <<1/26/02; 2:40:38 AM by JES <<Added optional parameter, cols -- default is 70. Specifies the width of the editing box. <<12/05/01; 11:11:47 AM by JES <<Respect the rows parameter when returning the WYSIWYG editor. <<08/31/01; 6:44:23 PM by JES <<Factored code that finds the editor name to html.editor.getEditingTool. <<Return a <textarea>-based editor if the given editor is not defined. <<08/31/01; 2:17:42 AM by JES <<New optional parameter: toolabrImgUrl, specifies the URL of an image to use for the WYSIWYG toolbar. <<01/04/01; 12:43:36 AM by JES <<Adapted from mainResponder.discuss.getHtmlEditor <<10/03/00; 10:14:26 PM by JES <<No longer necessary to put JavaScript in head portion of page. <<10/03/00; 2:08:12 PM by PBS <<Support choice of editors -- WYSIWYG, HTML Tags, None. <<10/02/00; 6:03:52 PM by JES <<Return the WYSIWYG HTML editor instead of the older DHTML editor. Use the editor with MSIE4 as well as MSIE5 <<4/10/00; 6:26:41 PM by JES <<Localized -- gets the editor itself using mainResponder.getString if pta == nil { pta = html.getPageTableAddress ()}; <<workspace.pt = pta^; edit (@workspace.pt) //debugging local (editTool = html.editor.getEditingTool (pta)); local (adrEditor = @html.editor.[editTool]); //default to the built-in English if adrLanguageTable != nil { if defined (adrLanguageTable^.data.[editTool]) { adrEditor = @adrLanguageTable^.data.[editTool]}}; if not defined (adrEditor^) { //return a <textarea> return ("<textarea name=\"" + fieldName + "\" rows=\"" + rows + "\" cols=\"" + cols + "\" wrap=\"soft\">" + msgText + "</textarea>")}; pta^.adrEditingTool = adrEditor; if string.lower (nameOf (adrEditor^)) endswith "mozilla" { msgText = string.replaceAll (msgText, "\r\n", "\r"); if msgText contains "\r\r" { msgText = string.replaceAll (msgText, "\r\r", "<br><br>")}}; local (s = string (adrEditor^)); s = string.replace (s, "[[messageText]]", msgText); s = string.replaceAll (s, "[[fieldName]]", fieldName); s = string.replace (s, "[[rows]]", rows); s = string.replace (s, "[[cols]]", cols); s = string.replace (s, "[[heightPixels]]", ((rows * 17) + 50)); s = string.replace (s, "[[toolbarImgUrl]]", toolabrImgUrl); s = string.replaceAll (s, "[[baseUrl]]", baseUrl, false); s = string.replaceAll (s, "[[formName]]", formName, false); return (s)} <<bundle //testing <<op.newOutlineObject (html.editor.get ("Initial HTML text...", "itemtext", 9, @workspace.pt, radio.images.systemImageUrl ("toolbars/htmlEditor")), @workspace.htmlEditor) <<edit (@workspace.htmlEditor)
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.