[pLog-svn] r1007 - plog/trunk/js/htmlarea
mark at devel.plogworld.net
mark at devel.plogworld.net
Tue Feb 8 16:53:50 GMT 2005
Author: mark
Date: 2005-02-08 16:53:50 +0000 (Tue, 08 Feb 2005)
New Revision: 1007
Modified:
plog/trunk/js/htmlarea/htmlarea-plog.js
Log:
Remove HTMLConfig object, and put the config code to HTMLArea object. Why I do this? Becasue if we just only use one config object, then these two editors will share the same config setting.
When we install plugin in HTMLArea, It is impossible only activate plugin in specific editor if we share the same config object. So, we need two instance of config.
Modified: plog/trunk/js/htmlarea/htmlarea-plog.js
===================================================================
--- plog/trunk/js/htmlarea/htmlarea-plog.js 2005-02-08 15:37:50 UTC (rev 1006)
+++ plog/trunk/js/htmlarea/htmlarea-plog.js 2005-02-08 16:53:50 UTC (rev 1007)
@@ -18,10 +18,13 @@
// this function will get called at body.onload
function initEditor() {
- var config = new HTMLArea.Config();
-
- // Register the 'insert resource' button
- config.registerButton({
+ // ------------------------------------------------------
+ // Create postText Editor
+ // ------------------------------------------------------
+ postTextEditor = new HTMLArea("postText");
+
+ // Config postText Toolbar
+ postTextEditor.config.registerButton({
id: "insertresource",
tooltip: "Insert Resource",
image: "js/htmlarea/images/ed_resource.gif",
@@ -29,23 +32,43 @@
action: insertResource});
// add our new icon in a place better suited for this task...
- config.toolbar = [
+ postTextEditor.config.toolbar = [
[ "fontsize", "space","space",
"bold", "italic", "underline", "strikethrough", "separator",
"justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"orderedlist", "unorderedlist", "separator",
"createlink", "insertimage", "insertresource", "htmlmode" ]
];
-
- // Create postText Editor
- postTextEditor = new HTMLArea("postText", config);
+
+ // Config postText Plugins
postTextEditor.registerPlugin(EnterParagraphs);
// Generate postText Editor
setTimeout(function() {postTextEditor.generate();}, 1000);
+ // ------------------------------------------------------
// Create postExtendedText Editor
- postExtendedTextEditor = new HTMLArea("postExtendedText", config);
+ // ------------------------------------------------------
+ postExtendedTextEditor = new HTMLArea("postExtendedText");
+
+ // Config postText Toolbar
+ postExtendedTextEditor.config.registerButton({
+ id: "insertresource",
+ tooltip: "Insert Resource",
+ image: "js/htmlarea/images/ed_resource.gif",
+ textMode: false,
+ action: insertResource});
+
+ // add our new icon in a place better suited for this task...
+ postExtendedTextEditor.config.toolbar = [
+ [ "fontsize", "space","space",
+ "bold", "italic", "underline", "strikethrough", "separator",
+ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
+ "orderedlist", "unorderedlist", "separator",
+ "createlink", "insertimage", "insertresource", "htmlmode" ]
+ ];
+
+ // Config postText Plugins
postExtendedTextEditor.registerPlugin(EnterParagraphs);
// Generate postExtendedText Editor
@@ -55,7 +78,6 @@
};
// The method that will insert a resource
-// HTMLArea.prototype._insertResource = function(editor, id) {
function insertResource(editor, id) {
//var editor = this; // for nested functions
editor._plogPopupDialog("admin.php?op=resourceList&mode=1", function(param) {
@@ -68,5 +90,6 @@
}, null);
};
+// Initialize HTMLArea Editor
HTMLArea.init();
HTMLArea.onload = initEditor;
\ No newline at end of file
More information about the pLog-svn
mailing list