activeadmin_trumbowyg 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -5
  3. data/Rakefile +11 -0
  4. data/app/assets/fonts/trumbowyg/icons.svg +1 -1
  5. data/app/assets/javascripts/activeadmin/trumbowyg/langs/az.js +63 -0
  6. data/app/assets/javascripts/activeadmin/trumbowyg/langs/az.min.js +9 -0
  7. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.js +30 -13
  8. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.min.js +8 -5
  9. data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.js +11 -2
  10. data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.min.js +1 -1
  11. data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.js +1 -1
  12. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.js +11 -2
  13. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +3 -3
  14. data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.js +1 -1
  15. data/app/assets/javascripts/activeadmin/trumbowyg/langs/et.js +7 -7
  16. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.js +1 -1
  17. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.js +1 -1
  18. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.js +3 -0
  19. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.min.js +1 -1
  20. data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.js +1 -1
  21. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.js +3 -0
  22. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.min.js +1 -1
  23. data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.js +1 -1
  24. data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.js +4 -1
  25. data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.min.js +1 -1
  26. data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.js +1 -1
  27. data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.js +39 -39
  28. data/app/assets/javascripts/activeadmin/trumbowyg/langs/{no_nb.js → nb.js} +22 -8
  29. data/app/assets/javascripts/activeadmin/trumbowyg/langs/nb.min.js +15 -0
  30. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.js +1 -1
  31. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.js +2 -2
  32. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.js +2 -2
  33. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.js +1 -1
  34. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.js +1 -1
  35. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +10 -6
  36. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +2 -1
  37. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.js +2 -2
  38. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.js +1 -0
  39. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.min.js +1 -1
  40. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.js +33 -33
  41. data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +5 -3
  42. data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.min.js +1 -1
  43. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.js +1 -1
  44. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.js +1 -1
  45. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +11 -0
  46. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +28 -1
  47. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +8 -1
  48. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +11 -0
  49. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +39 -2
  50. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +10 -1
  51. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +3 -3
  52. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +45 -40
  53. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +1 -1
  54. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +916 -848
  55. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +9 -1
  56. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +3 -3
  57. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +23 -18
  58. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +1 -1
  59. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +22 -7
  60. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -1
  61. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +100 -8
  62. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -1
  63. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.js +251 -172
  64. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -1
  65. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +17 -16
  66. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +60 -47
  67. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -2
  68. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +24 -4
  69. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -1
  70. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +12 -12
  71. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +13 -10
  72. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +2 -2
  73. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +6 -61
  74. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +8 -1
  75. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/indent/trumbowyg.indent.js +31 -2
  76. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/indent/trumbowyg.indent.min.js +9 -1
  77. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +18 -0
  78. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +8 -1
  79. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +50 -5
  80. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -1
  81. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +97 -50
  82. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +8 -1
  83. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +31 -26
  84. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +29 -21
  85. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -2
  86. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +12 -0
  87. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +10 -1
  88. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +3 -3
  89. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +16 -17
  90. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -2
  91. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +51 -20
  92. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +8 -1
  93. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.js +36 -53
  94. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.min.js +10 -1
  95. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +9 -0
  96. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +12 -0
  97. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +8 -1
  98. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +3 -1
  99. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +20 -0
  100. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +10 -1
  101. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js +18 -0
  102. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +8 -1
  103. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +3 -3
  104. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css +25 -19
  105. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +1 -1
  106. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/speechrecognition/trumbowyg.speechrecognition.js +198 -0
  107. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/speechrecognition/trumbowyg.speechrecognition.min.js +11 -0
  108. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +1436 -158
  109. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +11 -1
  110. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +157 -32
  111. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +143 -22
  112. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -2
  113. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +9 -0
  114. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
  115. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/tenor/trumbowyg.tenor.js +319 -0
  116. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/tenor/trumbowyg.tenor.min.js +1 -0
  117. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/tenor/ui/sass/trumbowyg.tenor.scss +124 -0
  118. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/tenor/ui/trumbowyg.tenor.css +119 -0
  119. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/tenor/ui/trumbowyg.tenor.min.css +2 -0
  120. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +119 -76
  121. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +13 -1
  122. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +126 -80
  123. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -12
  124. data/app/assets/stylesheets/activeadmin/_trumbowyg_input.scss +3 -1
  125. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.css +776 -0
  126. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.css +3 -0
  127. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.css.map +1 -0
  128. data/lib/activeadmin/trumbowyg/version.rb +1 -1
  129. data/lib/tasks/trumbowyg.rake +2 -2
  130. metadata +18 -21
  131. data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.min.js +0 -10
  132. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.scss +0 -836
@@ -1,191 +1,270 @@
1
+ /* global AbortController: true */
1
2
  (function ($) {
2
- 'use strict';
3
-
4
- $.extend(true, $.trumbowyg, {
5
- langs: {
6
- // jshint camelcase:false
7
- en: {
8
- giphy: 'Insert GIF',
9
- },
10
- et: {
11
- giphy: 'Sisesta GIF',
12
- },
13
- fr: {
14
- giphy: 'Insérer un GIF',
15
- },
16
- hu: {
17
- giphy: 'GIF beszúrás',
18
- },
19
- tr: {
20
- giphy: 'GIF ekle',
21
- },
22
- // jshint camelcase:true
23
- }
24
- });
25
-
26
- var giphyLogo = '<svg viewBox="0 0 231 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M48.32 22.386c0-1.388-.252-1.892-1.767-1.85-3.448.126-6.855.042-10.303.042H25.443c-.927 0-1.346.211-1.305 1.22.085 2.86.085 5.72.043 8.58 0 .883.252 1.169 1.169 1.135 2.018-.084 3.995-.042 6.014 0 1.64 0 4.164-.546 4.752.252.841 1.169.421 3.364.337 5.089-.043.547-.547 1.304-1.094 1.598-2.692 1.556-5.678 2.018-8.747 1.892-5.342-.21-9.336-2.439-11.481-7.527-1.388-3.364-1.725-6.855-1.01-10.43 1.01-4.963 3.407-8.747 8.58-10.051 5.215-1.305 10.136-.547 14.467 2.817 1.219.967 1.798.715 2.691-.294 1.514-1.724 3.154-3.322 4.753-4.963 1.892-1.933 1.892-1.892-.169-3.7C38.429.813 31.238-.617 23.5.224 12.818 1.393 5.248 6.658 1.59 17.045-.177 22.008-.428 27.097.623 32.227c1.682 7.914 5.551 14.12 13.289 17.368 6.898 2.901 14.046 3.448 21.321 1.598 4.331-1.093 8.411-2.608 11.354-6.223 1.136-1.388 1.725-2.902 1.682-4.71l.043-17.873.008-.001zm125.153 3.784l.042-23.046c0-1.136-.168-1.598-1.472-1.556a238.02 238.02 0 0 1-11.017 0c-1.136-.042-1.439.337-1.439 1.439v15.645c0 1.345-.421 1.556-1.641 1.556a422.563 422.563 0 0 0-14.593 0c-1.262.042-1.472-.421-1.439-1.556l.043-15.813c0-.926-.169-1.304-1.17-1.262h-11.513c-.927 0-1.304.169-1.304 1.22v46.764c0 .967.252 1.262 1.219 1.262h11.512c1.169.042 1.262-.462 1.262-1.388l-.042-15.644c0-1.053.251-1.346 1.304-1.346h15.14c1.22 0 1.388.421 1.388 1.472l-.042 15.477c0 1.093.21 1.472 1.388 1.439 3.615-.085 7.233-.085 10.807 0 1.304.042 1.598-.337 1.598-1.598l-.042-23.047.011-.018zM106.565 1.654c-8.369-.211-16.728-.126-25.065-.211-1.346 0-1.767.337-1.767 1.724l.043 23.004v23.215c0 1.009.168 1.439 1.304 1.387a271.22 271.22 0 0 1 11.691 0c1.094 0 1.346-.336 1.346-1.345l-.042-10.64c0-1.052.294-1.345 1.345-1.345 3.322.042 6.645.085 9.967-.085 4.407-.21 8.621-1.219 12.111-4.12 5.551-4.584 7.613-12.701 5.131-20.061-2.313-6.561-8.747-11.354-16.064-11.522v-.001zm-3.028 24.013c-2.818.042-5.594-.043-8.411.042-1.169.042-1.439-.378-1.345-1.439.084-1.556 0-3.069 0-4.626v-5.131c-.043-.841.251-1.094 1.052-1.052 2.986.042 5.929-.085 8.915.042 3.616.126 5.887 2.692 5.846 6.266-.126 3.658-2.313 5.846-6.055 5.887l-.002.011zM229.699 1.569c-4.458 0-8.915-.042-13.415.043-.629 0-1.472.503-1.85 1.052a505.695 505.695 0 0 0-8.957 14.214c-.884 1.472-1.22 1.169-1.977-.084l-8.496-14.089c-.503-.841-1.052-1.136-2.018-1.136l-13.078.043c-.462 0-.967.125-1.439.21.21.378.378.799.629 1.169l17.412 27.167c.462.715.715 1.682.757 2.524v16.653c0 1.052.168 1.514 1.388 1.472 3.784-.084 7.57-.084 11.354 0 1.136.043 1.304-.377 1.304-1.387l-.042-8.58c0-2.734-.084-5.51.042-8.243.043-.926.337-1.933.841-2.649l18.167-27.041c.252-.337.337-.758.547-1.17a3.636 3.636 0 0 0-1.169-.168zM70.104 2.661c0-1.009-.294-1.219-1.262-1.219H57.69c-1.262-.043-1.472.377-1.472 1.513l.042 23.004v23.34c0 1.053.126 1.514 1.346 1.473 3.7-.085 7.444-.043 11.152 0 .966 0 1.387-.085 1.387-1.262l-.042-46.857.001.008z" fill="currentColor" fill-rule="nonzero"/></svg>'; // jshint ignore:line
27
-
28
- var CANCEL_EVENT = 'tbwcancel';
29
-
30
- // Throttle helper
31
- function trumbowygThrottle(callback, delay) {
32
- var last;
33
- var timer;
34
-
35
- return function () {
36
- var context = this;
37
- var now = +new Date();
38
- var args = arguments;
39
-
40
- if (last && now < last + delay) {
41
- clearTimeout(timer);
42
- timer = setTimeout(function () {
43
- last = now;
44
- callback.apply(context, args);
45
- }, delay);
46
- } else {
47
- last = now;
48
- callback.apply(context, args);
49
- }
50
- };
51
- }
52
-
53
- // Fills modal with response gifs
54
- function renderGifs(response, $giphyModal, trumbowyg, mustEmpty) {
55
- var width = ($giphyModal.width() - 20) / 3;
56
-
57
- var html = response.data
58
- .filter(function (gifData) {
59
- return gifData.images.downsized.url !== '';
60
- })
61
- .map(function (gifData) {
62
- var image = gifData.images.downsized,
63
- imageRatio = image.height / image.width;
64
-
65
- return '<div class="img-container"><img src=' + image.url + ' width="' + width + '" height="' + imageRatio * width + '" loading="lazy" onload="this.classList.add(\'tbw-loaded\')"/></div>';
66
- })
67
- .join('')
68
- ;
69
-
70
- if (mustEmpty === true) {
71
- if (html.length === 0) {
72
- if ($('.' + trumbowyg.o.prefix + 'giphy-no-result', $giphyModal).length > 0) {
73
- return;
3
+ 'use strict';
4
+
5
+ $.extend(true, $.trumbowyg, {
6
+ langs: {
7
+ // jshint camelcase:false
8
+ en: {
9
+ giphy: 'Insert GIF'
10
+ },
11
+ az: {
12
+ giphy: 'GIF yerləşdir'
13
+ },
14
+ by: {
15
+ giphy: 'Уставіць GIF'
16
+ },
17
+ de: {
18
+ giphy: 'GIF einfügen'
19
+ },
20
+ et: {
21
+ giphy: 'Sisesta GIF'
22
+ },
23
+ fr: {
24
+ giphy: 'Insérer un GIF'
25
+ },
26
+ hu: {
27
+ giphy: 'GIF beszúrás'
28
+ },
29
+ ru: {
30
+ giphy: 'Вставить GIF'
31
+ },
32
+ sl: {
33
+ giphy: 'Vstavi GIF'
34
+ },
35
+ tr: {
36
+ giphy: 'GIF ekle'
37
+ }
38
+ // jshint camelcase:true
74
39
  }
40
+ });
75
41
 
76
- html = '<img class="' + trumbowyg.o.prefix + 'giphy-no-result" src="' + trumbowyg.o.plugins.giphy.noResultGifUrl + '"/>';
77
- }
42
+ var giphyLogo = '<svg viewBox="0 0 231 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M48.32 22.386c0-1.388-.252-1.892-1.767-1.85-3.448.126-6.855.042-10.303.042H25.443c-.927 0-1.346.211-1.305 1.22.085 2.86.085 5.72.043 8.58 0 .883.252 1.169 1.169 1.135 2.018-.084 3.995-.042 6.014 0 1.64 0 4.164-.546 4.752.252.841 1.169.421 3.364.337 5.089-.043.547-.547 1.304-1.094 1.598-2.692 1.556-5.678 2.018-8.747 1.892-5.342-.21-9.336-2.439-11.481-7.527-1.388-3.364-1.725-6.855-1.01-10.43 1.01-4.963 3.407-8.747 8.58-10.051 5.215-1.305 10.136-.547 14.467 2.817 1.219.967 1.798.715 2.691-.294 1.514-1.724 3.154-3.322 4.753-4.963 1.892-1.933 1.892-1.892-.169-3.7C38.429.813 31.238-.617 23.5.224 12.818 1.393 5.248 6.658 1.59 17.045-.177 22.008-.428 27.097.623 32.227c1.682 7.914 5.551 14.12 13.289 17.368 6.898 2.901 14.046 3.448 21.321 1.598 4.331-1.093 8.411-2.608 11.354-6.223 1.136-1.388 1.725-2.902 1.682-4.71l.043-17.873.008-.001zm125.153 3.784l.042-23.046c0-1.136-.168-1.598-1.472-1.556a238.02 238.02 0 0 1-11.017 0c-1.136-.042-1.439.337-1.439 1.439v15.645c0 1.345-.421 1.556-1.641 1.556a422.563 422.563 0 0 0-14.593 0c-1.262.042-1.472-.421-1.439-1.556l.043-15.813c0-.926-.169-1.304-1.17-1.262h-11.513c-.927 0-1.304.169-1.304 1.22v46.764c0 .967.252 1.262 1.219 1.262h11.512c1.169.042 1.262-.462 1.262-1.388l-.042-15.644c0-1.053.251-1.346 1.304-1.346h15.14c1.22 0 1.388.421 1.388 1.472l-.042 15.477c0 1.093.21 1.472 1.388 1.439 3.615-.085 7.233-.085 10.807 0 1.304.042 1.598-.337 1.598-1.598l-.042-23.047.011-.018zM106.565 1.654c-8.369-.211-16.728-.126-25.065-.211-1.346 0-1.767.337-1.767 1.724l.043 23.004v23.215c0 1.009.168 1.439 1.304 1.387a271.22 271.22 0 0 1 11.691 0c1.094 0 1.346-.336 1.346-1.345l-.042-10.64c0-1.052.294-1.345 1.345-1.345 3.322.042 6.645.085 9.967-.085 4.407-.21 8.621-1.219 12.111-4.12 5.551-4.584 7.613-12.701 5.131-20.061-2.313-6.561-8.747-11.354-16.064-11.522v-.001zm-3.028 24.013c-2.818.042-5.594-.043-8.411.042-1.169.042-1.439-.378-1.345-1.439.084-1.556 0-3.069 0-4.626v-5.131c-.043-.841.251-1.094 1.052-1.052 2.986.042 5.929-.085 8.915.042 3.616.126 5.887 2.692 5.846 6.266-.126 3.658-2.313 5.846-6.055 5.887l-.002.011zM229.699 1.569c-4.458 0-8.915-.042-13.415.043-.629 0-1.472.503-1.85 1.052a505.695 505.695 0 0 0-8.957 14.214c-.884 1.472-1.22 1.169-1.977-.084l-8.496-14.089c-.503-.841-1.052-1.136-2.018-1.136l-13.078.043c-.462 0-.967.125-1.439.21.21.378.378.799.629 1.169l17.412 27.167c.462.715.715 1.682.757 2.524v16.653c0 1.052.168 1.514 1.388 1.472 3.784-.084 7.57-.084 11.354 0 1.136.043 1.304-.377 1.304-1.387l-.042-8.58c0-2.734-.084-5.51.042-8.243.043-.926.337-1.933.841-2.649l18.167-27.041c.252-.337.337-.758.547-1.17a3.636 3.636 0 0 0-1.169-.168zM70.104 2.661c0-1.009-.294-1.219-1.262-1.219H57.69c-1.262-.043-1.472.377-1.472 1.513l.042 23.004v23.34c0 1.053.126 1.514 1.346 1.473 3.7-.085 7.444-.043 11.152 0 .966 0 1.387-.085 1.387-1.262l-.042-46.857.001.008z" fill="currentColor" fill-rule="nonzero"/></svg>'; // jshint ignore:line
78
43
 
79
- $giphyModal.empty();
80
- }
81
- $giphyModal.append(html);
82
- $('img', $giphyModal).on('click', function () {
83
- trumbowyg.restoreRange();
84
- trumbowyg.execCmd('insertImage', $(this).attr('src'), false, true);
85
- $('img', $giphyModal).off();
86
- trumbowyg.closeModal();
87
- });
88
- }
89
-
90
- var defaultOptions = {
91
- rating: 'g',
92
- apiKey: null,
93
- throttleDelay: 300,
94
- noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif'
95
- };
96
-
97
- // Add dropdown with font sizes
98
- $.extend(true, $.trumbowyg, {
99
- plugins: {
100
- giphy: {
101
- init: function (trumbowyg) {
102
- trumbowyg.o.plugins.giphy = $.extend({},
103
- defaultOptions,
104
- trumbowyg.o.plugins.giphy || {}
105
- );
106
-
107
- trumbowyg.addBtnDef('giphy', {
108
- fn: function() {
109
- if (trumbowyg.o.plugins.giphy.apiKey === null) {
110
- throw new Error('You must set a Giphy API Key');
111
- }
112
-
113
- var BASE_URL = 'https://api.giphy.com/v1/gifs/search?api_key=' + trumbowyg.o.plugins.giphy.apiKey + '&rating=' + trumbowyg.o.plugins.giphy.rating,
114
- DEFAULT_URL = BASE_URL.replace('/search', '/trending');
115
- var previousAjaxCall = {abort: function () {}};
116
- var prefix = trumbowyg.o.prefix;
117
-
118
- // Create and open the modal
119
- var searchInput = '<input name="" class="' + prefix + 'giphy-search" placeholder="Search a GIF" autofocus="autofocus">',
120
- closeButton = '<button class="' + prefix + 'giphy-close" title="' + trumbowyg.lang.close + '"><svg><use xlink:href="' + trumbowyg.svgPath + '#' + prefix + 'close"/></svg></button>',
121
- poweredByGiphy = '<div class="' + prefix + 'powered-by-giphy"><span>Powered by</span>' + giphyLogo + '</div>',
122
- giphyModalHtml = searchInput + closeButton + poweredByGiphy + '<div class="' + prefix + 'giphy-modal-scroll"><div class="' + prefix + 'giphy-modal"></div></div>';
123
-
124
- trumbowyg
125
- .openModal(null, giphyModalHtml, false)
126
- .one(CANCEL_EVENT, function () {
127
- try {
128
- previousAjaxCall.abort();
129
- } catch (e) {}
130
-
131
- trumbowyg.closeModal();
132
- });
44
+ var CANCEL_EVENT = 'tbwcancel';
133
45
 
134
- var $giphyInput = $('.' + prefix + 'giphy-search'),
135
- $giphyClose = $('.' + prefix + 'giphy-close'),
136
- $giphyModal = $('.' + prefix + 'giphy-modal');
46
+ // Throttle helper
47
+ function trumbowygThrottle(callback, delay) {
48
+ var last;
49
+ var timer;
137
50
 
138
- var ajaxError = function () {
139
- if (!navigator.onLine && !$('.' + prefix + 'giphy-offline', $giphyModal).length) {
140
- $giphyModal.empty();
141
- $giphyModal.append('<p class="' + prefix + 'giphy-offline">You are offline</p>');
142
- }
143
- };
51
+ return function () {
52
+ var context = this;
53
+ var now = new Date().getTime();
54
+ var args = arguments;
144
55
 
145
- // Load trending gifs as default
146
- $.ajax({
147
- url: DEFAULT_URL,
148
- dataType: 'json',
56
+ if (last && now < last + delay) {
57
+ clearTimeout(timer);
58
+ timer = setTimeout(function () {
59
+ last = now;
60
+ callback.apply(context, args);
61
+ }, delay);
62
+ } else {
63
+ last = now;
64
+ callback.apply(context, args);
65
+ }
66
+ };
67
+ }
149
68
 
150
- success: function(response) {
151
- renderGifs(response, $giphyModal, trumbowyg, true);
152
- },
153
- error: ajaxError
154
- });
69
+ // Fills modal with response gifs
70
+ function renderGifs(response, $giphyModal, trumbowyg, mustEmpty) {
71
+ var width = ($giphyModal.width() - 20) / 3;
155
72
 
156
- var searchGifsOnInput = function () {
157
- var query = $giphyInput.val();
73
+ var html = response.data
74
+ .filter(function (gifData) {
75
+ var image = gifData.images[GIPHY_OPTIONS.pickerRendition];
76
+ return !!image[GIPHY_OPTIONS.pickerRenditionUrlAttribute];
77
+ })
78
+ .map(function (gifData) {
79
+ var image = gifData.images[GIPHY_OPTIONS.pickerRendition];
80
+ var selectionImage = gifData.images[GIPHY_OPTIONS.selectionRendition];
81
+ var imageRatio = image.height / image.width,
82
+ altText = gifData.title;
158
83
 
159
- if (query.length === 0) {
160
- return;
84
+ var url = image[GIPHY_OPTIONS.pickerRenditionUrlAttribute];
85
+ var selectionUrl = selectionImage[GIPHY_OPTIONS.selectionRenditionUrlAttribute];
86
+ var imgHtml = '<img src=' + url + ' width="' + width + '" height="' + imageRatio * width + '" alt="' + altText + '" data-selection-url="' + selectionUrl + '" loading="lazy" />';
87
+ return '<div class="img-container">' + imgHtml + '</div>';
88
+ })
89
+ .join('')
90
+ ;
91
+
92
+ if (mustEmpty === true) {
93
+ if (html.length === 0) {
94
+ if ($('.' + trumbowyg.o.prefix + 'giphy-no-result', $giphyModal).length > 0) {
95
+ return;
161
96
  }
162
97
 
163
- try {
164
- previousAjaxCall.abort();
165
- } catch (e) {}
98
+ html = '<img class="' + trumbowyg.o.prefix + 'giphy-no-result" src="' + trumbowyg.o.plugins.giphy.noResultGifUrl + '"/>';
99
+ }
166
100
 
167
- previousAjaxCall = $.ajax({
168
- url: BASE_URL + '&q=' + encodeURIComponent(query),
169
- dataType: 'json',
101
+ $giphyModal.empty();
102
+ }
103
+ $giphyModal.append(html);
170
104
 
171
- success: function(response) {
172
- renderGifs(response, $giphyModal, trumbowyg, true);
173
- },
174
- error: ajaxError
105
+ // Remove gray overlay on image load
106
+ // moved here from inline callback definition due to CSP issue
107
+ // Note: this is being done post-factum because load event doesn't bubble up and so can't be delegated
108
+ var addLoadedClass = function (img) {
109
+ img.classList.add('tbw-loaded');
110
+ };
111
+ $('img', $giphyModal).each(function () {
112
+ var img = this;
113
+ if (img.complete) { // images load instantly when cached and esp. when loaded in previous modal open
114
+ addLoadedClass(img);
115
+ } else {
116
+ img.addEventListener('load', function () {
117
+ addLoadedClass(this);
175
118
  });
176
- };
177
- var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.giphy.throttleDelay);
119
+ }
120
+ });
178
121
 
179
- $giphyInput.on('input', throttledInputRequest);
180
- $giphyInput.focus();
122
+ $('img', $giphyModal).on('click', function () {
123
+ var src = $(this).data('selection-url'),
124
+ alt = $(this).attr('alt');
125
+ trumbowyg.restoreRange();
126
+ trumbowyg.execCmd('insertImage', src, false, true);
181
127
 
182
- $giphyClose.one('click', function() {
183
- $giphyModal.trigger(CANCEL_EVENT);
184
- });
185
- },
186
- });
187
- }
188
- }
128
+ // relay alt tag into inserted image
129
+ if (alt) {
130
+ var $img = $('img[src="' + src + '"]:not([alt])', trumbowyg.$box);
131
+ $img.attr('alt', alt);
132
+ // Note: This seems to fire relatively early and could be wrapped in a setTimeout if needed
133
+ trumbowyg.syncCode();
134
+ }
135
+ $('img', $giphyModal).off();
136
+ trumbowyg.closeModal();
137
+ });
189
138
  }
190
- });
139
+
140
+ // see: https://developers.giphy.com/explorer/
141
+ var defaultOptions = {
142
+ rating: 'g',
143
+ apiKey: null,
144
+ throttleDelay: 300,
145
+ limit: 50,
146
+ noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif'
147
+ };
148
+
149
+ const GIPHY_OPTIONS = {
150
+ bundle: 'low_bandwidth',
151
+ pickerRendition: 'fixed_width_small', // see: https://developers.giphy.com/docs/optional-settings/#renditions-on-demand
152
+ pickerRenditionUrlAttribute: 'webp', // can be 'url' or 'mp4' or 'webp'
153
+ selectionRendition: 'original',
154
+ selectionRenditionUrlAttribute: 'url'
155
+ };
156
+
157
+ // Add dropdown with font sizes
158
+ $.extend(true, $.trumbowyg, {
159
+ plugins: {
160
+ giphy: {
161
+ init: function (trumbowyg) {
162
+ trumbowyg.o.plugins.giphy = $.extend({},
163
+ defaultOptions,
164
+ trumbowyg.o.plugins.giphy || {}
165
+ );
166
+
167
+ trumbowyg.addBtnDef('giphy', {
168
+ fn: function () {
169
+ if (trumbowyg.o.plugins.giphy.apiKey === null) {
170
+ throw new Error('You must set a Giphy API Key');
171
+ }
172
+
173
+ var BASE_URL = [
174
+ 'https://api.giphy.com/v1/gifs/search?api_key=',
175
+ trumbowyg.o.plugins.giphy.apiKey,
176
+ '&rating=',
177
+ trumbowyg.o.plugins.giphy.rating,
178
+ '&limit=',
179
+ trumbowyg.o.plugins.giphy.limit,
180
+ '&bundle=',
181
+ GIPHY_OPTIONS.bundle,
182
+ ].join('');
183
+ const DEFAULT_URL = BASE_URL.replace('/search', '/trending');
184
+ var prefix = trumbowyg.o.prefix;
185
+ var abortController = new AbortController();
186
+
187
+ // Create and open the modal
188
+ var searchInput = '<input name="" class="' + prefix + 'giphy-search" placeholder="Search a GIF" autofocus="autofocus">',
189
+ closeButton = '<button class="' + prefix + 'giphy-close" title="' + trumbowyg.lang.close + '"><svg><use xlink:href="' + trumbowyg.svgPath + '#' + prefix + 'close"/></svg></button>',
190
+ poweredByGiphy = '<div class="' + prefix + 'powered-by-giphy"><span>Powered by</span>' + giphyLogo + '</div>',
191
+ giphyModalHtml = searchInput + closeButton + poweredByGiphy + '<div class="' + prefix + 'giphy-modal-scroll"><div class="' + prefix + 'giphy-modal"></div></div>';
192
+
193
+ trumbowyg
194
+ .openModal(null, giphyModalHtml, false)
195
+ .one(CANCEL_EVENT, function () {
196
+ try {
197
+ abortController.abort();
198
+ abortController = new AbortController();
199
+ } catch (e) {
200
+ }
201
+
202
+ trumbowyg.closeModal();
203
+ });
204
+
205
+ var $giphyInput = $('.' + prefix + 'giphy-search'),
206
+ $giphyClose = $('.' + prefix + 'giphy-close'),
207
+ $giphyModal = $('.' + prefix + 'giphy-modal');
208
+
209
+ var onError = function () {
210
+ if (navigator.onLine || $('.' + prefix + 'giphy-offline', $giphyModal).length) {
211
+ return;
212
+ }
213
+
214
+ $giphyModal.empty();
215
+ $giphyModal.append('<p class="' + prefix + 'giphy-offline">You are offline</p>');
216
+ };
217
+
218
+ // Load trending gifs as default
219
+ fetch(DEFAULT_URL, {
220
+ method: 'GET',
221
+ cache: 'no-cache',
222
+ signal: abortController.signal
223
+ }).then((response) => {
224
+ response.json().then((responseJson) => {
225
+ renderGifs(responseJson, $giphyModal, trumbowyg, true);
226
+ });
227
+ }).catch(() => {
228
+ onError();
229
+ });
230
+
231
+ var searchGifsOnInput = function () {
232
+ var query = $giphyInput.val();
233
+
234
+ if (query.length === 0) {
235
+ return;
236
+ }
237
+
238
+ try {
239
+ abortController.abort();
240
+ abortController = new AbortController();
241
+ } catch (e) {
242
+ }
243
+
244
+ fetch(BASE_URL + '&q=' + encodeURIComponent(query), {
245
+ method: 'GET',
246
+ cache: 'no-cache',
247
+ signal: abortController.signal
248
+ }).then((response) => {
249
+ response.json().then((responseJson) => {
250
+ renderGifs(responseJson, $giphyModal, trumbowyg, true);
251
+ });
252
+ }).catch(() => {
253
+ onError();
254
+ });
255
+ };
256
+ var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.giphy.throttleDelay);
257
+
258
+ $giphyInput.on('input', throttledInputRequest);
259
+ $giphyInput.focus();
260
+
261
+ $giphyClose.one('click', function () {
262
+ $giphyModal.trigger(CANCEL_EVENT);
263
+ });
264
+ }
265
+ });
266
+ }
267
+ }
268
+ }
269
+ });
191
270
  })(jQuery);
@@ -1 +1 @@
1
- !function(i){"use strict";i.extend(!0,i.trumbowyg,{langs:{en:{giphy:"Insert GIF"},et:{giphy:"Sisesta GIF"},fr:{giphy:"Insérer un GIF"},hu:{giphy:"GIF beszúrás"},tr:{giphy:"GIF ekle"}}});var e="tbwcancel";function n(e,n,t,l){var o=(n.width()-20)/3,a=e.data.filter((function(i){return""!==i.images.downsized.url})).map((function(i){var e=i.images.downsized,n=e.height/e.width;return'<div class="img-container"><img src='+e.url+' width="'+o+'" height="'+n*o+'" loading="lazy" onload="this.classList.add(\'tbw-loaded\')"/></div>'})).join("");if(!0===l){if(0===a.length){if(i("."+t.o.prefix+"giphy-no-result",n).length>0)return;a='<img class="'+t.o.prefix+'giphy-no-result" src="'+t.o.plugins.giphy.noResultGifUrl+'"/>'}n.empty()}n.append(a),i("img",n).on("click",(function(){t.restoreRange(),t.execCmd("insertImage",i(this).attr("src"),!1,!0),i("img",n).off(),t.closeModal()}))}var t={rating:"g",apiKey:null,throttleDelay:300,noResultGifUrl:"https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif"};i.extend(!0,i.trumbowyg,{plugins:{giphy:{init:function(l){l.o.plugins.giphy=i.extend({},t,l.o.plugins.giphy||{}),l.addBtnDef("giphy",{fn:function(){if(null===l.o.plugins.giphy.apiKey)throw new Error("You must set a Giphy API Key");var t="https://api.giphy.com/v1/gifs/search?api_key="+l.o.plugins.giphy.apiKey+"&rating="+l.o.plugins.giphy.rating,o=t.replace("/search","/trending"),a={abort:function(){}},c=l.o.prefix,r='<input name="" class="'+c+'giphy-search" placeholder="Search a GIF" autofocus="autofocus">'+('<button class="'+c+'giphy-close" title="'+l.lang.close+'"><svg><use xlink:href="'+l.svgPath+"#"+c+'close"/></svg></button>')+('<div class="'+c+'powered-by-giphy"><span>Powered by</span><svg viewBox="0 0 231 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M48.32 22.386c0-1.388-.252-1.892-1.767-1.85-3.448.126-6.855.042-10.303.042H25.443c-.927 0-1.346.211-1.305 1.22.085 2.86.085 5.72.043 8.58 0 .883.252 1.169 1.169 1.135 2.018-.084 3.995-.042 6.014 0 1.64 0 4.164-.546 4.752.252.841 1.169.421 3.364.337 5.089-.043.547-.547 1.304-1.094 1.598-2.692 1.556-5.678 2.018-8.747 1.892-5.342-.21-9.336-2.439-11.481-7.527-1.388-3.364-1.725-6.855-1.01-10.43 1.01-4.963 3.407-8.747 8.58-10.051 5.215-1.305 10.136-.547 14.467 2.817 1.219.967 1.798.715 2.691-.294 1.514-1.724 3.154-3.322 4.753-4.963 1.892-1.933 1.892-1.892-.169-3.7C38.429.813 31.238-.617 23.5.224 12.818 1.393 5.248 6.658 1.59 17.045-.177 22.008-.428 27.097.623 32.227c1.682 7.914 5.551 14.12 13.289 17.368 6.898 2.901 14.046 3.448 21.321 1.598 4.331-1.093 8.411-2.608 11.354-6.223 1.136-1.388 1.725-2.902 1.682-4.71l.043-17.873.008-.001zm125.153 3.784l.042-23.046c0-1.136-.168-1.598-1.472-1.556a238.02 238.02 0 0 1-11.017 0c-1.136-.042-1.439.337-1.439 1.439v15.645c0 1.345-.421 1.556-1.641 1.556a422.563 422.563 0 0 0-14.593 0c-1.262.042-1.472-.421-1.439-1.556l.043-15.813c0-.926-.169-1.304-1.17-1.262h-11.513c-.927 0-1.304.169-1.304 1.22v46.764c0 .967.252 1.262 1.219 1.262h11.512c1.169.042 1.262-.462 1.262-1.388l-.042-15.644c0-1.053.251-1.346 1.304-1.346h15.14c1.22 0 1.388.421 1.388 1.472l-.042 15.477c0 1.093.21 1.472 1.388 1.439 3.615-.085 7.233-.085 10.807 0 1.304.042 1.598-.337 1.598-1.598l-.042-23.047.011-.018zM106.565 1.654c-8.369-.211-16.728-.126-25.065-.211-1.346 0-1.767.337-1.767 1.724l.043 23.004v23.215c0 1.009.168 1.439 1.304 1.387a271.22 271.22 0 0 1 11.691 0c1.094 0 1.346-.336 1.346-1.345l-.042-10.64c0-1.052.294-1.345 1.345-1.345 3.322.042 6.645.085 9.967-.085 4.407-.21 8.621-1.219 12.111-4.12 5.551-4.584 7.613-12.701 5.131-20.061-2.313-6.561-8.747-11.354-16.064-11.522v-.001zm-3.028 24.013c-2.818.042-5.594-.043-8.411.042-1.169.042-1.439-.378-1.345-1.439.084-1.556 0-3.069 0-4.626v-5.131c-.043-.841.251-1.094 1.052-1.052 2.986.042 5.929-.085 8.915.042 3.616.126 5.887 2.692 5.846 6.266-.126 3.658-2.313 5.846-6.055 5.887l-.002.011zM229.699 1.569c-4.458 0-8.915-.042-13.415.043-.629 0-1.472.503-1.85 1.052a505.695 505.695 0 0 0-8.957 14.214c-.884 1.472-1.22 1.169-1.977-.084l-8.496-14.089c-.503-.841-1.052-1.136-2.018-1.136l-13.078.043c-.462 0-.967.125-1.439.21.21.378.378.799.629 1.169l17.412 27.167c.462.715.715 1.682.757 2.524v16.653c0 1.052.168 1.514 1.388 1.472 3.784-.084 7.57-.084 11.354 0 1.136.043 1.304-.377 1.304-1.387l-.042-8.58c0-2.734-.084-5.51.042-8.243.043-.926.337-1.933.841-2.649l18.167-27.041c.252-.337.337-.758.547-1.17a3.636 3.636 0 0 0-1.169-.168zM70.104 2.661c0-1.009-.294-1.219-1.262-1.219H57.69c-1.262-.043-1.472.377-1.472 1.513l.042 23.004v23.34c0 1.053.126 1.514 1.346 1.473 3.7-.085 7.444-.043 11.152 0 .966 0 1.387-.085 1.387-1.262l-.042-46.857.001.008z" fill="currentColor" fill-rule="nonzero"/></svg></div>')+'<div class="'+c+'giphy-modal-scroll"><div class="'+c+'giphy-modal"></div></div>';l.openModal(null,r,!1).one(e,(function(){try{a.abort()}catch(i){}l.closeModal()}));var s=i("."+c+"giphy-search"),p=i("."+c+"giphy-close"),g=i("."+c+"giphy-modal"),u=function(){navigator.onLine||i("."+c+"giphy-offline",g).length||(g.empty(),g.append('<p class="'+c+'giphy-offline">You are offline</p>'))};i.ajax({url:o,dataType:"json",success:function(i){n(i,g,l,!0)},error:u});var h,d,y,f,v=(h=function(){var e=s.val();if(0!==e.length){try{a.abort()}catch(i){}a=i.ajax({url:t+"&q="+encodeURIComponent(e),dataType:"json",success:function(i){n(i,g,l,!0)},error:u})}},d=l.o.plugins.giphy.throttleDelay,function(){var i=this,e=+new Date,n=arguments;y&&e<y+d?(clearTimeout(f),f=setTimeout((function(){y=e,h.apply(i,n)}),d)):(y=e,h.apply(i,n))});s.on("input",v),s.focus(),p.one("click",(function(){g.trigger(e)}))}})}}}})}(jQuery);
1
+ !function(i){"use strict";i.extend(!0,i.trumbowyg,{langs:{en:{giphy:"Insert GIF"},az:{giphy:"GIF yerləşdir"},by:{giphy:"Уставіць GIF"},de:{giphy:"GIF einfügen"},et:{giphy:"Sisesta GIF"},fr:{giphy:"Insérer un GIF"},hu:{giphy:"GIF beszúrás"},ru:{giphy:"Вставить GIF"},sl:{giphy:"Vstavi GIF"},tr:{giphy:"GIF ekle"}}});var e="tbwcancel";function t(e,t,n,o){var c=(t.width()-20)/3,a=e.data.filter((function(i){return!!i.images[l.pickerRendition][l.pickerRenditionUrlAttribute]})).map((function(i){var e=i.images[l.pickerRendition],t=i.images[l.selectionRendition],n=e.height/e.width,o=i.title,a=e[l.pickerRenditionUrlAttribute],r=t[l.selectionRenditionUrlAttribute];return'<div class="img-container">'+("<img src="+a+' width="'+c+'" height="'+n*c+'" alt="'+o+'" data-selection-url="'+r+'" loading="lazy" />')+"</div>"})).join("");if(!0===o){if(0===a.length){if(i("."+n.o.prefix+"giphy-no-result",t).length>0)return;a='<img class="'+n.o.prefix+'giphy-no-result" src="'+n.o.plugins.giphy.noResultGifUrl+'"/>'}t.empty()}t.append(a);var r=function(i){i.classList.add("tbw-loaded")};i("img",t).each((function(){var i=this;i.complete?r(i):i.addEventListener("load",(function(){r(this)}))})),i("img",t).on("click",(function(){var e=i(this).data("selection-url"),l=i(this).attr("alt");(n.restoreRange(),n.execCmd("insertImage",e,!1,!0),l)&&(i('img[src="'+e+'"]:not([alt])',n.$box).attr("alt",l),n.syncCode());i("img",t).off(),n.closeModal()}))}var n={rating:"g",apiKey:null,throttleDelay:300,limit:50,noResultGifUrl:"https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif"};const l={bundle:"low_bandwidth",pickerRendition:"fixed_width_small",pickerRenditionUrlAttribute:"webp",selectionRendition:"original",selectionRenditionUrlAttribute:"url"};i.extend(!0,i.trumbowyg,{plugins:{giphy:{init:function(o){o.o.plugins.giphy=i.extend({},n,o.o.plugins.giphy||{}),o.addBtnDef("giphy",{fn:function(){if(null===o.o.plugins.giphy.apiKey)throw new Error("You must set a Giphy API Key");var n=["https://api.giphy.com/v1/gifs/search?api_key=",o.o.plugins.giphy.apiKey,"&rating=",o.o.plugins.giphy.rating,"&limit=",o.o.plugins.giphy.limit,"&bundle=",l.bundle].join("");const c=n.replace("/search","/trending");var a=o.o.prefix,r=new AbortController,s='<input name="" class="'+a+'giphy-search" placeholder="Search a GIF" autofocus="autofocus">'+('<button class="'+a+'giphy-close" title="'+o.lang.close+'"><svg><use xlink:href="'+o.svgPath+"#"+a+'close"/></svg></button>')+('<div class="'+a+'powered-by-giphy"><span>Powered by</span><svg viewBox="0 0 231 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M48.32 22.386c0-1.388-.252-1.892-1.767-1.85-3.448.126-6.855.042-10.303.042H25.443c-.927 0-1.346.211-1.305 1.22.085 2.86.085 5.72.043 8.58 0 .883.252 1.169 1.169 1.135 2.018-.084 3.995-.042 6.014 0 1.64 0 4.164-.546 4.752.252.841 1.169.421 3.364.337 5.089-.043.547-.547 1.304-1.094 1.598-2.692 1.556-5.678 2.018-8.747 1.892-5.342-.21-9.336-2.439-11.481-7.527-1.388-3.364-1.725-6.855-1.01-10.43 1.01-4.963 3.407-8.747 8.58-10.051 5.215-1.305 10.136-.547 14.467 2.817 1.219.967 1.798.715 2.691-.294 1.514-1.724 3.154-3.322 4.753-4.963 1.892-1.933 1.892-1.892-.169-3.7C38.429.813 31.238-.617 23.5.224 12.818 1.393 5.248 6.658 1.59 17.045-.177 22.008-.428 27.097.623 32.227c1.682 7.914 5.551 14.12 13.289 17.368 6.898 2.901 14.046 3.448 21.321 1.598 4.331-1.093 8.411-2.608 11.354-6.223 1.136-1.388 1.725-2.902 1.682-4.71l.043-17.873.008-.001zm125.153 3.784l.042-23.046c0-1.136-.168-1.598-1.472-1.556a238.02 238.02 0 0 1-11.017 0c-1.136-.042-1.439.337-1.439 1.439v15.645c0 1.345-.421 1.556-1.641 1.556a422.563 422.563 0 0 0-14.593 0c-1.262.042-1.472-.421-1.439-1.556l.043-15.813c0-.926-.169-1.304-1.17-1.262h-11.513c-.927 0-1.304.169-1.304 1.22v46.764c0 .967.252 1.262 1.219 1.262h11.512c1.169.042 1.262-.462 1.262-1.388l-.042-15.644c0-1.053.251-1.346 1.304-1.346h15.14c1.22 0 1.388.421 1.388 1.472l-.042 15.477c0 1.093.21 1.472 1.388 1.439 3.615-.085 7.233-.085 10.807 0 1.304.042 1.598-.337 1.598-1.598l-.042-23.047.011-.018zM106.565 1.654c-8.369-.211-16.728-.126-25.065-.211-1.346 0-1.767.337-1.767 1.724l.043 23.004v23.215c0 1.009.168 1.439 1.304 1.387a271.22 271.22 0 0 1 11.691 0c1.094 0 1.346-.336 1.346-1.345l-.042-10.64c0-1.052.294-1.345 1.345-1.345 3.322.042 6.645.085 9.967-.085 4.407-.21 8.621-1.219 12.111-4.12 5.551-4.584 7.613-12.701 5.131-20.061-2.313-6.561-8.747-11.354-16.064-11.522v-.001zm-3.028 24.013c-2.818.042-5.594-.043-8.411.042-1.169.042-1.439-.378-1.345-1.439.084-1.556 0-3.069 0-4.626v-5.131c-.043-.841.251-1.094 1.052-1.052 2.986.042 5.929-.085 8.915.042 3.616.126 5.887 2.692 5.846 6.266-.126 3.658-2.313 5.846-6.055 5.887l-.002.011zM229.699 1.569c-4.458 0-8.915-.042-13.415.043-.629 0-1.472.503-1.85 1.052a505.695 505.695 0 0 0-8.957 14.214c-.884 1.472-1.22 1.169-1.977-.084l-8.496-14.089c-.503-.841-1.052-1.136-2.018-1.136l-13.078.043c-.462 0-.967.125-1.439.21.21.378.378.799.629 1.169l17.412 27.167c.462.715.715 1.682.757 2.524v16.653c0 1.052.168 1.514 1.388 1.472 3.784-.084 7.57-.084 11.354 0 1.136.043 1.304-.377 1.304-1.387l-.042-8.58c0-2.734-.084-5.51.042-8.243.043-.926.337-1.933.841-2.649l18.167-27.041c.252-.337.337-.758.547-1.17a3.636 3.636 0 0 0-1.169-.168zM70.104 2.661c0-1.009-.294-1.219-1.262-1.219H57.69c-1.262-.043-1.472.377-1.472 1.513l.042 23.004v23.34c0 1.053.126 1.514 1.346 1.473 3.7-.085 7.444-.043 11.152 0 .966 0 1.387-.085 1.387-1.262l-.042-46.857.001.008z" fill="currentColor" fill-rule="nonzero"/></svg></div>')+'<div class="'+a+'giphy-modal-scroll"><div class="'+a+'giphy-modal"></div></div>';o.openModal(null,s,!1).one(e,(function(){try{r.abort(),r=new AbortController}catch(i){}o.closeModal()}));var g=i("."+a+"giphy-search"),h=i("."+a+"giphy-close"),p=i("."+a+"giphy-modal"),u=function(){navigator.onLine||i("."+a+"giphy-offline",p).length||(p.empty(),p.append('<p class="'+a+'giphy-offline">You are offline</p>'))};fetch(c,{method:"GET",cache:"no-cache",signal:r.signal}).then((i=>{i.json().then((i=>{t(i,p,o,!0)}))})).catch((()=>{u()}));var d,y,f,m,v=(d=function(){var i=g.val();if(0!==i.length){try{r.abort(),r=new AbortController}catch(i){}fetch(n+"&q="+encodeURIComponent(i),{method:"GET",cache:"no-cache",signal:r.signal}).then((i=>{i.json().then((i=>{t(i,p,o,!0)}))})).catch((()=>{u()}))}},y=o.o.plugins.giphy.throttleDelay,function(){var i=this,e=(new Date).getTime(),t=arguments;f&&e<f+y?(clearTimeout(m),m=setTimeout((function(){f=e,d.apply(i,t)}),y)):(f=e,d.apply(i,t))});g.on("input",v),g.focus(),h.one("click",(function(){p.trigger(e)}))}})}}}})}(jQuery);
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Trumbowyg v2.25.1 - A lightweight WYSIWYG editor
3
- * Default stylesheet for Trumbowyg editor plugin
2
+ * Trumbowyg v2.31.0 - A lightweight WYSIWYG editor
3
+ * Trumbowyg plugin stylesheet
4
4
  * ------------------------
5
- * @link http://alex-d.github.io/Trumbowyg
5
+ * @link https://alex-d.github.io/Trumbowyg/
6
6
  * @license MIT
7
7
  * @author Alexandre Demode (Alex-D)
8
8
  * Twitter : @AlexandreDemode
@@ -35,6 +35,7 @@
35
35
  outline: none;
36
36
  background: #ecf0f1;
37
37
  }
38
+
38
39
  &:focus {
39
40
  border-color: rgba(0, 0, 0, 0.3);
40
41
  }
@@ -57,7 +58,7 @@
57
58
  svg {
58
59
  width: 66px;
59
60
  height: 15px;
60
- vertical-align: bottom;
61
+ vertical-align: middle;
61
62
  margin-left: 6px;
62
63
  opacity: 0.45;
63
64
  }
@@ -74,18 +75,18 @@
74
75
  columns: 3;
75
76
  column-gap: 10px;
76
77
 
77
- .trumbowyg-giphy-no-result {
78
- width: 250%;
79
- margin: 13% 0 0 29%;
80
- }
81
-
82
- .trumbowyg-giphy-offline {
83
- font-size: 18px;
84
- width: 305%;
85
- height: 600px;
86
- margin-top: 95px;
87
- text-align: center;
88
- }
78
+ .trumbowyg-giphy-no-result {
79
+ width: 250%;
80
+ margin: 13% 0 0 29%;
81
+ }
82
+
83
+ .trumbowyg-giphy-offline {
84
+ font-size: 18px;
85
+ width: 305%;
86
+ height: 600px;
87
+ margin-top: 95px;
88
+ text-align: center;
89
+ }
89
90
  }
90
91
 
91
92
  .trumbowyg-giphy-modal .img-container {