glib-web 0.5.77

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 (204) hide show
  1. package/.eslintrc.js +37 -0
  2. package/LICENSE +201 -0
  3. package/README.md +33 -0
  4. package/action.js +167 -0
  5. package/actions/analytics/logEvent.js +26 -0
  6. package/actions/auth/creditCard.js +29 -0
  7. package/actions/auth/restart.js +5 -0
  8. package/actions/auth/saveCsrfToken.js +12 -0
  9. package/actions/cables/push.js +38 -0
  10. package/actions/dialogs/alert.js +15 -0
  11. package/actions/dialogs/close.js +7 -0
  12. package/actions/dialogs/notification.js +14 -0
  13. package/actions/dialogs/oauth.js +6 -0
  14. package/actions/dialogs/open.js +7 -0
  15. package/actions/dialogs/options.js +5 -0
  16. package/actions/dialogs/show.js +5 -0
  17. package/actions/forms/submit.js +15 -0
  18. package/actions/http/delete.js +7 -0
  19. package/actions/http/patch.js +7 -0
  20. package/actions/http/post.js +7 -0
  21. package/actions/http/put.js +7 -0
  22. package/actions/panels/scrollTo.js +18 -0
  23. package/actions/panels/scrollToBottom.js +11 -0
  24. package/actions/runMultiple.js +11 -0
  25. package/actions/sheets/select.js +5 -0
  26. package/actions/snackbars/alert.js +15 -0
  27. package/actions/snackbars/select.js +5 -0
  28. package/actions/timeouts/set.js +20 -0
  29. package/actions/windows/close.js +13 -0
  30. package/actions/windows/closeAll.js +16 -0
  31. package/actions/windows/closeWithReload.js +18 -0
  32. package/actions/windows/open.js +5 -0
  33. package/actions/windows/openWeb.js +5 -0
  34. package/actions/windows/refreshState.js +5 -0
  35. package/actions/windows/reload.js +24 -0
  36. package/actions/ws/push.js +35 -0
  37. package/app.vue +180 -0
  38. package/components/_button.vue +101 -0
  39. package/components/_dropdownMenu.vue +76 -0
  40. package/components/_icon.vue +50 -0
  41. package/components/_message.vue +25 -0
  42. package/components/avatar.vue +16 -0
  43. package/components/banners/alert.vue +49 -0
  44. package/components/banners/select.vue +82 -0
  45. package/components/button.vue +13 -0
  46. package/components/calendar.vue +105 -0
  47. package/components/charts/column.vue +26 -0
  48. package/components/charts/line.vue +61 -0
  49. package/components/chip.vue +24 -0
  50. package/components/component.vue +222 -0
  51. package/components/datetime.vue +54 -0
  52. package/components/fab.vue +33 -0
  53. package/components/fields/_patternText.vue +61 -0
  54. package/components/fields/_select.vue +86 -0
  55. package/components/fields/autocomplete.vue +73 -0
  56. package/components/fields/check.vue +104 -0
  57. package/components/fields/checkGroup.vue +51 -0
  58. package/components/fields/country/countries.js +251 -0
  59. package/components/fields/country/field.vue +81 -0
  60. package/components/fields/country/regions.js +12 -0
  61. package/components/fields/creditCard.vue +105 -0
  62. package/components/fields/date.vue +24 -0
  63. package/components/fields/datetime.vue +49 -0
  64. package/components/fields/dynamicGroup.vue +106 -0
  65. package/components/fields/dynamicSelect.vue +173 -0
  66. package/components/fields/file.vue +166 -0
  67. package/components/fields/googlePlace.vue +158 -0
  68. package/components/fields/hidden.vue +18 -0
  69. package/components/fields/location.vue +223 -0
  70. package/components/fields/newRichText.vue +191 -0
  71. package/components/fields/phone/countries.js +315 -0
  72. package/components/fields/phone/field.vue +348 -0
  73. package/components/fields/phone/sprite.css +1071 -0
  74. package/components/fields/radio.vue +64 -0
  75. package/components/fields/radioGroup.vue +93 -0
  76. package/components/fields/rating.vue +26 -0
  77. package/components/fields/richText.vue +172 -0
  78. package/components/fields/select.vue +17 -0
  79. package/components/fields/stripe/stripeFields.vue +93 -0
  80. package/components/fields/stripe/stripeIndividualFields.vue +207 -0
  81. package/components/fields/stripeExternalAccount.vue +135 -0
  82. package/components/fields/stripeToken.vue +59 -0
  83. package/components/fields/submit.vue +23 -0
  84. package/components/fields/text.vue +144 -0
  85. package/components/fields/textarea.vue +59 -0
  86. package/components/fields/timeZone.vue +22 -0
  87. package/components/fields/timer.vue +83 -0
  88. package/components/h1.vue +28 -0
  89. package/components/h2.vue +20 -0
  90. package/components/h3.vue +22 -0
  91. package/components/h4.vue +20 -0
  92. package/components/h5.vue +20 -0
  93. package/components/h6.vue +20 -0
  94. package/components/hr.vue +13 -0
  95. package/components/html.vue +13 -0
  96. package/components/icon.vue +25 -0
  97. package/components/image.vue +87 -0
  98. package/components/label.vue +62 -0
  99. package/components/map.vue +206 -0
  100. package/components/markdown.vue +52 -0
  101. package/components/mixins/events.js +178 -0
  102. package/components/mixins/generic.js +58 -0
  103. package/components/mixins/list/autoload.js +144 -0
  104. package/components/mixins/longClick.js +56 -0
  105. package/components/mixins/scrolling.js +35 -0
  106. package/components/mixins/styles.js +221 -0
  107. package/components/mixins/table/autoload.js +131 -0
  108. package/components/mixins/table/export.js +52 -0
  109. package/components/mixins/table/import.js +106 -0
  110. package/components/mixins/text.js +20 -0
  111. package/components/mixins/ws/actionCable.js +48 -0
  112. package/components/mixins/ws/phoenixSocket.js +117 -0
  113. package/components/p.vue +36 -0
  114. package/components/panels/carousel.vue +55 -0
  115. package/components/panels/column.vue +117 -0
  116. package/components/panels/custom.vue +52 -0
  117. package/components/panels/flow.vue +81 -0
  118. package/components/panels/form.vue +126 -0
  119. package/components/panels/horizontal.vue +73 -0
  120. package/components/panels/list.vue +241 -0
  121. package/components/panels/responsive.vue +88 -0
  122. package/components/panels/scroll.vue +68 -0
  123. package/components/panels/split.vue +52 -0
  124. package/components/panels/table.vue +234 -0
  125. package/components/panels/ul.vue +34 -0
  126. package/components/panels/vertical.vue +71 -0
  127. package/components/panels/web.vue +11 -0
  128. package/components/spacer.vue +11 -0
  129. package/components/switch.vue +42 -0
  130. package/components/tabBar.vue +44 -0
  131. package/extensions/array.js +20 -0
  132. package/extensions/string.js +21 -0
  133. package/index.js +195 -0
  134. package/keys.js +12 -0
  135. package/nav/appbar.vue +117 -0
  136. package/nav/content.vue +40 -0
  137. package/nav/dialog.vue +127 -0
  138. package/nav/drawer.vue +88 -0
  139. package/nav/drawerButton.vue +28 -0
  140. package/nav/drawerLabel.vue +21 -0
  141. package/nav/sheet.vue +57 -0
  142. package/nav/snackbar.vue +72 -0
  143. package/package.json +42 -0
  144. package/settings.json.example +21 -0
  145. package/static/plugins/alignment/alignment.js +76 -0
  146. package/static/plugins/alignment/alignment.min.js +1 -0
  147. package/static/plugins/beyondgrammar/beyondgrammar.js +46 -0
  148. package/static/plugins/beyondgrammar/beyondgrammar.min.js +1 -0
  149. package/static/plugins/blockcode/blockcode.js +110 -0
  150. package/static/plugins/blockcode/blockcode.min.js +1 -0
  151. package/static/plugins/clips/clips.js +44 -0
  152. package/static/plugins/clips/clips.min.js +1 -0
  153. package/static/plugins/counter/counter.js +60 -0
  154. package/static/plugins/counter/counter.min.js +1 -0
  155. package/static/plugins/definedlinks/definedlinks.js +64 -0
  156. package/static/plugins/definedlinks/definedlinks.min.js +1 -0
  157. package/static/plugins/handle/handle.js +173 -0
  158. package/static/plugins/handle/handle.min.js +1 -0
  159. package/static/plugins/icons/icons.js +72 -0
  160. package/static/plugins/icons/icons.min.js +1 -0
  161. package/static/plugins/imageposition/imageposition.js +85 -0
  162. package/static/plugins/imageposition/imageposition.min.js +1 -0
  163. package/static/plugins/inlineformat/inlineformat.js +85 -0
  164. package/static/plugins/inlineformat/inlineformat.min.js +1 -0
  165. package/static/plugins/removeformat/removeformat.js +28 -0
  166. package/static/plugins/removeformat/removeformat.min.js +1 -0
  167. package/static/plugins/selector/selector.js +96 -0
  168. package/static/plugins/selector/selector.min.js +1 -0
  169. package/static/plugins/specialchars/specialchars.js +63 -0
  170. package/static/plugins/specialchars/specialchars.min.js +1 -0
  171. package/static/plugins/textdirection/textdirection.js +55 -0
  172. package/static/plugins/textdirection/textdirection.min.js +1 -0
  173. package/static/plugins/textexpander/textexpander.js +46 -0
  174. package/static/plugins/textexpander/textexpander.min.js +1 -0
  175. package/static/plugins/underline/underline.js +27 -0
  176. package/static/plugins/underline/underline.min.js +1 -0
  177. package/static/redactorx.css +1344 -0
  178. package/static/redactorx.js +14254 -0
  179. package/static/redactorx.min.css +1 -0
  180. package/static/redactorx.min.js +1 -0
  181. package/static/redactorx.usm.min.js +2 -0
  182. package/styles/test.sass +3 -0
  183. package/styles/test.scss +5 -0
  184. package/templates/_menu.vue +38 -0
  185. package/templates/comment.vue +202 -0
  186. package/templates/featured.vue +32 -0
  187. package/templates/thumbnail.vue +138 -0
  188. package/templates/unsupported.vue +12 -0
  189. package/utils/app.js +14 -0
  190. package/utils/dom.js +13 -0
  191. package/utils/form.js +34 -0
  192. package/utils/format.js +14 -0
  193. package/utils/hash.js +29 -0
  194. package/utils/helper.js +44 -0
  195. package/utils/history.js +70 -0
  196. package/utils/http.js +209 -0
  197. package/utils/launch.js +135 -0
  198. package/utils/private/ws.js +22 -0
  199. package/utils/public.js +23 -0
  200. package/utils/settings.js +48 -0
  201. package/utils/storage.js +9 -0
  202. package/utils/type.js +69 -0
  203. package/utils/uploader.js +121 -0
  204. package/utils/url.js +132 -0
@@ -0,0 +1,46 @@
1
+ RedactorX.add('plugin', 'beyondgrammar', {
2
+ subscribe: {
3
+ 'editor.docmousedown': function(event) {
4
+ var e = event.get('e');
5
+ if (e && this._isPwa(e)) {
6
+ e.preventDefault();
7
+ }
8
+ },
9
+ 'editor.before.blur': function(event) {
10
+ var e = event.get('e');
11
+ if (e && this._isPwa(e)) {
12
+ event.stop();
13
+ }
14
+ },
15
+ 'editor.unparse': function(event) {
16
+ var html = event.get('html');
17
+ html = this.app.utils.wrap(html, function($w) {
18
+ $w.find('.pwa-mark').unwrap();
19
+ });
20
+
21
+ event.set('html', html);
22
+ }
23
+ },
24
+ start: function() {
25
+ this.GrammarChecker = this._getGrammarChecker();
26
+ if (!this.opts.beyondgrammar || !this.GrammarChecker) return;
27
+ this._activate();
28
+ },
29
+
30
+ // private
31
+ _isPwa: function(e) {
32
+ return (this.dom(e.target).hasClass('pwa-suggest'));
33
+ },
34
+ _activate: function() {
35
+ this.$editor = this.app.editor.getEditor();
36
+ this.$editor.attr('spellcheck', false);
37
+ var checker = new this.GrammarChecker(this.$editor.get(), this.opts.beyondgrammar.service, this.opts.beyondgrammar.grammar);
38
+ checker.init().then(function() {
39
+ //grammar checker is inited and can be activate
40
+ checker.activate();
41
+ });
42
+ },
43
+ _getGrammarChecker: function() {
44
+ return (typeof window["BeyondGrammar"] === 'undefined') ? false : window["BeyondGrammar"]["GrammarChecker"];
45
+ }
46
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","beyondgrammar",{subscribe:{"editor.docmousedown":function(t){var r=t.get("e");r&&this._isPwa(r)&&r.preventDefault()},"editor.before.blur":function(t){var r=t.get("e");r&&this._isPwa(r)&&t.stop()},"editor.unparse":function(t){var r=t.get("html");r=this.app.utils.wrap(r,function(t){t.find(".pwa-mark").unwrap()}),t.set("html",r)}},start:function(){this.GrammarChecker=this._getGrammarChecker(),this.opts.beyondgrammar&&this.GrammarChecker&&this._activate()},_isPwa:function(t){return this.dom(t.target).hasClass("pwa-suggest")},_activate:function(){this.$editor=this.app.editor.getEditor(),this.$editor.attr("spellcheck",!1);var t=new this.GrammarChecker(this.$editor.get(),this.opts.beyondgrammar.service,this.opts.beyondgrammar.grammar);t.init().then(function(){t.activate()})},_getGrammarChecker:function(){return void 0!==window.BeyondGrammar&&window.BeyondGrammar.GrammarChecker}});
@@ -0,0 +1,110 @@
1
+ RedactorX.add('plugin', 'blockcode', {
2
+ translations: {
3
+ en: {
4
+ "blockcode": {
5
+ "save": "Save",
6
+ "cancel": "Cancel",
7
+ "edit-code": "Edit Code"
8
+ }
9
+ }
10
+ },
11
+ defaults: {
12
+ icon: '<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m10.6128994 3.20970461.0942074.08318861 4 4c.3604839.36048396.3882135.92771502.0831886 1.32000622l-.0831886.09420734-4 4.00000002c-.3905243.3905243-1.02368929.3905243-1.41421358 0-.36048396-.360484-.3882135-.927715-.08318861-1.3200062l.08318861-.0942074 3.29210678-3.2928932-3.29210678-3.29289322c-.36048396-.36048396-.3882135-.92771502-.08318861-1.32000622l.08318861-.09420734c.36048396-.36048396.92771498-.3882135 1.32000618-.08318861zm-3.90579262.08318861c.36048396.36048396.3882135.92771502.08318861 1.32000622l-.08318861.09420734-3.29210678 3.29289322 3.29210678 3.2928932c.36048396.360484.3882135.927715.08318861 1.3200062l-.08318861.0942074c-.36048396.3604839-.92771502.3882135-1.32000622.0831886l-.09420734-.0831886-4-4.00000002c-.36048396-.36048396-.3882135-.92771502-.08318861-1.32000622l.08318861-.09420734 4-4c.39052429-.39052429 1.02368927-.39052429 1.41421356 0z"/></svg>',
13
+ popup: {
14
+ width: '100%',
15
+ title: '## blockcode.edit-code ##',
16
+ form: {
17
+ 'code': { type: 'textarea', rows: '8' }
18
+ },
19
+ footer: {
20
+ save: { title: '## blockcode.save ##', command: 'blockcode.save', type: 'primary' },
21
+ cancel: { title: '## blockcode.cancel ##', close: true }
22
+ }
23
+ }
24
+ },
25
+ init: function() {
26
+ this.offset = false;
27
+ },
28
+ start: function() {
29
+ this.app.control.add('blockcode', {
30
+ icon: this.opts.blockcode.icon,
31
+ command: 'blockcode.edit',
32
+ title: '## blockcode.edit-code ##',
33
+ position: {
34
+ before: 'duplicate'
35
+ }
36
+ });
37
+ },
38
+ edit: function() {
39
+ var current = this._getCurrent();
40
+ var code = current.getOuterHtml();
41
+ code = this.app.parser.unparse(code);
42
+
43
+ if (current.isEditable()) {
44
+ this.offset = this.app.offset.get(current.getBlock());
45
+ }
46
+
47
+ // create
48
+ this.app.popup.create('code', this.opts.blockcode.popup);
49
+ this.app.popup.setData({ code: code });
50
+
51
+ // open
52
+ this.app.popup.open({ focus: 'code' });
53
+
54
+ // hadnle & codemirror
55
+ this._buildInputHandle();
56
+ this._buildCodemirror();
57
+ },
58
+ save: function() {
59
+ this.app.popup.close();
60
+
61
+ var current = this._getCurrent();
62
+ var code = this._getCode();
63
+ if (code === '') {
64
+ return;
65
+ }
66
+
67
+ // create
68
+ code = this.app.parser.parse(code, false);
69
+ var $source = this.dom(code);
70
+ var instance = this.app.create('block.' + current.getType(), $source);
71
+
72
+ // change
73
+ current.change(instance);
74
+
75
+ // set editable focus
76
+ if (this.offset && instance.isEditable()) {
77
+ this.app.offset.set(instance.getBlock(), this.offset);
78
+ }
79
+
80
+ // clear offset
81
+ this.offset = false;
82
+ },
83
+
84
+ // private
85
+ _getCurrent: function() {
86
+ var current = this.app.block.get();
87
+ if (current.isSecondLevel()) {
88
+ current = current.getFirstLevel();
89
+ }
90
+
91
+ return current;
92
+ },
93
+ _getCode: function() {
94
+ var data = this.app.popup.getData();
95
+ var code = data.code.trim();
96
+ code = this.app.codemirror.val(code);
97
+
98
+ return code;
99
+ },
100
+ _buildInputHandle: function() {
101
+ var $input = this.app.popup.getInput('code');
102
+ $input.on('keydown', this.app.input.handleTextareaTab.bind(this));
103
+ },
104
+ _buildCodemirror: function() {
105
+ var $input = this.app.popup.getInput('code');
106
+
107
+ this.app.codemirror.create({ el: $input, height: '200px', focus: true });
108
+ this.app.popup.updatePosition();
109
+ }
110
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","blockcode",{translations:{en:{blockcode:{save:"Save",cancel:"Cancel","edit-code":"Edit Code"}}},defaults:{icon:'<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m10.6128994 3.20970461.0942074.08318861 4 4c.3604839.36048396.3882135.92771502.0831886 1.32000622l-.0831886.09420734-4 4.00000002c-.3905243.3905243-1.02368929.3905243-1.41421358 0-.36048396-.360484-.3882135-.927715-.08318861-1.3200062l.08318861-.0942074 3.29210678-3.2928932-3.29210678-3.29289322c-.36048396-.36048396-.3882135-.92771502-.08318861-1.32000622l.08318861-.09420734c.36048396-.36048396.92771498-.3882135 1.32000618-.08318861zm-3.90579262.08318861c.36048396.36048396.3882135.92771502.08318861 1.32000622l-.08318861.09420734-3.29210678 3.29289322 3.29210678 3.2928932c.36048396.360484.3882135.927715.08318861 1.3200062l-.08318861.0942074c-.36048396.3604839-.92771502.3882135-1.32000622.0831886l-.09420734-.0831886-4-4.00000002c-.36048396-.36048396-.3882135-.92771502-.08318861-1.32000622l.08318861-.09420734 4-4c.39052429-.39052429 1.02368927-.39052429 1.41421356 0z"/></svg>',popup:{width:"100%",title:"## blockcode.edit-code ##",form:{code:{type:"textarea",rows:"8"}},footer:{save:{title:"## blockcode.save ##",command:"blockcode.save",type:"primary"},cancel:{title:"## blockcode.cancel ##",close:!0}}}},init:function(){this.offset=!1},start:function(){this.app.control.add("blockcode",{icon:this.opts.blockcode.icon,command:"blockcode.edit",title:"## blockcode.edit-code ##",position:{before:"duplicate"}})},edit:function(){var t=this._getCurrent(),e=t.getOuterHtml();e=this.app.parser.unparse(e),t.isEditable()&&(this.offset=this.app.offset.get(t.getBlock())),this.app.popup.create("code",this.opts.blockcode.popup),this.app.popup.setData({code:e}),this.app.popup.open({focus:"code"}),this._buildInputHandle(),this._buildCodemirror()},save:function(){this.app.popup.close();var t=this._getCurrent(),e=this._getCode();if(""!==e){e=this.app.parser.parse(e,!1);var o=this.dom(e),p=this.app.create("block."+t.getType(),o);t.change(p),this.offset&&p.isEditable()&&this.app.offset.set(p.getBlock(),this.offset),this.offset=!1}},_getCurrent:function(){var t=this.app.block.get();return t.isSecondLevel()&&(t=t.getFirstLevel()),t},_getCode:function(){var t=this.app.popup.getData().code.trim();return t=this.app.codemirror.val(t)},_buildInputHandle:function(){this.app.popup.getInput("code").on("keydown",this.app.input.handleTextareaTab.bind(this))},_buildCodemirror:function(){var t=this.app.popup.getInput("code");this.app.codemirror.create({el:t,height:"200px",focus:!0}),this.app.popup.updatePosition()}});
@@ -0,0 +1,44 @@
1
+ RedactorX.add('plugin', 'clips', {
2
+ translations: {
3
+ en: {
4
+ "clips": {
5
+ "clips": "Clips"
6
+ }
7
+ }
8
+ },
9
+ defaults: {
10
+ icon: '<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m12.1666667 1c1.0193924 0 1.8333333.83777495 1.8333333 1.85714286v10.28571424c0 1.0193679-.8139409 1.8571429-1.8333333 1.8571429h-8.33333337c-1.01868744 0-1.83333333-.8379215-1.83333333-1.8571429v-10.28571424c0-1.01922137.81464589-1.85714286 1.83333333-1.85714286zm-.1666667 2h-8v10h8zm-2 7c.5522847 0 1 .4477153 1 1 0 .5128358-.3860402.9355072-.8833789.9932723l-.1166211.0067277h-4c-.55228475 0-1-.4477153-1-1 0-.5128358.38604019-.9355072.88337887-.9932723l.11662113-.0067277zm0-3c.5522847 0 1 .44771525 1 1 0 .51283584-.3860402.93550716-.8833789.99327227l-.1166211.00672773h-4c-.55228475 0-1-.44771525-1-1 0-.51283584.38604019-.93550716.88337887-.99327227l.11662113-.00672773zm0-3c.5522847 0 1 .44771525 1 1 0 .51283584-.3860402.93550716-.8833789.99327227l-.1166211.00672773h-4c-.55228475 0-1-.44771525-1-1 0-.51283584.38604019-.93550716.88337887-.99327227l.11662113-.00672773z"/></svg>',
11
+ items: false
12
+ },
13
+ start: function() {
14
+ if (!this.opts.clips.items) return;
15
+
16
+ this.app.toolbar.add('clips', {
17
+ title: '## clips.clips ##',
18
+ icon: this.opts.clips.icon,
19
+ command: 'clips.popup',
20
+ blocks: {
21
+ all: 'editable'
22
+ }
23
+ });
24
+ },
25
+ popup: function(params, button) {
26
+ var items = {};
27
+ for (var key in this.opts.clips.items) {
28
+
29
+ items[key] = {
30
+ title: this.opts.clips.items[key].title,
31
+ command: 'clips.insert'
32
+ }
33
+ }
34
+
35
+ this.app.popup.create('clips', { items: items });
36
+ this.app.popup.open({ button: button });
37
+ },
38
+ insert: function(params, item, name) {
39
+ this.app.popup.close();
40
+
41
+ var html = this.opts.clips.items[name].html;
42
+ this.app.editor.insertContent({ html: html });
43
+ }
44
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","clips",{translations:{en:{clips:{clips:"Clips"}}},defaults:{icon:'<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m12.1666667 1c1.0193924 0 1.8333333.83777495 1.8333333 1.85714286v10.28571424c0 1.0193679-.8139409 1.8571429-1.8333333 1.8571429h-8.33333337c-1.01868744 0-1.83333333-.8379215-1.83333333-1.8571429v-10.28571424c0-1.01922137.81464589-1.85714286 1.83333333-1.85714286zm-.1666667 2h-8v10h8zm-2 7c.5522847 0 1 .4477153 1 1 0 .5128358-.3860402.9355072-.8833789.9932723l-.1166211.0067277h-4c-.55228475 0-1-.4477153-1-1 0-.5128358.38604019-.9355072.88337887-.9932723l.11662113-.0067277zm0-3c.5522847 0 1 .44771525 1 1 0 .51283584-.3860402.93550716-.8833789.99327227l-.1166211.00672773h-4c-.55228475 0-1-.44771525-1-1 0-.51283584.38604019-.93550716.88337887-.99327227l.11662113-.00672773zm0-3c.5522847 0 1 .44771525 1 1 0 .51283584-.3860402.93550716-.8833789.99327227l-.1166211.00672773h-4c-.55228475 0-1-.44771525-1-1 0-.51283584.38604019-.93550716.88337887-.99327227l.11662113-.00672773z"/></svg>',items:!1},start:function(){this.opts.clips.items&&this.app.toolbar.add("clips",{title:"## clips.clips ##",icon:this.opts.clips.icon,command:"clips.popup",blocks:{all:"editable"}})},popup:function(t,i){var p={};for(var s in this.opts.clips.items)p[s]={title:this.opts.clips.items[s].title,command:"clips.insert"};this.app.popup.create("clips",{items:p}),this.app.popup.open({button:i})},insert:function(t,i,p){this.app.popup.close();var s=this.opts.clips.items[p].html;this.app.editor.insertContent({html:s})}});
@@ -0,0 +1,60 @@
1
+ RedactorX.add('plugin', 'counter', {
2
+ translations: {
3
+ en: {
4
+ "counter": {
5
+ "words": "words",
6
+ "chars": "chars"
7
+ }
8
+ }
9
+ },
10
+ start: function() {
11
+ this.$editor = this.app.editor.getEditor();
12
+ this.$editor.on('keyup.' + this.prefix + '-plugin-counter paste.' + this.prefix + '-plugin-counter', this.count.bind(this));
13
+ this.count();
14
+ },
15
+ stop: function() {
16
+ this.$editor.off('.' + this.prefix + '-plugin-counter');
17
+
18
+ this.app.statusbar.remove('words');
19
+ this.app.statusbar.remove('chars');
20
+ },
21
+ count: function()
22
+ {
23
+ var words = 0, characters = 0, spaces = 0;
24
+ var html = this.$editor.html();
25
+
26
+ html = this._clean(html)
27
+ if (html !== '') {
28
+ var arrWords = html.split(/\s+/);
29
+ var arrSpaces = html.match(/\s/g);
30
+
31
+ words = (arrWords) ? arrWords.length : 0;
32
+ spaces = (arrSpaces) ? arrSpaces.length : 0;
33
+
34
+ characters = html.length;
35
+ }
36
+
37
+ var data = { words: words, characters: characters, spaces: spaces };
38
+
39
+ // callback
40
+ this.app.broadcast('counter', data);
41
+
42
+ // statusbar
43
+ this.app.statusbar.add('words', this.lang.get('counter.words') + ': ' + data.words);
44
+ this.app.statusbar.add('chars', this.lang.get('counter.chars') + ': ' + data.characters);
45
+ },
46
+
47
+ // private
48
+ _clean: function(html) {
49
+ html = html.replace(/<\/(.*?)>/gi, ' ');
50
+ html = html.replace(/<(.*?)>/gi, '');
51
+ html = html.replace(/\t/gi, '');
52
+ html = html.replace(/\n/gi, ' ');
53
+ html = html.replace(/\r/gi, ' ');
54
+ html = html.replace(/&nbsp;/g, '1');
55
+ html = html.trim();
56
+ html = this.app.utils.removeInvisibleChars(html);
57
+
58
+ return html;
59
+ }
60
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","counter",{translations:{en:{counter:{words:"words",chars:"chars"}}},start:function(){this.$editor=this.app.editor.getEditor(),this.$editor.on("keyup."+this.prefix+"-plugin-counter paste."+this.prefix+"-plugin-counter",this.count.bind(this)),this.count()},stop:function(){this.$editor.off("."+this.prefix+"-plugin-counter"),this.app.statusbar.remove("words"),this.app.statusbar.remove("chars")},count:function(){var t=0,r=0,s=0,e=this.$editor.html();if(""!==(e=this._clean(e))){var a=e.split(/\s+/),i=e.match(/\s/g);t=a?a.length:0,s=i?i.length:0,r=e.length}var n={words:t,characters:r,spaces:s};this.app.broadcast("counter",n),this.app.statusbar.add("words",this.lang.get("counter.words")+": "+n.words),this.app.statusbar.add("chars",this.lang.get("counter.chars")+": "+n.characters)},_clean:function(t){return t=(t=(t=(t=(t=(t=(t=t.replace(/<\/(.*?)>/gi," ")).replace(/<(.*?)>/gi,"")).replace(/\t/gi,"")).replace(/\n/gi," ")).replace(/\r/gi," ")).replace(/&nbsp;/g,"1")).trim(),t=this.app.utils.removeInvisibleChars(t)}});
@@ -0,0 +1,64 @@
1
+ RedactorX.add('plugin', 'definedlinks', {
2
+ defaults: {
3
+ items: false
4
+ },
5
+ subscribe: {
6
+ 'popup.open': function() {
7
+ if (this.opts.definedlinks.items === false) return;
8
+
9
+ var name = this.app.popup.getName();
10
+ if (name === 'link') {
11
+ this._build();
12
+ }
13
+ }
14
+ },
15
+
16
+ // private
17
+ _build: function() {
18
+ var $item = this.app.popup.getFormItem('text');
19
+ var $box = this.dom('<div>').addClass(this.prefix + '-form-item');
20
+
21
+ // select
22
+ this.$select = this._create();
23
+
24
+ $box.append(this.$select);
25
+ $item.before($box);
26
+ },
27
+ _change: function(e) {
28
+ var key = this.dom(e.target).val();
29
+ var data = this.opts.definedlinks.items[key];
30
+ var $text = this.app.popup.getInput('text');
31
+ var $url = this.app.popup.getInput('url');
32
+ var name = data.name;
33
+ var url = data.url;
34
+
35
+ if (data.url === false) {
36
+ url = '';
37
+ name = '';
38
+ }
39
+
40
+ // text
41
+ if ($text.val() === '') {
42
+ $text.val(name);
43
+ }
44
+
45
+ // url
46
+ $url.val(url);
47
+ },
48
+ _create: function() {
49
+ var items = this.opts.definedlinks.items;
50
+ var $select = this.dom('<select>').addClass(this.prefix + '-form-select');
51
+ $select.on('change', this._change.bind(this));
52
+
53
+ for (var i = 0; i < items.length; i++) {
54
+ var data = items[i];
55
+ var $option = this.dom('<option>');
56
+ $option.val(i);
57
+ $option.html(data.name);
58
+
59
+ $select.append($option);
60
+ }
61
+
62
+ return $select;
63
+ }
64
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","definedlinks",{defaults:{items:!1},subscribe:{"popup.open":function(){!1!==this.opts.definedlinks.items&&"link"===this.app.popup.getName()&&this._build()}},_build:function(){var t=this.app.popup.getFormItem("text"),e=this.dom("<div>").addClass(this.prefix+"-form-item");this.$select=this._create(),e.append(this.$select),t.before(e)},_change:function(t){var e=this.dom(t.target).val(),i=this.opts.definedlinks.items[e],s=this.app.popup.getInput("text"),p=this.app.popup.getInput("url"),n=i.name,a=i.url;!1===i.url&&(n=a=""),""===s.val()&&s.val(n),p.val(a)},_create:function(){var t=this.opts.definedlinks.items,e=this.dom("<select>").addClass(this.prefix+"-form-select");e.on("change",this._change.bind(this));for(var i=0;i<t.length;i++){var s=t[i],p=this.dom("<option>");p.val(i),p.html(s.name),e.append(p)}return e}});
@@ -0,0 +1,173 @@
1
+ RedactorX.add('plugin', 'handle', {
2
+ translations: {
3
+ en: {
4
+ "print": {
5
+ "print": "Print"
6
+ }
7
+ }
8
+ },
9
+ defaults: {
10
+ url: false,
11
+ start: 1,
12
+ trigger: '@'
13
+ },
14
+ subscribe: {
15
+ 'editor.keyup': function(event) {
16
+ if (this.opts.handle.url === false) return;
17
+ this._handle(event);
18
+ }
19
+ },
20
+ start: function() {
21
+ this.handleLen = this.opts.handle.start;
22
+ },
23
+ stop: function() {
24
+ this._hide();
25
+ },
26
+
27
+ // private
28
+ _handle: function(event) {
29
+ var e = event.get('e');
30
+ var key = e.which;
31
+ var ctrl = e.ctrlKey || e.metaKey;
32
+ var arrows = [37, 38, 39, 40];
33
+ var ks = this.app.keycodes;
34
+
35
+ if (key === ks.DELETE || key === ks.ESC || key === ks.SPACE || key === ks.SHIFT || ctrl || (arrows.indexOf(key) !== -1)) {
36
+ return;
37
+ }
38
+
39
+ if (key === ks.BACKSPACE) {
40
+ this.handleLen = this.handleLen - 2;
41
+ if (this.handleLen <= this.opts.handle.start) {
42
+ this._hide();
43
+ }
44
+ }
45
+
46
+ this._emit();
47
+ },
48
+ _emit: function() {
49
+ var re = new RegExp('^' + this.opts.handle.trigger);
50
+ this.handleStr = this.app.selection.getText('before', this.handleLen + 1);
51
+
52
+ // detect
53
+ if (re.test(this.handleStr)) {
54
+ this.handleStr = this.handleStr.replace(this.opts.handle.trigger, '');
55
+ this.handleLen++;
56
+
57
+ if ((this.handleLen-1) > this.opts.handle.start) {
58
+ this._load();
59
+ }
60
+ }
61
+ },
62
+ _isShown: function() {
63
+ return (this.$panel && this.$panel.hasClass('open'));
64
+ },
65
+ _load: function() {
66
+ this.ajax.post({
67
+ url: this.opts.handle.url,
68
+ data: 'handle=' + this.handleStr,
69
+ success: this._parse.bind(this)
70
+ });
71
+ },
72
+ _parse: function(json) {
73
+ if (json === '') return;
74
+ var data = (typeof json === 'object') ? json : JSON.parse(json);
75
+
76
+ this._build(data);
77
+ },
78
+ _build: function(data) {
79
+
80
+ this.data = data;
81
+ this.$panel = this.app.$body.find('.' + this.prefix + '-panel');
82
+
83
+ if (this.$panel.length === 0) {
84
+ this.$panel = this.dom('<div>').addClass(this.prefix + '-panel');
85
+ this.app.$body.append(this.$panel);
86
+ }
87
+ else {
88
+ this.$panel.html('');
89
+ }
90
+
91
+ // events
92
+ this._stopEvents();
93
+ this._startEvents();
94
+
95
+ // data
96
+ for (var key in data) {
97
+ var $item = this.dom('<div>').addClass(this.prefix + '-panel-item');
98
+ var $trigger = this.dom('<a>').attr('href', '#');
99
+ $trigger.html(data[key].item);
100
+ $trigger.attr('data-key', key);
101
+ $trigger.on('click', this._replace.bind(this));
102
+
103
+ $item.append($trigger);
104
+ this.$panel.append($item);
105
+ }
106
+
107
+ // position
108
+ var scrollTop = this.app.$doc.scrollTop();
109
+ var pos = this.app.selection.getPosition();
110
+
111
+ this.$panel.css({
112
+ top: (pos.bottom + scrollTop) + 'px',
113
+ left: pos.left + 'px'
114
+ });
115
+ },
116
+ _replace: function(e) {
117
+ e.preventDefault();
118
+ e.stopPropagation();
119
+
120
+ var $item = this.dom(e.target);
121
+ var key = $item.attr('data-key');
122
+ var replacement = this.data[key].replacement;
123
+
124
+ this.app.marker.insert('start');
125
+ var marker = this.app.marker.find('start');
126
+ if (marker === false) return;
127
+
128
+ var $marker = this.dom(marker);
129
+ var current = marker.previousSibling;
130
+
131
+ var currentText = current.textContent;
132
+ var re = new RegExp('@' + this.handleStr + '$');
133
+
134
+ currentText = currentText.replace(re, '');
135
+ current.textContent = currentText;
136
+
137
+ $marker.before(replacement);
138
+ this.app.selection.restoreMarker();
139
+
140
+ this._hide();
141
+ },
142
+ _reset: function() {
143
+ this.handleStr = false;
144
+ this.handleLen = this.opts.handle.start;
145
+ this.$panel = false;
146
+ },
147
+ _hide: function(e) {
148
+ var hidable = false;
149
+ var key = (e && e.which);
150
+ var ks = this.app.keycodes;
151
+
152
+ if (!e) hidable = true;
153
+ else if (e.type === 'click' || key === ks.ESC || key === ks.ENTER || key === ks.SPACE) hidable = true;
154
+
155
+ if (hidable) {
156
+ if (this.$panel) this.$panel.remove();
157
+ this._reset();
158
+ this._stopEvents();
159
+ }
160
+ },
161
+ _startEvents: function() {
162
+ var name = 'click.' + this.prefix + '-plugin-handle keydown.' + this.prefix + '-plugin-handle';
163
+
164
+ this.app.$doc.on(name, this._hide.bind(this));
165
+ this.app.editor.getEditor().on(name, this._hide.bind(this));
166
+ },
167
+ _stopEvents: function() {
168
+ var name = '.' + this.prefix + '-plugin-handle';
169
+
170
+ this.app.$doc.off(name);
171
+ this.app.editor.getEditor().off(name);
172
+ }
173
+ });
@@ -0,0 +1 @@
1
+ RedactorX.add("plugin","handle",{translations:{en:{print:{print:"Print"}}},defaults:{url:!1,start:1,trigger:"@"},subscribe:{"editor.keyup":function(t){!1!==this.opts.handle.url&&this._handle(t)}},start:function(){this.handleLen=this.opts.handle.start},stop:function(){this._hide()},_handle:function(t){var e=t.get("e"),i=e.which,s=e.ctrlKey||e.metaKey,n=this.app.keycodes;i===n.DELETE||i===n.ESC||i===n.SPACE||i===n.SHIFT||s||-1!==[37,38,39,40].indexOf(i)||(i===n.BACKSPACE&&(this.handleLen=this.handleLen-2,this.handleLen<=this.opts.handle.start&&this._hide()),this._emit())},_emit:function(){var t=new RegExp("^"+this.opts.handle.trigger);this.handleStr=this.app.selection.getText("before",this.handleLen+1),t.test(this.handleStr)&&(this.handleStr=this.handleStr.replace(this.opts.handle.trigger,""),this.handleLen++,this.handleLen-1>this.opts.handle.start&&this._load())},_isShown:function(){return this.$panel&&this.$panel.hasClass("open")},_load:function(){this.ajax.post({url:this.opts.handle.url,data:"handle="+this.handleStr,success:this._parse.bind(this)})},_parse:function(t){if(""!==t){var e="object"==typeof t?t:JSON.parse(t);this._build(e)}},_build:function(t){for(var e in this.data=t,this.$panel=this.app.$body.find("."+this.prefix+"-panel"),0===this.$panel.length?(this.$panel=this.dom("<div>").addClass(this.prefix+"-panel"),this.app.$body.append(this.$panel)):this.$panel.html(""),this._stopEvents(),this._startEvents(),t){var i=this.dom("<div>").addClass(this.prefix+"-panel-item"),s=this.dom("<a>").attr("href","#");s.html(t[e].item),s.attr("data-key",e),s.on("click",this._replace.bind(this)),i.append(s),this.$panel.append(i)}var n=this.app.$doc.scrollTop(),a=this.app.selection.getPosition();this.$panel.css({top:a.bottom+n+"px",left:a.left+"px"})},_replace:function(t){t.preventDefault(),t.stopPropagation();var e=this.dom(t.target).attr("data-key"),i=this.data[e].replacement;this.app.marker.insert("start");var s=this.app.marker.find("start");if(!1!==s){var n=this.dom(s),a=s.previousSibling,h=a.textContent,p=new RegExp("@"+this.handleStr+"$");h=h.replace(p,""),a.textContent=h,n.before(i),this.app.selection.restoreMarker(),this._hide()}},_reset:function(){this.handleStr=!1,this.handleLen=this.opts.handle.start,this.$panel=!1},_hide:function(t){var e=!1,i=t&&t.which,s=this.app.keycodes;t&&"click"!==t.type&&i!==s.ESC&&i!==s.ENTER&&i!==s.SPACE||(e=!0),e&&(this.$panel&&this.$panel.remove(),this._reset(),this._stopEvents())},_startEvents:function(){var t="click."+this.prefix+"-plugin-handle keydown."+this.prefix+"-plugin-handle";this.app.$doc.on(t,this._hide.bind(this)),this.app.editor.getEditor().on(t,this._hide.bind(this))},_stopEvents:function(){var t="."+this.prefix+"-plugin-handle";this.app.$doc.off(t),this.app.editor.getEditor().off(t)}});