plugin.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.2.0 (2020-02-13)
  8. */
  9. (function () {
  10. 'use strict';
  11. var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
  12. var register = function (editor) {
  13. editor.addCommand('InsertHorizontalRule', function () {
  14. editor.execCommand('mceInsertContent', false, '<hr />');
  15. });
  16. };
  17. var Commands = { register: register };
  18. var register$1 = function (editor) {
  19. editor.ui.registry.addButton('hr', {
  20. icon: 'horizontal-rule',
  21. tooltip: 'Horizontal line',
  22. onAction: function () {
  23. return editor.execCommand('InsertHorizontalRule');
  24. }
  25. });
  26. editor.ui.registry.addMenuItem('hr', {
  27. icon: 'horizontal-rule',
  28. text: 'Horizontal line',
  29. onAction: function () {
  30. return editor.execCommand('InsertHorizontalRule');
  31. }
  32. });
  33. };
  34. var Buttons = { register: register$1 };
  35. function Plugin () {
  36. global.add('hr', function (editor) {
  37. Commands.register(editor);
  38. Buttons.register(editor);
  39. });
  40. }
  41. Plugin();
  42. }());