yui.js 928 B

1234567891011121314151617181920212223242526272829303132333435
  1. (function($) {
  2. /**
  3. * Attach this editor to a target element.
  4. */
  5. Drupal.wysiwyg.editor.attach.yui = function(context, params, settings) {
  6. // Apply theme.
  7. $('#' + params.field).parent().addClass('yui-skin-' + settings.theme);
  8. // Attach editor.
  9. var editor = new YAHOO.widget.Editor(params.field, settings);
  10. editor.render();
  11. };
  12. /**
  13. * Detach a single or all editors.
  14. *
  15. * See Drupal.wysiwyg.editor.detach.none() for a full desciption of this hook.
  16. */
  17. Drupal.wysiwyg.editor.detach.yui = function(context, params) {
  18. if (typeof params != 'undefined') {
  19. var instance = YAHOO.widget.EditorInfo.getEditorById(params.field);
  20. if (instance) {
  21. instance.destroy();
  22. }
  23. }
  24. else {
  25. for (var e in YAHOO.widget.EditorInfo._instances) {
  26. // Save contents of all editors back into textareas.
  27. var instance = YAHOO.widget.EditorInfo._instances[e];
  28. instance.destroy();
  29. }
  30. }
  31. };
  32. })(jQuery);