diff dnd.module @ 31:767ebf925654

Added forcecontainer tinymce plugin, lots and lots and lots of refactorizing.
author David Eads <eads@chicagotech.org>
date Thu, 19 Mar 2009 15:58:36 -0500
parents 2d49adbd8992
children 6947c6579d40
line wrap: on
line diff
--- a/dnd.module	Tue Mar 17 21:29:00 2009 -0500
+++ b/dnd.module	Thu Mar 19 15:58:36 2009 -0500
@@ -30,7 +30,7 @@
  */
 function dnd_theme() {
   return array(
-    'dnd_library' => array('arguments' => array('library' => NULL, 'library_id' => NULL), 'template' => 'dnd-library'),
+    'dnd_library_wrapper' => array('arguments' => array('settings' => NULL, 'element' => NULL)),
   );
 }
 
@@ -109,21 +109,13 @@
       'dndEnabledLibraries' => array($element['#id'] => $settings),
     ), 'setting');
 
-    // Store editor representations in Drupal setting
-    drupal_add_js(array(
-      'dndEditorRepresentations' => $library['editor_representations'], 
-      'dndLibraryPreviews' => $library['library_previews'], 
-    ), 'setting');
-
-    // Note that we brute force the wrapper
+    // Generate 
     $element['#suffix'] = '<div class="dnd-library-wrapper" id="'. $settings['library_id'] .'"></div>'. $element['#suffix'];
 
   }
   return $element;
 }
 
-function template_preprocess_dnd_library($library) {}
-
 /**
  * Implementation of hook_wywiwyg_plugin().
  */
@@ -132,22 +124,28 @@
   switch ($editor) {
     case 'tinymce':
       if ($version > 3) {
-        $plugins['atomic'] = array(
-          'type' => 'external',
-          'title' => t('Atomic selection plugin'),
-          'description' => t('This plugin forces a selection up to the outer container of a given element.  It is available via the third party repository maintained by MoxieCode on SourceForge.'),
-          'extensions' => array('atomic' => t('Atomic Selection')),
-          'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/atomic/editor_plugin.js', 
-          'url' => 'http://sourceforge.net/tracker/index.php?func=detail&aid=2519211&group_id=103281&atid=738747',
+        $plugins['forcecontainer'] = array(
+          'title' => t('Force Container Plugin'),
+          'description' => t('A custom plugin to forces a selection up to the outer container of a given element.'),
+          'extensions' => array('forcecontainer' => t('Force Container')),
+          'path' => drupal_get_path('module', 'dnd') .'/js/tinymce/forcecontainer/editor_plugin_src.js', 
           'load' => TRUE,
-        );
-        $plugins['noneditable'] = array(
-          'path' => drupal_get_path('module', 'wysiwyg') .'/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js',
-          'extensions' => array('noneditable' => t('Noneditable')),
-          'load' => TRUE,
+          'options' => array(
+            'forcecontainer_class' => 'dnd-drop-wrapper',
+            'forcecontainer_trigger_dnd' => TRUE,
+          ),
         );
       }
       break;
   }
   return $plugins;
 }
+
+
+/**
+ * Theme the markup that will surround a library loaded via JSON.
+ */
+function theme_dnd_library_wrapper($settings, $element = NULL) {
+  return '<div id="'. $settings['library_id'] .'" class="dnd-library-wrapper"></div>';
+}
+