FilePicker.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * FilePicker.js
  3. *
  4. * Copyright, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://www.tinymce.com/license
  8. * Contributing: http://www.tinymce.com/contributing
  9. */
  10. /*global tinymce:true */
  11. /**
  12. * This class creates a file picker control.
  13. *
  14. * @class tinymce.ui.FilePicker
  15. * @extends tinymce.ui.ComboBox
  16. */
  17. define("tinymce/ui/FilePicker", [
  18. "tinymce/ui/ComboBox"
  19. ], function(ComboBox) {
  20. "use strict";
  21. return ComboBox.extend({
  22. /**
  23. * Constructs a new control instance with the specified settings.
  24. *
  25. * @constructor
  26. * @param {Object} settings Name/value object with settings.
  27. */
  28. init: function(settings) {
  29. var self = this, editor = tinymce.activeEditor, fileBrowserCallback;
  30. settings.spellcheck = false;
  31. fileBrowserCallback = editor.settings.file_browser_callback;
  32. if (fileBrowserCallback) {
  33. settings.icon = 'browse';
  34. settings.onaction = function() {
  35. fileBrowserCallback(
  36. self.getEl('inp').id,
  37. self.getEl('inp').value,
  38. settings.filetype,
  39. window
  40. );
  41. };
  42. }
  43. self._super(settings);
  44. }
  45. });
  46. });