plugin.js 1.2 KB

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