tinymce_plugins_code.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import {
  2. __commonJS,
  3. init_define_APP_INFO
  4. } from "./chunk-XY75H3MP.js";
  5. // node_modules/tinymce/plugins/code/plugin.js
  6. var require_plugin = __commonJS({
  7. "node_modules/tinymce/plugins/code/plugin.js"() {
  8. init_define_APP_INFO();
  9. (function() {
  10. "use strict";
  11. var global = tinymce.util.Tools.resolve("tinymce.PluginManager");
  12. var setContent = function(editor, html) {
  13. editor.focus();
  14. editor.undoManager.transact(function() {
  15. editor.setContent(html);
  16. });
  17. editor.selection.setCursorLocation();
  18. editor.nodeChanged();
  19. };
  20. var getContent = function(editor) {
  21. return editor.getContent({ source_view: true });
  22. };
  23. var open = function(editor) {
  24. var editorContent = getContent(editor);
  25. editor.windowManager.open({
  26. title: "Source Code",
  27. size: "large",
  28. body: {
  29. type: "panel",
  30. items: [{
  31. type: "textarea",
  32. name: "code"
  33. }]
  34. },
  35. buttons: [
  36. {
  37. type: "cancel",
  38. name: "cancel",
  39. text: "Cancel"
  40. },
  41. {
  42. type: "submit",
  43. name: "save",
  44. text: "Save",
  45. primary: true
  46. }
  47. ],
  48. initialData: { code: editorContent },
  49. onSubmit: function(api) {
  50. setContent(editor, api.getData().code);
  51. api.close();
  52. }
  53. });
  54. };
  55. var register$1 = function(editor) {
  56. editor.addCommand("mceCodeEditor", function() {
  57. open(editor);
  58. });
  59. };
  60. var register = function(editor) {
  61. var onAction = function() {
  62. return editor.execCommand("mceCodeEditor");
  63. };
  64. editor.ui.registry.addButton("code", {
  65. icon: "sourcecode",
  66. tooltip: "Source code",
  67. onAction
  68. });
  69. editor.ui.registry.addMenuItem("code", {
  70. icon: "sourcecode",
  71. text: "Source code",
  72. onAction
  73. });
  74. };
  75. function Plugin() {
  76. global.add("code", function(editor) {
  77. register$1(editor);
  78. register(editor);
  79. return {};
  80. });
  81. }
  82. Plugin();
  83. })();
  84. }
  85. });
  86. // node_modules/tinymce/plugins/code/index.js
  87. var require_code = __commonJS({
  88. "node_modules/tinymce/plugins/code/index.js"() {
  89. init_define_APP_INFO();
  90. require_plugin();
  91. }
  92. });
  93. // dep:tinymce_plugins_code
  94. init_define_APP_INFO();
  95. var tinymce_plugins_code_default = require_code();
  96. export {
  97. tinymce_plugins_code_default as default
  98. };
  99. //# sourceMappingURL=tinymce_plugins_code.js.map