If you try to drop an atom into a summary field of a text and summary field, then it will fail with a javascript error.
A solution from @gifad:
Text and summary solved by this patch to mee.module :
function mee_field_widget_form_alter(&$element, &$form_state, $context) {
...
// Activate DnD Library for this element if enabled.
if (!empty($enables['dnd'])) {
- // Force an #id so that we can reference to it later
- $element['#id'] = drupal_html_id('edit-' . $context['field']['field_name']);
- $element += array(
- '#dnd-enabled' => TRUE,
- '#dnd-settings' => array(
- 'drop_selector' => '#' . $element['#id'] . ' .drop',
- ),
- );
+ $fieldname = $element['#field_name'];
+ $language = $element['#language'];
+ $settings = $form_state['field'][$fieldname][$language]['instance']['settings'];
+ $context_default = isset($settings['context_default']) ?
+ $settings['context_default'] :
+ variable_get('dnd_context_default', 'sdl_editor_representation');
+ //uncomment when dnd_process_textarea removed from dnd.module
+ //$element['#attached']['library'][] = array('dnd', 'library');
+ //$element['#attributes']['data-dnd-context'][] = $context_default;
+ if (isset($element['summary']))
+ $element['summary']['#attributes']['data-dnd-context'][] = $context_default;
}
and then remove dnd_element_info_alter() and dnd_process_textarea()
Comments
Comment #1
gifad commentedthanks nagy.balint;
another addition is needed to complete summary handling, as pointed out by yched in #60, about tracking resources;
also in mee.module :
Comment #2
gifad commentedHere is a real patch, including dnd.module cleanup...
Comment #3
nagy.balint commentedI checked, it works fine for me under firefox, chrome and ckeditor 4.4.6.
Can you tell me where this was used before?
Comment #4
gifad commented@nagy.balint
The #id and #dnd-enabled was for dnd.module : process_textarea() to identify element
I suppose it was there because dnd does not depend on mee, so it could not test 'dnd-enabled' itself ?
But if mee.module is not enabled, 'dnd-enabled' checkbox does not even exist...
the drop_selector was qualified as "dead code" by yched recently (#60)...
I could not find any reference in scald package, and no other scald related module I know of...
Comment #5
nagy.balint commentedOkey, thanks for the explanation.
Comment #6
nagy.balint commented@yched : can you review this patch as well? Then we could put this on RTBC.
Comment #8
nagy.balint commentedSince it was already reviewed by gifad, and me. And there was no negative comment since, i think its safe to commit.
Thanks!