Drupal可折叠字段集脚本,带有调整TinyMCE大小的触发器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Drupal可折叠字段集脚本,带有调整TinyMCE大小的触发器相关的知识,希望对你有一定的参考价值。

This override function for the default Drupal.toggleFieldset function adds code that looks for instances of TinyMCE inside the fieldset and triggers the autoresize on them when the fieldset is opened. Otherwise TinyMCE renders with a weird height.
  1. /**
  2.  * OVERWRITES Drupal.toggleFieldset in /misc/collapse.js
  3.  *
  4.  * Modified to trigger autoresize on tinyMCE textareas inside collapsed fieldsets
  5.  */
  6. Drupal.toggleFieldset = function(fieldset) {
  7. if ($(fieldset).is('.collapsed')) {
  8. // Action div containers are processed separately because of a IE bug
  9. // that alters the default submit button behavior.
  10. var content = $('> div:not(.action)', fieldset);
  11. $(fieldset).removeClass('collapsed');
  12. content.hide();
  13. content.slideDown( {
  14. duration: 'fast',
  15. easing: 'linear',
  16. complete: function() {
  17. Drupal.collapseScrollIntoView(this.parentNode);
  18. this.parentNode.animating = false;
  19. $('div.action', fieldset).show();
  20.  
  21. // >>>>
  22. var editors = $(fieldset).find('.mceEditor');
  23. $.each(editors, function() {
  24. var instance = tinyMCE.get($(this).attr('id').replace('_parent', ''));
  25.  
  26. // Add a min height it it doesn't have one yet
  27. if (instance.plugins.autoresize && instance.plugins.autoresize.autoresize_min_height < 50) {
  28. instance.plugins.autoresize.autoresize_min_height = 50;
  29. }
  30. // Trigger the resize
  31. instance.execCommand('mceAutoResize');
  32. });
  33. // >>>
  34. },
  35. step: function() {
  36. // Scroll the fieldset into view
  37. Drupal.collapseScrollIntoView(this.parentNode);
  38. }
  39. });
  40. }
  41. else {
  42. $('div.action', fieldset).hide();
  43. var content = $('> div:not(.action)', fieldset).slideUp('fast', function() {
  44. $(this.parentNode).addClass('collapsed');
  45. this.parentNode.animating = false;
  46. });
  47. }
  48. };

以上是关于Drupal可折叠字段集脚本,带有调整TinyMCE大小的触发器的主要内容,如果未能解决你的问题,请参考以下文章

带有列表视图的嵌套可折叠集

带有可扩展可折叠行html的gridview

仅在训练折叠上使用带有 SMOTE 过采样的 sklearn 的 RandomizedSearchCV

Drupal 空视图仍然呈现

Drupal-字段集菜单始终展开,并且菜单标题字段的最大长度不同

Drupal 7:如何根据当前页面内容过滤视图内容(带有实体引用字段)