Currently sdl_editor_representation is hard coded as the default context for the dnd library in dnd_library(). This can be changed in a library_alter hook, but that is not enough, the sdl_editor_representation is still used when first dragging an atom into a WYSIWYG field. That is probably caused by dnd_library.js using the editor representation as default rendering (line 223).

I want to get completely rid of the editor representation in the WYSIWYG editor, currently that does not seem to be possible.

Comments

jcisio’s picture

Title: Removing Editor Represenation from WYSIWYG contexts not possible » Drag and drop: allow to change the default context when using
Category: bug » feature
jcisio’s picture

Title: Drag and drop: allow to change the default context when using » Drag and drop: allow to change the default context
Status: Active » Fixed

Fixed with commit 3c59ba4.

gifad’s picture

Sorry, but commit above introduces a lot of variable_get(), but no variable_set() is issued anywhere...

I tried, at the end of function mee_form_alter(), in mee.module :

  $form['instance']['settings']['context'] = array(
    '#type' => 'select',
    '#title' => t('Scald Editor Context'),
    '#description' => t('Choose a Scald Context to use for displaying Scald Atoms included in the textarea during editing.'),
    '#default_value' => $settings['context'],
    '#options' => $context_options,
  );

  $form['#submit'][] = '_mee_additional_submit_handler';
}

function _mee_additional_submit_handler($form, &$form_state) {
  $context = $form_state['values']['instance']['settings']['context'];
  variable_set('dnd_context_default', $context);
}

It works, but the dnd_context_default variable is unique, and ['settings']['context'] is specific to each instance of a body field, so it's definitely not the right answer...

jcisio’s picture

It is a global variable. There is no per-field settings in the current approach, because the context is determined when you start dragging. I think it is also possible to override the default context per field, but it is out of scope of this issue.

gifad’s picture

OK, but then what is the context settings of body fields intended for ?

jcisio’s picture

It's not the default, but fallback, context.

It is used when there is no context (someone types directly [scald=6] in the field) or the specified context does not exist (removed, or the context provider module is disabled).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

arne.olafson’s picture

Issue summary: View changes

For anyone struggling with this, the default context can be changed on a per-field basis:
Structure -> Content Types -> [type] -> Manage fields -> [field] -> Edit
There is a checkbox for Drag'n'Drop Enabled and Select boxes for Default and Fallback Scald contexts