Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save junaidpv/fbcf66ae505e015e06ab to your computer and use it in GitHub Desktop.

Select an option

Save junaidpv/fbcf66ae505e015e06ab to your computer and use it in GitHub Desktop.
Load media_wysiwyg settings and filter for quick editing with CKeditor.
diff --git a/quickedit.module b/quickedit.module
index 6c9ee5c..c8a29b9 100644
--- a/quickedit.module
+++ b/quickedit.module
@@ -144,6 +144,22 @@ function quickedit_page_build(&$page) {
// hence it will also clear this cache entry.
cache_set("quickedit_user_permissions_hash:$serialized_roles", $permissions_hash, 'cache_page', CACHE_TEMPORARY);
}
+
+ // Copied from media_wysiwyg.module:media_wysiwyg_pre_render_text_format()
+ if (module_exists('media_wysiwyg')) {
+ // Add wysiwyg-specific settings.
+ $settings = array('wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()));
+ $page['page_top']['#attached']['js'][] = array(
+ 'data' => array(
+ 'media' => $settings,
+ ),
+ 'type' => 'setting',
+ );
+
+ // Add filter handling.
+ $page['page_top']['#attached']['js'][] = drupal_get_path('module', 'media_wysiwyg') . '/js/media_wysiwyg.filter.js';
+ }
+
$page['page_top']['#attached']['js'][] = array(
'type' => 'setting',
'data' => array('quickedit' => array('user' => array(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment