plugin.min.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 e = tinymce.util.Tools.resolve('tinymce.PluginManager'),
  12. l = tinymce.util.Tools.resolve('tinymce.util.Tools')
  13. e.add('legacyoutput', function (e) {
  14. var s, t
  15. ;((t = s = e).settings.inline_styles = !1),
  16. t.getParam('fontsize_formats') ||
  17. (t.settings.fontsize_formats =
  18. '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7'),
  19. t.getParam('font_formats') ||
  20. (t.settings.font_formats =
  21. '宋体=宋体;黑体=黑体;仿宋_GB2312=仿宋_GB2312;楷体_GB2312=楷体_GB2312;隶书=隶书;幼圆=幼圆;微软雅黑=microsoft yahei;Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats'),
  22. s.on('PreInit', function () {
  23. var e = s,
  24. t = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table',
  25. i = l.explode(
  26. e.getParam(
  27. 'font_size_style_values',
  28. 'xx-small,x-small,small,medium,large,x-large,xx-large'
  29. )
  30. ),
  31. a = e.schema
  32. e.formatter.register({
  33. alignleft: { selector: t, attributes: { align: 'left' } },
  34. aligncenter: { selector: t, attributes: { align: 'center' } },
  35. alignright: { selector: t, attributes: { align: 'right' } },
  36. alignjustify: { selector: t, attributes: { align: 'justify' } },
  37. bold: [
  38. {
  39. inline: 'b',
  40. remove: 'all',
  41. preserve_attributes: ['class', 'style'],
  42. },
  43. {
  44. inline: 'strong',
  45. remove: 'all',
  46. preserve_attributes: ['class', 'style'],
  47. },
  48. { inline: 'span', styles: { fontWeight: 'bold' } },
  49. ],
  50. italic: [
  51. {
  52. inline: 'i',
  53. remove: 'all',
  54. preserve_attributes: ['class', 'style'],
  55. },
  56. {
  57. inline: 'em',
  58. remove: 'all',
  59. preserve_attributes: ['class', 'style'],
  60. },
  61. { inline: 'span', styles: { fontStyle: 'italic' } },
  62. ],
  63. underline: [
  64. {
  65. inline: 'u',
  66. remove: 'all',
  67. preserve_attributes: ['class', 'style'],
  68. },
  69. {
  70. inline: 'span',
  71. styles: { textDecoration: 'underline' },
  72. exact: !0,
  73. },
  74. ],
  75. strikethrough: [
  76. {
  77. inline: 'strike',
  78. remove: 'all',
  79. preserve_attributes: ['class', 'style'],
  80. },
  81. {
  82. inline: 'span',
  83. styles: { textDecoration: 'line-through' },
  84. exact: !0,
  85. },
  86. ],
  87. fontname: {
  88. inline: 'font',
  89. toggle: !1,
  90. attributes: { face: '%value' },
  91. },
  92. fontsize: {
  93. inline: 'font',
  94. toggle: !1,
  95. attributes: {
  96. size: function (e) {
  97. return String(l.inArray(i, e.value) + 1)
  98. },
  99. },
  100. },
  101. forecolor: {
  102. inline: 'font',
  103. attributes: { color: '%value' },
  104. links: !0,
  105. remove_similar: !0,
  106. clear_child_styles: !0,
  107. },
  108. hilitecolor: {
  109. inline: 'font',
  110. styles: { backgroundColor: '%value' },
  111. links: !0,
  112. remove_similar: !0,
  113. clear_child_styles: !0,
  114. },
  115. }),
  116. l.each('b,i,u,strike'.split(','), function (e) {
  117. a.addValidElements(e + '[*]')
  118. }),
  119. a.getElementRule('font') ||
  120. a.addValidElements('font[face|size|color|style]'),
  121. l.each(t.split(','), function (e) {
  122. var t = a.getElementRule(e)
  123. t &&
  124. (t.attributes.align ||
  125. ((t.attributes.align = {}), t.attributesOrder.push('align')))
  126. })
  127. })
  128. })
  129. })()