Index: editors/js/wymeditor.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/wymeditor.js,v
retrieving revision 1.2
diff -u -p -r1.2 wymeditor.js
--- editors/js/wymeditor.js	6 Jun 2009 02:18:36 -0000	1.2
+++ editors/js/wymeditor.js	1 Jul 2009 21:15:42 -0000
@@ -6,6 +6,12 @@
 Drupal.wysiwyg.editor.attach.wymeditor = function(context, params, settings) {
   // Prepend basePath to wymPath.
   settings.wymPath = settings.basePath + settings.wymPath;
+  // Update activeId on focus.
+  settings.postInit = function(wym) {
+    $(wym._doc).focus(function() {
+      Drupal.wysiwyg.activeId = params.field;
+    });
+  };
   // Attach editor.
   $('#' + params.field).wymeditor(settings);
 };
@@ -36,3 +42,13 @@ Drupal.wysiwyg.editor.detach.wymeditor =
   }
 };
 
+Drupal.wysiwyg.editor.instance.wymeditor = {
+  insert: function(content) {
+    var $field = $('#' + this.field);
+    var index = $field.data(WYMeditor.WYM_INDEX);
+    if (typeof index != 'undefined') {
+      var instance = WYMeditor.INSTANCES[index];
+      instance.insert(content);
+    }
+  }
+};
