plugin.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Copyright (c) Tiny Technologies, Inc. All rights reserved.
  3. * Licensed under the LGPL or a commercial license.
  4. * For LGPL see License.txt in the project root for license information.
  5. * For commercial licenses see https://www.tiny.cloud/
  6. *
  7. * Version: 5.10.2 (2021-11-17)
  8. */
  9. (function () {
  10. 'use strict';
  11. var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
  12. var global = tinymce.util.Tools.resolve('tinymce.Env');
  13. var register$1 = function (editor) {
  14. editor.addCommand('mcePrint', function () {
  15. if (global.browser.isIE()) {
  16. editor.getDoc().execCommand('print', false, null);
  17. } else {
  18. editor.getWin().print();
  19. }
  20. });
  21. };
  22. var register = function (editor) {
  23. var onAction = function () {
  24. return editor.execCommand('mcePrint');
  25. };
  26. editor.ui.registry.addButton('print', {
  27. icon: 'print',
  28. tooltip: 'Print',
  29. onAction: onAction
  30. });
  31. editor.ui.registry.addMenuItem('print', {
  32. text: 'Print...',
  33. icon: 'print',
  34. onAction: onAction
  35. });
  36. };
  37. function Plugin () {
  38. global$1.add('print', function (editor) {
  39. register$1(editor);
  40. register(editor);
  41. editor.addShortcut('Meta+P', '', 'mcePrint');
  42. });
  43. }
  44. Plugin();
  45. }());