activeadmin_trumbowyg 0.1.6 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +1 -1
  3. data/README.md +42 -39
  4. data/Rakefile +2 -2
  5. data/app/assets/fonts/trumbowyg/icons.svg +1 -0
  6. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ar.js +67 -0
  7. data/app/assets/javascripts/activeadmin/trumbowyg/langs/bg.js +54 -0
  8. data/app/assets/javascripts/activeadmin/trumbowyg/langs/by.js +61 -0
  9. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.js +57 -0
  10. data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.js +54 -0
  11. data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.js +64 -0
  12. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.js +57 -0
  13. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
  14. data/app/assets/javascripts/activeadmin/trumbowyg/langs/el.js +59 -0
  15. data/app/assets/javascripts/activeadmin/trumbowyg/langs/es.js +63 -0
  16. data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.js +56 -0
  17. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.js +58 -0
  18. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.js +58 -0
  19. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.js +66 -0
  20. data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.js +57 -0
  21. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hr.js +54 -0
  22. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.js +58 -0
  23. data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.js +57 -0
  24. data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.js +59 -0
  25. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ja.js +63 -0
  26. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.js +63 -0
  27. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +3 -4
  28. data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.js +59 -0
  29. data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.js +49 -0
  30. data/app/assets/javascripts/activeadmin/trumbowyg/langs/my.js +54 -0
  31. data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.js +61 -0
  32. data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.min.js +1 -1
  33. data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.js +56 -0
  34. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ph.js +54 -0
  35. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.js +55 -0
  36. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.js +65 -0
  37. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.js +65 -0
  38. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.min.js +1 -1
  39. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ro.js +58 -0
  40. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.js +53 -0
  41. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.js +54 -0
  42. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.js +61 -0
  43. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.min.js +1 -1
  44. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sk.js +54 -0
  45. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +48 -0
  46. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +1 -0
  47. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.js +65 -0
  48. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.js +58 -0
  49. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.js +55 -0
  50. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +1 -1
  51. data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +55 -0
  52. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ua.js +54 -0
  53. data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.js +56 -0
  54. data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.min.js +1 -1
  55. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.js +57 -0
  56. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.js +66 -0
  57. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +22 -3
  58. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -1
  59. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +14 -2
  60. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -1
  61. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +9 -10
  62. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -1
  63. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +88 -36
  64. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -1
  65. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +30 -11
  66. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +27 -15
  67. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -2
  68. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +914 -840
  69. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -1
  70. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +1 -4
  71. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +2 -5
  72. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -2
  73. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +24 -11
  74. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -1
  75. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +121 -24
  76. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -1
  77. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.js +182 -0
  78. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -0
  79. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +111 -0
  80. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +90 -0
  81. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -0
  82. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +11 -3
  83. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -1
  84. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +1 -1
  85. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +1 -1
  86. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +1 -1
  87. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +17 -3
  88. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -1
  89. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +9 -1
  90. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
  91. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +59 -19
  92. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -1
  93. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +25 -6
  94. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -1
  95. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +10 -10
  96. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +9 -9
  97. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -2
  98. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +26 -21
  99. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -1
  100. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +1 -11
  101. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +14 -22
  102. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -2
  103. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +11 -1
  104. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
  105. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +9 -1
  106. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -1
  107. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +6 -0
  108. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
  109. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.js +20 -0
  110. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.min.js +1 -0
  111. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +252 -18
  112. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -1
  113. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +12 -0
  114. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -1
  115. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js +79 -0
  116. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +1 -0
  117. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +56 -0
  118. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css +47 -0
  119. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +2 -0
  120. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +272 -157
  121. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -1
  122. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +5 -1
  123. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +4 -1
  124. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -2
  125. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +14 -3
  126. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
  127. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +15 -4
  128. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
  129. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +234 -132
  130. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
  131. data/app/assets/javascripts/activeadmin/trumbowyg_input.js +22 -9
  132. data/app/assets/stylesheets/activeadmin/_trumbowyg_input.scss +67 -0
  133. data/app/assets/stylesheets/activeadmin/trumbowyg/{ui/sass/trumbowyg.scss → trumbowyg.scss} +22 -7
  134. data/lib/activeadmin/trumbowyg.rb +2 -0
  135. data/lib/activeadmin/trumbowyg/engine.rb +2 -0
  136. data/lib/activeadmin/trumbowyg/version.rb +3 -1
  137. data/lib/activeadmin_trumbowyg.rb +2 -1
  138. data/lib/formtastic/inputs/trumbowyg_input.rb +3 -2
  139. data/lib/tasks/trumbowyg.rake +4 -2
  140. metadata +193 -23
  141. data/.gitignore +0 -3
  142. data/Gemfile +0 -4
  143. data/activeadmin_trumbowyg.gemspec +0 -19
  144. data/app/assets/fonts/active_admin-trumbowyg.svg +0 -1
  145. data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +0 -1
  146. data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +0 -809
  147. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
  148. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
  149. data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +0 -56
  150. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +0 -1
  151. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
  152. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
  153. data/screenshot.jpg +0 -0
@@ -1 +1 @@
1
- !function(e){"use strict";function n(n){var i=[],l=["0.9","normal","1.5","2.0"];return e.each(l,function(l,r){n.addBtnDef("lineheight_"+r,{text:'<span style="line-height: '+r+';">'+n.lang.lineheights[r]+"</span>",hasIcon:!1,fn:function(){n.saveRange();var i=n.getRangeText();if(""!==i.replace(/\s/g,""))try{var l=t();e(l).css("lineHeight",r)}catch(a){}}}),i.push("lineheight_"+r)}),i}function t(){var e,n=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(n=e.getRangeAt(0).commonAncestorContainer,1!==n.nodeType&&(n=n.parentNode))):(e=document.selection)&&"Control"!==e.type&&(n=e.createRange().parentElement()),n}e.extend(!0,e.trumbowyg,{langs:{en:{lineheight:"Line height",lineheights:{.9:"Small",normal:"Regular",1.5:"Large","2.0":"Extra large"}},da:{lineheight:"Linjehøjde",lineheights:{.9:"Lille",normal:"Normal",1.5:"Stor","2.0":"Ekstra stor"}},fr:{lineheight:"Hauteur de ligne",lineheights:{.9:"Petit",normal:"Regular",1.5:"Grand","2.0":"Très grand"}},nl:{lineheight:"Regelhoogte",lineheights:{.9:"Klein",normal:"Normaal",1.5:"Groot","2.0":"Extra groot"}},tr:{lineheight:"Satır yüksekliği",lineheights:{.9:"Küçük",normal:"Normal",1.5:"Büyük","2.0":"Çok Büyük"}},zh_tw:{lineheight:"文字間距",lineheights:{.9:"小",normal:"正常",1.5:"大","2.0":"特大"}}}}),e.extend(!0,e.trumbowyg,{plugins:{lineheight:{init:function(e){e.addBtnDef("lineheight",{dropdown:n(e)})}}}})}(jQuery);
1
+ !function(e){"use strict";function n(n){var i=[];return e.each(n.o.plugins.lineheight.sizeList,function(l,a){n.addBtnDef("lineheight_"+a,{text:n.lang.lineheights[a]||a,hasIcon:!1,fn:function(){n.saveRange();var i=n.getRangeText();if(""!==i.replace(/\s/g,""))try{var l=t();e(l).css("lineHeight",a)}catch(h){}}}),i.push("lineheight_"+a)}),i}function t(){var e,n=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(n=e.getRangeAt(0).commonAncestorContainer,1!==n.nodeType&&(n=n.parentNode))):(e=document.selection)&&"Control"!==e.type&&(n=e.createRange().parentElement()),n}e.extend(!0,e.trumbowyg,{langs:{en:{lineheight:"Line height",lineheights:{.9:"Small",normal:"Regular",1.5:"Large","2.0":"Extra large"}},da:{lineheight:"Linjehøjde",lineheights:{.9:"Lille",normal:"Normal",1.5:"Stor","2.0":"Ekstra stor"}},fr:{lineheight:"Hauteur de ligne",lineheights:{.9:"Petite",normal:"Normale",1.5:"Grande","2.0":"Très grande"}},nl:{lineheight:"Regelhoogte",lineheights:{.9:"Klein",normal:"Normaal",1.5:"Groot","2.0":"Extra groot"}},tr:{lineheight:"Satır yüksekliği",lineheights:{.9:"Küçük",normal:"Normal",1.5:"Büyük","2.0":"Çok Büyük"}},zh_tw:{lineheight:"文字間距",lineheights:{.9:"小",normal:"正常",1.5:"大","2.0":"特大"}},pt_br:{lineheight:"Altura de linha",lineheights:{.9:"Pequena",normal:"Regular",1.5:"Grande","2.0":"Extra grande"}},it:{lineheight:"Altezza linea",lineheights:{.9:"Bassa",normal:"Normale",1.5:"Alta","2.0":"Molto alta"}},ko:{lineheight:"줄 간격",lineheights:{.9:"좁게",normal:"보통",1.5:"넓게","2.0":"아주 넓게"}}}});var i={sizeList:["0.9","normal","1.5","2.0"]};e.extend(!0,e.trumbowyg,{plugins:{lineheight:{init:function(t){t.o.plugins.lineheight=e.extend({},i,t.o.plugins.lineheight||{}),t.addBtnDef("lineheight",{dropdown:n(t)})}}}})}(jQuery);
@@ -1,7 +1,7 @@
1
1
  /* ===========================================================
2
2
  * trumbowyg.mathMl.js v1.0
3
3
  * MathML plugin for Trumbowyg
4
- * https://github.com/loclamor/Trumbowyg/tree/mathml-plugin/plugins/mathml
4
+ * http://alex-d.github.com/Trumbowyg
5
5
  * ===========================================================
6
6
  * Author : loclamor
7
7
  */
@@ -11,6 +11,7 @@
11
11
  'use strict';
12
12
  $.extend(true, $.trumbowyg, {
13
13
  langs: {
14
+ // jshint camelcase:false
14
15
  en: {
15
16
  mathml: 'Insert Formulas',
16
17
  formulas: 'Formulas',
@@ -36,7 +37,19 @@
36
37
  formulas: '方程式',
37
38
  inline: '內嵌'
38
39
  },
40
+ pt_br: {
41
+ mathml: 'Inserir fórmulas',
42
+ formulas: 'Fórmulas',
43
+ inline: 'Em linha'
44
+ },
45
+ ko: {
46
+ mathml: '수식 넣기',
47
+ formulas: '수식',
48
+ inline: '글 안에 넣기'
49
+ },
39
50
  },
51
+ // jshint camelcase:true
52
+
40
53
  plugins: {
41
54
  mathml: {
42
55
  init: function(trumbowyg) {
@@ -60,22 +73,28 @@
60
73
  };
61
74
 
62
75
  var mathmlCallback = function(v) {
63
- var delimitor = v.inline ? '$' : '$$';
76
+ var delimiter = v.inline ? '$' : '$$';
64
77
  if (trumbowyg.currentMathNode) {
65
- $(trumbowyg.currentMathNode).html(delimitor + ' ' + v.formulas + ' ' + delimitor).attr('formulas', v.formulas).attr('inline', (v.inline ? 'true' : 'false'));
78
+ $(trumbowyg.currentMathNode)
79
+ .html(delimiter + ' ' + v.formulas + ' ' + delimiter)
80
+ .attr('formulas', v.formulas)
81
+ .attr('inline', (v.inline ? 'true' : 'false'));
66
82
  } else {
67
- var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimitor + ' ' + v.formulas + ' ' + delimitor + '</span>';
83
+ var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimiter + ' ' + v.formulas + ' ' + delimiter + '</span>';
68
84
  var node = $(html)[0];
69
- node.onclick = function(e) {
85
+ node.onclick = function() {
70
86
  trumbowyg.currentMathNode = this;
71
87
  mathMLoptions.formulas.value = $(this).attr('formulas');
72
- if ($(this).attr('inline') === "true") {
88
+
89
+ if ($(this).attr('inline') === 'true') {
73
90
  mathMLoptions.inline.attributes.checked = true;
74
91
  } else {
75
92
  delete mathMLoptions.inline.attributes.checked;
76
93
  }
94
+
77
95
  trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
78
96
  };
97
+
79
98
  trumbowyg.range.deleteContents();
80
99
  trumbowyg.range.insertNode(node);
81
100
  }
@@ -1 +1 @@
1
- !function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},da:{mathml:"Indsæt formler",formulas:"Formler",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"},zh_tw:{mathml:"插入方程式",formulas:"方程式",inline:"內嵌"}},plugins:{mathml:{init:function(n){var l={fn:function(){n.saveRange();var l={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},t=function(a){var r=a.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+a.formulas+" "+r).attr("formulas",a.formulas).attr("inline",a.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+a.formulas+'" inline="'+(a.inline?"true":"false")+'" >'+r+" "+a.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(a){n.currentMathNode=this,l.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?l.inline.attributes.checked=!0:delete l.inline.attributes.checked,n.openModalInsert(n.lang.mathml,l,t)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};l.formulas.value=n.getRangeText(),l.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,l,t)}};n.addBtnDef("mathml",l)}}}})}(jQuery);
1
+ !function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},da:{mathml:"Indsæt formler",formulas:"Formler",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"},zh_tw:{mathml:"插入方程式",formulas:"方程式",inline:"內嵌"},pt_br:{mathml:"Inserir fórmulas",formulas:"Fórmulas",inline:"Em linha"},ko:{mathml:"수식 넣기",formulas:"수식",inline:"글 안에 넣기"}},plugins:{mathml:{init:function(n){var l={fn:function(){n.saveRange();var l={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},a=function(t){var r=t.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+t.formulas+" "+r).attr("formulas",t.formulas).attr("inline",t.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+t.formulas+'" inline="'+(t.inline?"true":"false")+'" >'+r+" "+t.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(){n.currentMathNode=this,l.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?l.inline.attributes.checked=!0:delete l.inline.attributes.checked,n.openModalInsert(n.lang.mathml,l,a)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};l.formulas.value=n.getRangeText(),l.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,l,a)}};n.addBtnDef("mathml",l)}}}})}(jQuery);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
3
  * Default stylesheet for Trumbowyg editor plugin
4
4
  * ------------------------
5
5
  * @link http://alex-d.github.io/Trumbowyg
@@ -10,7 +10,6 @@
10
10
  */
11
11
 
12
12
  .mathMlContainer {
13
-
14
13
  position: relative;
15
14
 
16
15
  &[inline="false"] {
@@ -20,17 +19,18 @@
20
19
 
21
20
  &:hover {
22
21
  pointer-events: none;
23
- &:after {
22
+
23
+ &::after {
24
24
  content: '\270E';
25
- pointer-events: auto;
26
25
  position: absolute;
27
- left: 0px;
28
- top: 0px;
29
- background-color: #ffffffd4;
26
+ top: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ left: 0;
30
+ background-color: rgba(255, 255, 255, 0.83);
31
+ box-shadow: 0 0 5px 5px rgba(255, 255, 255, 0.83);
30
32
  cursor: pointer;
31
- bottom: 0px;
32
- right: 0px;
33
- box-shadow: 0 0 5px 5px #ffffffd4;
33
+ pointer-events: auto;
34
34
  }
35
35
  }
36
36
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
3
  * Trumbowyg plugin stylesheet
4
4
  * ------------------------
5
5
  * @link http://alex-d.github.io/Trumbowyg
@@ -16,14 +16,14 @@
16
16
  width: 100%; }
17
17
  .mathMlContainer:hover {
18
18
  pointer-events: none; }
19
- .mathMlContainer:hover:after {
19
+ .mathMlContainer:hover::after {
20
20
  content: '\270E';
21
- pointer-events: auto;
22
21
  position: absolute;
23
- left: 0px;
24
- top: 0px;
25
- background-color: #ffffffd4;
22
+ top: 0;
23
+ right: 0;
24
+ bottom: 0;
25
+ left: 0;
26
+ background-color: rgba(255, 255, 255, 0.83);
27
+ box-shadow: 0 0 5px 5px rgba(255, 255, 255, 0.83);
26
28
  cursor: pointer;
27
- bottom: 0px;
28
- right: 0px;
29
- box-shadow: 0 0 5px 5px #ffffffd4; }
29
+ pointer-events: auto; }
@@ -1,2 +1,2 @@
1
- /** Trumbowyg v2.11.1 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
2
- .mathMlContainer{position:relative}.mathMlContainer[inline=false]{display:block;width:100%}.mathMlContainer:hover{pointer-events:none}.mathMlContainer:hover:after{content:'\270E';pointer-events:auto;position:absolute;left:0;top:0;background-color:#fffd4;cursor:pointer;bottom:0;right:0;box-shadow:0 0 5px 5px #fffd4}
1
+ /** Trumbowyg v2.21.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
2
+ .mathMlContainer{position:relative}.mathMlContainer[inline=false]{display:block;width:100%}.mathMlContainer:hover{pointer-events:none}.mathMlContainer:hover::after{content:'\270E';position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(255,255,255,.83);box-shadow:0 0 5px 5px rgba(255,255,255,.83);cursor:pointer;pointer-events:auto}
@@ -12,13 +12,14 @@
12
12
  'use strict';
13
13
 
14
14
  var defaultOptions = {
15
- source: '',
15
+ source: [],
16
16
  formatDropdownItem: formatDropdownItem,
17
17
  formatResult: formatResult
18
18
  };
19
19
 
20
20
  $.extend(true, $.trumbowyg, {
21
21
  langs: {
22
+ // jshint camelcase:false
22
23
  en: {
23
24
  mention: 'Mention'
24
25
  },
@@ -26,7 +27,7 @@
26
27
  mention: 'Nævn'
27
28
  },
28
29
  fr: {
29
- mention: 'Mentioner'
30
+ mention: 'Mentionner'
30
31
  },
31
32
  ru: {
32
33
  mention: 'Упомянуть'
@@ -37,6 +38,13 @@
37
38
  zh_tw: {
38
39
  mention: '標記'
39
40
  },
41
+ pt_br: {
42
+ mention: 'Menção'
43
+ },
44
+ ko: {
45
+ mention: '언급'
46
+ },
47
+ // jshint camelcase:true
40
48
  },
41
49
 
42
50
  plugins: {
@@ -57,32 +65,29 @@
57
65
  /**
58
66
  * Build dropdown list
59
67
  *
60
- * @param {Array} items Items
61
- * @param {object} trumbowyg Editor
68
+ * @param {Array} items Items
69
+ * @param {object} trumbowyg Editor
62
70
  *
63
- * @return {Array}
71
+ * @return {Array}
64
72
  */
65
73
  function buildDropdown(items, trumbowyg) {
66
74
  var dropdown = [];
67
75
 
68
- // Check if source is an array
69
- if (items.constructor === Array) {
70
- $.each(items, function (i, item) {
71
- var btn = 'mention-' + i,
72
- btnDef = {
73
- hasIcon: false,
74
- text: trumbowyg.o.plugins.mention.formatDropdownItem(item),
75
- fn: function () {
76
- trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item));
76
+ $.each(items, function (i, item) {
77
+ var btn = 'mention-' + i,
78
+ btnDef = {
79
+ hasIcon: false,
80
+ text: trumbowyg.o.plugins.mention.formatDropdownItem(item),
81
+ fn: function () {
82
+ trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item));
77
83
 
78
- return true;
79
- }
80
- };
84
+ return true;
85
+ }
86
+ };
81
87
 
82
- trumbowyg.addBtnDef(btn, btnDef);
83
- dropdown.push(btn);
84
- });
85
- }
88
+ trumbowyg.addBtnDef(btn, btnDef);
89
+ dropdown.push(btn);
90
+ });
86
91
 
87
92
  return dropdown;
88
93
  }
@@ -1 +1 @@
1
- !function(n){"use strict";function t(t,o){var e=[];return t.constructor===Array&&n.each(t,function(n,t){var i="mention-"+n,r={hasIcon:!1,text:o.o.plugins.mention.formatDropdownItem(t),fn:function(){return o.execCmd("insertHTML",o.o.plugins.mention.formatResult(t)),!0}};o.addBtnDef(i,r),e.push(i)}),e}function o(n){return n.login}function e(n){return"@"+n.login+" "}var i={source:"",formatDropdownItem:o,formatResult:e};n.extend(!0,n.trumbowyg,{langs:{en:{mention:"Mention"},da:{mention:"Nævn"},fr:{mention:"Mentioner"},ru:{mention:"Упомянуть"},tr:{mention:"Bahset"},zh_tw:{mention:"標記"}},plugins:{mention:{init:function(o){o.o.plugins.mention=n.extend(!0,{},i,o.o.plugins.mention||{});var e={dropdown:t(o.o.plugins.mention.source,o)};o.addBtnDef("mention",e)}}}})}(jQuery);
1
+ !function(n){"use strict";function t(t,o){var e=[];return n.each(t,function(n,t){var i="mention-"+n,r={hasIcon:!1,text:o.o.plugins.mention.formatDropdownItem(t),fn:function(){return o.execCmd("insertHTML",o.o.plugins.mention.formatResult(t)),!0}};o.addBtnDef(i,r),e.push(i)}),e}function o(n){return n.login}function e(n){return"@"+n.login+" "}var i={source:[],formatDropdownItem:o,formatResult:e};n.extend(!0,n.trumbowyg,{langs:{en:{mention:"Mention"},da:{mention:"Nævn"},fr:{mention:"Mentionner"},ru:{mention:"Упомянуть"},tr:{mention:"Bahset"},zh_tw:{mention:"標記"},pt_br:{mention:"Menção"},ko:{mention:"언급"}},plugins:{mention:{init:function(o){o.o.plugins.mention=n.extend(!0,{},i,o.o.plugins.mention||{});var e={dropdown:t(o.o.plugins.mention.source,o)};o.addBtnDef("mention",e)}}}})}(jQuery);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
3
  * Default stylesheet for Trumbowyg editor plugin
4
4
  * ------------------------
5
5
  * @link http://alex-d.github.io/Trumbowyg
@@ -10,16 +10,6 @@
10
10
  */
11
11
 
12
12
  .trumbowyg-dropdown-mention {
13
- height: calc(75%);
14
- width: 300px;
15
- max-width: 300px;
16
- overflow-y: scroll;
17
- overflow-x: hidden;
18
-
19
- svg {
20
- display: none !important;
21
- }
22
-
23
13
  button {
24
14
  position: relative;
25
15
  white-space: nowrap;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
3
  * Trumbowyg plugin stylesheet
4
4
  * ------------------------
5
5
  * @link http://alex-d.github.io/Trumbowyg
@@ -9,24 +9,16 @@
9
9
  * Website : alex-d.fr
10
10
  */
11
11
 
12
- .trumbowyg-dropdown-mention {
13
- height: calc(75%);
14
- width: 300px;
15
- max-width: 300px;
16
- overflow-y: scroll;
17
- overflow-x: hidden; }
18
- .trumbowyg-dropdown-mention svg {
19
- display: none !important; }
20
- .trumbowyg-dropdown-mention button {
21
- position: relative;
22
- white-space: nowrap; }
23
- .trumbowyg-dropdown-mention button:after {
24
- content: "";
25
- position: absolute;
26
- top: 0;
27
- right: 0;
28
- width: 15%;
29
- height: 100%;
30
- background-size: 100%;
31
- background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%);
32
- pointer-events: none; }
12
+ .trumbowyg-dropdown-mention button {
13
+ position: relative;
14
+ white-space: nowrap; }
15
+ .trumbowyg-dropdown-mention button:after {
16
+ content: "";
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ width: 15%;
21
+ height: 100%;
22
+ background-size: 100%;
23
+ background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%);
24
+ pointer-events: none; }
@@ -1,2 +1,2 @@
1
- /** Trumbowyg v2.11.1 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
2
- .trumbowyg-dropdown-mention{height:calc(75%);width:300px;max-width:300px;overflow-y:scroll;overflow-x:hidden}.trumbowyg-dropdown-mention svg{display:none!important}.trumbowyg-dropdown-mention button{position:relative;white-space:nowrap}.trumbowyg-dropdown-mention button:after{content:"";position:absolute;top:0;right:0;width:15%;height:100%;background-size:100%;background-image:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);pointer-events:none}
1
+ /** Trumbowyg v2.21.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
2
+ .trumbowyg-dropdown-mention button{position:relative;white-space:nowrap}.trumbowyg-dropdown-mention button:after{content:"";position:absolute;top:0;right:0;width:15%;height:100%;background-size:100%;background-image:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);pointer-events:none}
@@ -19,6 +19,7 @@
19
19
 
20
20
  $.extend(true, $.trumbowyg, {
21
21
  langs: {
22
+ // jshint camelcase:false
22
23
  en: {
23
24
  noembed: 'Noembed',
24
25
  noembedError: 'Error'
@@ -48,6 +49,15 @@
48
49
  noembed: '插入影片',
49
50
  noembedError: '錯誤'
50
51
  },
52
+ pt_br: {
53
+ noembed: 'Incorporar',
54
+ noembedError: 'Erro'
55
+ },
56
+ ko: {
57
+ noembed: 'oEmbed 넣기',
58
+ noembedError: '에러'
59
+ },
60
+ // jshint camelcase:true
51
61
  },
52
62
 
53
63
  plugins: {
@@ -108,4 +118,4 @@
108
118
  }
109
119
  }
110
120
  });
111
- })(jQuery);
121
+ })(jQuery);
@@ -1 +1 @@
1
- !function(e){"use strict";var r={proxy:"https://noembed.com/embed?nowrap=on",urlFiled:"url",data:[],success:void 0,error:void 0};e.extend(!0,e.trumbowyg,{langs:{en:{noembed:"Noembed",noembedError:"Error"},da:{noembedError:"Fejl"},sk:{noembedError:"Chyba"},fr:{noembedError:"Erreur"},cs:{noembedError:"Chyba"},ru:{noembedError:"Ошибка"},ja:{noembedError:"エラー"},tr:{noembedError:"Hata"},zh_tw:{noembed:"插入影片",noembedError:"錯誤"}},plugins:{noembed:{init:function(o){o.o.plugins.noembed=e.extend(!0,{},r,o.o.plugins.noembed||{});var n={fn:function(){var r=o.openModalInsert(o.lang.noembed,{url:{label:"URL",required:!0}},function(n){e.ajax({url:o.o.plugins.noembed.proxy,type:"GET",data:n,cache:!1,dataType:"json",success:o.o.plugins.noembed.success||function(n){n.html?(o.execCmd("insertHTML",n.html),setTimeout(function(){o.closeModal()},250)):o.addErrorOnModalField(e("input[type=text]",r),n.error)},error:o.o.plugins.noembed.error||function(){o.addErrorOnModalField(e("input[type=text]",r),o.lang.noembedError)}})})}};o.addBtnDef("noembed",n)}}}})}(jQuery);
1
+ !function(e){"use strict";var r={proxy:"https://noembed.com/embed?nowrap=on",urlFiled:"url",data:[],success:void 0,error:void 0};e.extend(!0,e.trumbowyg,{langs:{en:{noembed:"Noembed",noembedError:"Error"},da:{noembedError:"Fejl"},sk:{noembedError:"Chyba"},fr:{noembedError:"Erreur"},cs:{noembedError:"Chyba"},ru:{noembedError:"Ошибка"},ja:{noembedError:"エラー"},tr:{noembedError:"Hata"},zh_tw:{noembed:"插入影片",noembedError:"錯誤"},pt_br:{noembed:"Incorporar",noembedError:"Erro"},ko:{noembed:"oEmbed 넣기",noembedError:"에러"}},plugins:{noembed:{init:function(o){o.o.plugins.noembed=e.extend(!0,{},r,o.o.plugins.noembed||{});var n={fn:function(){var r=o.openModalInsert(o.lang.noembed,{url:{label:"URL",required:!0}},function(n){e.ajax({url:o.o.plugins.noembed.proxy,type:"GET",data:n,cache:!1,dataType:"json",success:o.o.plugins.noembed.success||function(n){n.html?(o.execCmd("insertHTML",n.html),setTimeout(function(){o.closeModal()},250)):o.addErrorOnModalField(e("input[type=text]",r),n.error)},error:o.o.plugins.noembed.error||function(){o.addErrorOnModalField(e("input[type=text]",r),o.lang.noembedError)}})})}};o.addBtnDef("noembed",n)}}}})}(jQuery);
@@ -18,6 +18,7 @@
18
18
  trumbowyg.pasteHandlers.push(function (pasteEvent) {
19
19
  try {
20
20
  var items = (pasteEvent.originalEvent || pasteEvent).clipboardData.items,
21
+ mustPreventDefault = false,
21
22
  reader;
22
23
 
23
24
  for (var i = items.length - 1; i >= 0; i -= 1) {
@@ -25,12 +26,19 @@
25
26
  reader = new FileReader();
26
27
  /* jshint -W083 */
27
28
  reader.onloadend = function (event) {
28
- trumbowyg.execCmd('insertImage', event.target.result, undefined, true);
29
+ trumbowyg.execCmd('insertImage', event.target.result, false, true);
29
30
  };
30
31
  /* jshint +W083 */
31
32
  reader.readAsDataURL(items[i].getAsFile());
33
+
34
+ mustPreventDefault = true;
32
35
  }
33
36
  }
37
+
38
+ if (mustPreventDefault) {
39
+ pasteEvent.stopPropagation();
40
+ pasteEvent.preventDefault();
41
+ }
34
42
  } catch (c) {
35
43
  }
36
44
  });
@@ -1 +1 @@
1
- !function(e){"use strict";e.extend(!0,e.trumbowyg,{plugins:{pasteImage:{init:function(e){e.pasteHandlers.push(function(t){try{for(var a,n=(t.originalEvent||t).clipboardData.items,i=n.length-1;i>=0;i-=1)n[i].type.match(/^image\//)&&(a=new FileReader,a.onloadend=function(t){e.execCmd("insertImage",t.target.result,void 0,!0)},a.readAsDataURL(n[i].getAsFile()))}catch(r){}})}}}})}(jQuery);
1
+ !function(e){"use strict";e.extend(!0,e.trumbowyg,{plugins:{pasteImage:{init:function(e){e.pasteHandlers.push(function(t){try{for(var a,n=(t.originalEvent||t).clipboardData.items,i=!1,r=n.length-1;r>=0;r-=1)n[r].type.match(/^image\//)&&(a=new FileReader,a.onloadend=function(t){e.execCmd("insertImage",t.target.result,!1,!0)},a.readAsDataURL(n[r].getAsFile()),i=!0);i&&(t.stopPropagation(),t.preventDefault())}catch(o){}})}}}})}(jQuery);
@@ -40,6 +40,12 @@
40
40
  zh_tw: {
41
41
  preformatted: '代碼範例 <pre>'
42
42
  },
43
+ pt_br: {
44
+ preformatted: 'Exemple de código <pre>'
45
+ },
46
+ ko: {
47
+ preformatted: '코드 예제 <pre>'
48
+ },
43
49
  },
44
50
  // jshint camelcase:true
45
51
 
@@ -1 +1 @@
1
- !function(e){"use strict";function t(){var e,t=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(t=e.getRangeAt(0).commonAncestorContainer,1!==t.nodeType&&(t=t.parentNode))):(e=document.selection)&&"Control"!==e.type&&(t=e.createRange().parentElement()),t}function n(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""}function r(){var t=null;if(document.selection)t=document.selection.createRange().parentElement();else{var n=window.getSelection();n.rangeCount>0&&(t=n.getRangeAt(0).startContainer.parentNode)}var r=e(t).contents().closest("pre").length,o=e(t).contents().closest("code").length;r&&o?e(t).contents().unwrap("code").unwrap("pre"):r?e(t).contents().unwrap("pre"):o&&e(t).contents().unwrap("code")}e.extend(!0,e.trumbowyg,{langs:{en:{preformatted:"Code sample <pre>"},da:{preformatted:"Præformateret <pre>"},fr:{preformatted:"Exemple de code <pre>"},it:{preformatted:"Codice <pre>"},zh_cn:{preformatted:"代码示例 <pre>"},ru:{preformatted:"Пример кода <pre>"},ja:{preformatted:"コードサンプル <pre>"},tr:{preformatted:"Kod örneği <pre>"},zh_tw:{preformatted:"代碼範例 <pre>"}},plugins:{preformatted:{init:function(e){var o={fn:function(){e.saveRange();var o=e.getRangeText();if(""!==o.replace(/\s/g,""))try{var a=t().tagName.toLowerCase();if("code"===a||"pre"===a)return r();e.execCmd("insertHTML","<pre><code>"+n(o)+"</code></pre>")}catch(c){}},tag:"pre"};e.addBtnDef("preformatted",o)}}}})}(jQuery);
1
+ !function(e){"use strict";function t(){var e,t=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(t=e.getRangeAt(0).commonAncestorContainer,1!==t.nodeType&&(t=t.parentNode))):(e=document.selection)&&"Control"!==e.type&&(t=e.createRange().parentElement()),t}function r(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""}function n(){var t=null;if(document.selection)t=document.selection.createRange().parentElement();else{var r=window.getSelection();r.rangeCount>0&&(t=r.getRangeAt(0).startContainer.parentNode)}var n=e(t).contents().closest("pre").length,o=e(t).contents().closest("code").length;n&&o?e(t).contents().unwrap("code").unwrap("pre"):n?e(t).contents().unwrap("pre"):o&&e(t).contents().unwrap("code")}e.extend(!0,e.trumbowyg,{langs:{en:{preformatted:"Code sample <pre>"},da:{preformatted:"Præformateret <pre>"},fr:{preformatted:"Exemple de code <pre>"},it:{preformatted:"Codice <pre>"},zh_cn:{preformatted:"代码示例 <pre>"},ru:{preformatted:"Пример кода <pre>"},ja:{preformatted:"コードサンプル <pre>"},tr:{preformatted:"Kod örneği <pre>"},zh_tw:{preformatted:"代碼範例 <pre>"},pt_br:{preformatted:"Exemple de código <pre>"},ko:{preformatted:"코드 예제 <pre>"}},plugins:{preformatted:{init:function(e){var o={fn:function(){e.saveRange();var o=e.getRangeText();if(""!==o.replace(/\s/g,""))try{var a=t().tagName.toLowerCase();if("code"===a||"pre"===a)return n();e.execCmd("insertHTML","<pre><code>"+r(o)+"</code></pre>")}catch(p){}},tag:"pre"};e.addBtnDef("preformatted",o)}}}})}(jQuery);
@@ -0,0 +1,20 @@
1
+ (function (factory, define, require, module) {
2
+ 'use strict';
3
+
4
+ if (typeof define === 'function' && define.amd) {
5
+ // AMD
6
+ define(['jquery'], factory);
7
+ } else if (typeof module === 'object' && typeof module.exports === 'object') {
8
+ // CommonJS
9
+ module.exports = factory(require('jquery'));
10
+ } else {
11
+ // Global jQuery
12
+ factory(jQuery);
13
+ }
14
+ }(function ($) {
15
+ 'use strict';
16
+
17
+ // rename to avoid conflict with jquery-resizable
18
+ $.fn.uiresizable = $.fn.resizable;
19
+ delete $.fn.resizable;
20
+ }));
@@ -0,0 +1 @@
1
+ !function(e,t,o,r){"use strict";"function"==typeof t&&t.amd?t(["jquery"],e):"object"==typeof r&&"object"==typeof r.exports?r.exports=e(o("jquery")):e(jQuery)}(function(e){"use strict";e.fn.uiresizable=e.fn.resizable,delete e.fn.resizable});
@@ -1,4 +1,4 @@
1
- (function ($) {
1
+ ;(function ($) {
2
2
  'use strict';
3
3
 
4
4
  var defaultOptions = {
@@ -6,10 +6,206 @@
6
6
  step: 4
7
7
  };
8
8
 
9
- var preventDefault = function (ev) {
10
- return ev.preventDefault();
9
+ function preventDefault(e) {
10
+ e.stopPropagation();
11
+ e.preventDefault();
12
+ }
13
+
14
+ var ResizeWithCanvas = function () {
15
+ // variable to create canvas and save img in resize mode
16
+ this.resizeCanvas = document.createElement('canvas');
17
+ // to allow canvas to get focus
18
+ this.resizeCanvas.setAttribute('tabindex', '0');
19
+ this.resizeCanvas.id = 'trumbowyg-resizimg-' + (+new Date());
20
+ this.ctx = null;
21
+ this.resizeImg = null;
22
+
23
+ this.pressEscape = function (obj) {
24
+ obj.reset();
25
+ };
26
+ this.pressBackspaceOrDelete = function (obj) {
27
+ $(obj.resizeCanvas).replaceWith('');
28
+ obj.resizeImg = null;
29
+ };
30
+
31
+ // PRIVATE FUNCTION
32
+ var focusedNow = false;
33
+ var isCursorSeResize = false;
34
+
35
+ // calculate offset to change mouse over square in the canvas
36
+ var offsetX, offsetY;
37
+ var reOffset = function (canvas) {
38
+ var BB = canvas.getBoundingClientRect();
39
+ offsetX = BB.left;
40
+ offsetY = BB.top;
41
+ };
42
+
43
+ var drawRect = function (shapeData, ctx) {
44
+ // Inner
45
+ ctx.beginPath();
46
+ ctx.fillStyle = 'rgb(255, 255, 255)';
47
+ ctx.rect(shapeData.points.x, shapeData.points.y, shapeData.points.width, shapeData.points.height);
48
+ ctx.fill();
49
+ ctx.stroke();
50
+ };
51
+
52
+ var updateCanvas = function (canvas, ctx, img, canvasWidth, canvasHeight) {
53
+ ctx.translate(0.5, 0.5);
54
+ ctx.lineWidth = 1;
55
+
56
+ // image
57
+ ctx.drawImage(img, 5, 5, canvasWidth - 10, canvasHeight - 10);
58
+
59
+ // border
60
+ ctx.beginPath();
61
+ ctx.rect(5, 5, canvasWidth - 10, canvasHeight - 10);
62
+ ctx.stroke();
63
+
64
+ // square in the angle
65
+ ctx.beginPath();
66
+ ctx.fillStyle = 'rgb(255, 255, 255)';
67
+ ctx.rect(canvasWidth - 10, canvasHeight - 10, 9, 9);
68
+ ctx.fill();
69
+ ctx.stroke();
70
+
71
+ // get the offset to change the mouse cursor
72
+ reOffset(canvas);
73
+
74
+ return ctx;
75
+ };
76
+
77
+ // PUBLIC FUNCTION
78
+ // necessary to correctly print cursor over square. Called once for instance. Useless with trumbowyg.
79
+ this.init = function () {
80
+ var _this = this;
81
+ $(window).on('scroll resize', function () {
82
+ _this.reCalcOffset();
83
+ });
84
+ };
85
+
86
+ this.reCalcOffset = function () {
87
+ reOffset(this.resizeCanvas);
88
+ };
89
+
90
+ this.canvasId = function () {
91
+ return this.resizeCanvas.id;
92
+ };
93
+
94
+ this.isActive = function () {
95
+ return this.resizeImg !== null;
96
+ };
97
+
98
+ this.isFocusedNow = function () {
99
+ return focusedNow;
100
+ };
101
+
102
+ this.blurNow = function () {
103
+ focusedNow = false;
104
+ };
105
+
106
+ // restore image in the HTML of the editor
107
+ this.reset = function () {
108
+ if (this.resizeImg === null) {
109
+ return;
110
+ }
111
+
112
+ this.resizeImg.width = this.resizeCanvas.clientWidth - 10;
113
+ this.resizeImg.height = this.resizeCanvas.clientHeight - 10;
114
+ // clear style of image to avoid issue on resize because this attribute have priority over width and height attribute
115
+ this.resizeImg.removeAttribute('style');
116
+
117
+ $(this.resizeCanvas).replaceWith($(this.resizeImg));
118
+
119
+ // reset canvas style
120
+ this.resizeCanvas.removeAttribute('style');
121
+ this.resizeImg = null;
122
+ };
123
+
124
+ // setup canvas with points and border to allow the resizing operation
125
+ this.setup = function (img, resizableOptions) {
126
+ this.resizeImg = img;
127
+
128
+ if (!this.resizeCanvas.getContext) {
129
+ return false;
130
+ }
131
+
132
+ focusedNow = true;
133
+
134
+ // draw canvas
135
+ this.resizeCanvas.width = $(this.resizeImg).width() + 10;
136
+ this.resizeCanvas.height = $(this.resizeImg).height() + 10;
137
+ this.resizeCanvas.style.margin = '-5px';
138
+ this.ctx = this.resizeCanvas.getContext('2d');
139
+
140
+ // replace image with canvas
141
+ $(this.resizeImg).replaceWith($(this.resizeCanvas));
142
+
143
+ updateCanvas(this.resizeCanvas, this.ctx, this.resizeImg, this.resizeCanvas.width, this.resizeCanvas.height);
144
+
145
+ // enable resize
146
+ $(this.resizeCanvas).resizable(resizableOptions)
147
+ .on('mousedown', preventDefault);
148
+
149
+ var _this = this;
150
+ $(this.resizeCanvas)
151
+ .on('mousemove', function (e) {
152
+ var mouseX = Math.round(e.clientX - offsetX);
153
+ var mouseY = Math.round(e.clientY - offsetY);
154
+
155
+ var wasCursorSeResize = isCursorSeResize;
156
+
157
+ _this.ctx.rect(_this.resizeCanvas.width - 10, _this.resizeCanvas.height - 10, 9, 9);
158
+ isCursorSeResize = _this.ctx.isPointInPath(mouseX, mouseY);
159
+ if (wasCursorSeResize !== isCursorSeResize) {
160
+ this.style.cursor = isCursorSeResize ? 'se-resize' : 'default';
161
+ }
162
+ })
163
+ .on('keydown', function (e) {
164
+ if (!_this.isActive()) {
165
+ return;
166
+ }
167
+
168
+ var x = e.keyCode;
169
+ if (x === 27) { // ESC
170
+ _this.pressEscape(_this);
171
+ } else if (x === 8 || x === 46) { // BACKSPACE or DELETE
172
+ _this.pressBackspaceOrDelete(_this);
173
+ }
174
+ })
175
+ .on('focus', preventDefault);
176
+
177
+ this.resizeCanvas.focus();
178
+
179
+ return true;
180
+ };
181
+
182
+ // update the canvas after the resizing
183
+ this.refresh = function () {
184
+ if (!this.resizeCanvas.getContext) {
185
+ return;
186
+ }
187
+
188
+ this.resizeCanvas.width = this.resizeCanvas.clientWidth;
189
+ this.resizeCanvas.height = this.resizeCanvas.clientHeight;
190
+ updateCanvas(this.resizeCanvas, this.ctx, this.resizeImg, this.resizeCanvas.width, this.resizeCanvas.height);
191
+ };
11
192
  };
12
193
 
194
+ // object to interact with canvas
195
+ var resizeWithCanvas = new ResizeWithCanvas();
196
+
197
+ function destroyResizable(trumbowyg) {
198
+ // clean html code
199
+ trumbowyg.$ed.find('canvas.resizable')
200
+ .resizable('destroy')
201
+ .off('mousedown', preventDefault)
202
+ .removeClass('resizable');
203
+
204
+ resizeWithCanvas.reset();
205
+
206
+ trumbowyg.syncCode();
207
+ }
208
+
13
209
  $.extend(true, $.trumbowyg, {
14
210
  plugins: {
15
211
  resizimg: {
@@ -38,30 +234,68 @@
38
234
  return false;
39
235
  },
40
236
  onDragEnd: function () {
41
- trumbowyg.$c.trigger('tbwchange');
237
+ // resize update canvas information
238
+ resizeWithCanvas.refresh();
239
+ trumbowyg.syncCode();
42
240
  }
43
241
  }
44
242
  }
45
243
  );
46
244
 
47
245
  function initResizable() {
48
- trumbowyg.$ed.find('img:not(.resizable)')
49
- .resizable(trumbowyg.o.plugins.resizimg.resizable)
50
- .on('mousedown', preventDefault);
51
- }
246
+ trumbowyg.$ed.find('img')
247
+ .off('click')
248
+ .on('click', function (e) {
249
+ // if I'm already do a resize, reset it
250
+ if (resizeWithCanvas.isActive()) {
251
+ resizeWithCanvas.reset();
252
+ }
253
+ // initialize resize of image
254
+ resizeWithCanvas.setup(this, trumbowyg.o.plugins.resizimg.resizable);
52
255
 
53
- function destroyResizable() {
54
- trumbowyg.$ed.find('img.resizable')
55
- .resizable('destroy')
56
- .off('mousedown', preventDefault);
57
- trumbowyg.syncTextarea();
256
+ preventDefault(e);
257
+ });
58
258
  }
59
259
 
60
- trumbowyg.$c.on('tbwinit', initResizable);
61
- trumbowyg.$c.on('tbwfocus', initResizable);
62
- trumbowyg.$c.on('tbwchange', initResizable);
63
- trumbowyg.$c.on('tbwblur', destroyResizable);
64
- trumbowyg.$c.on('tbwclose', destroyResizable);
260
+ trumbowyg.$c.on('tbwinit', function () {
261
+ initResizable();
262
+
263
+ // disable resize when click on other items
264
+ trumbowyg.$ed.on('click', function (e) {
265
+ // check if I've clicked out of canvas or image to reset it
266
+ if ($(e.target).is('img') || e.target.id === resizeWithCanvas.canvasId()) {
267
+ return;
268
+ }
269
+
270
+ preventDefault(e);
271
+ resizeWithCanvas.reset();
272
+
273
+ // save changes
274
+ trumbowyg.$c.trigger('tbwchange');
275
+ });
276
+
277
+ trumbowyg.$ed.on('scroll', function () {
278
+ resizeWithCanvas.reCalcOffset();
279
+ });
280
+ });
281
+
282
+ trumbowyg.$c.on('tbwfocus tbwchange', initResizable);
283
+ trumbowyg.$c.on('tbwresize', function () {
284
+ resizeWithCanvas.reCalcOffset();
285
+ });
286
+
287
+ // Destroy
288
+ trumbowyg.$c.on('tbwblur', function () {
289
+ // if I have already focused the canvas avoid destroy
290
+ if (resizeWithCanvas.isFocusedNow()) {
291
+ resizeWithCanvas.blurNow();
292
+ } else {
293
+ destroyResizable(trumbowyg);
294
+ }
295
+ });
296
+ },
297
+ destroy: function (trumbowyg) {
298
+ destroyResizable(trumbowyg);
65
299
  }
66
300
  }
67
301
  }