@standardnotes/bold-editor 1.6.3

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 (57) hide show
  1. package/.babelrc +11 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc +29 -0
  4. package/CHANGELOG.md +82 -0
  5. package/LICENSE +661 -0
  6. package/README.md +98 -0
  7. package/app/App.js +18 -0
  8. package/app/components/Editor.js +415 -0
  9. package/app/main.js +8 -0
  10. package/app/stylesheets/main.scss +272 -0
  11. package/dist/dist.css +1 -0
  12. package/dist/dist.min.js +2 -0
  13. package/dist/dist.min.js.LICENSE.txt +42 -0
  14. package/dist/filesafe-js/EncryptionWorker.js +2 -0
  15. package/dist/filesafe-js/EncryptionWorker.js.LICENSE.txt +5 -0
  16. package/dist/index.html +1 -0
  17. package/dist/vendor.css +6 -0
  18. package/dist/vendor.js +1 -0
  19. package/editor.index.ejs +14 -0
  20. package/editor_bar.png +0 -0
  21. package/ext.json.sample +9 -0
  22. package/package.json +54 -0
  23. package/redactor/plugins/alignment/alignment.js +55 -0
  24. package/redactor/plugins/alignment/alignment.min.js +1 -0
  25. package/redactor/plugins/counter/counter.js +76 -0
  26. package/redactor/plugins/counter/counter.min.js +1 -0
  27. package/redactor/plugins/filesafe/filesafe.js +70 -0
  28. package/redactor/plugins/filesafe/filesafe.min.js +70 -0
  29. package/redactor/plugins/fontcolor/fontcolor.js +184 -0
  30. package/redactor/plugins/fontcolor/fontcolor.min.js +1 -0
  31. package/redactor/plugins/fontfamily/fontfamily.js +59 -0
  32. package/redactor/plugins/fontfamily/fontfamily.min.js +1 -0
  33. package/redactor/plugins/fontsize/fontsize.js +58 -0
  34. package/redactor/plugins/fontsize/fontsize.min.js +1 -0
  35. package/redactor/plugins/imagemanager/imagemanager.js +82 -0
  36. package/redactor/plugins/imagemanager/imagemanager.min.js +1 -0
  37. package/redactor/plugins/inlinestyle/inlinestyle.css +34 -0
  38. package/redactor/plugins/inlinestyle/inlinestyle.js +62 -0
  39. package/redactor/plugins/inlinestyle/inlinestyle.min.css +1 -0
  40. package/redactor/plugins/inlinestyle/inlinestyle.min.js +1 -0
  41. package/redactor/plugins/specialchars/specialchars.js +78 -0
  42. package/redactor/plugins/specialchars/specialchars.min.js +1 -0
  43. package/redactor/plugins/table/table.js +477 -0
  44. package/redactor/plugins/table/table.min.js +1 -0
  45. package/redactor/plugins/textdirection/textdirection.js +44 -0
  46. package/redactor/plugins/textdirection/textdirection.min.js +1 -0
  47. package/redactor/plugins/textexpander/textexpander.js +64 -0
  48. package/redactor/plugins/textexpander/textexpander.min.js +1 -0
  49. package/redactor/plugins/variable/variable.css +23 -0
  50. package/redactor/plugins/variable/variable.js +222 -0
  51. package/redactor/plugins/variable/variable.min.css +1 -0
  52. package/redactor/plugins/variable/variable.min.js +1 -0
  53. package/redactor/src/redactor.min.css +1 -0
  54. package/redactor/src/redactor.min.js +1 -0
  55. package/webpack.config.js +82 -0
  56. package/webpack.dev.js +20 -0
  57. package/webpack.prod.js +11 -0
@@ -0,0 +1,58 @@
1
+ (function($R)
2
+ {
3
+ $R.add('plugin', 'fontsize', {
4
+ translations: {
5
+ en: {
6
+ "size": "Size",
7
+ "remove-size": "Remove Font Size"
8
+ }
9
+ },
10
+ init: function(app)
11
+ {
12
+ this.app = app;
13
+ this.lang = app.lang;
14
+ this.inline = app.inline;
15
+ this.toolbar = app.toolbar;
16
+
17
+ // local
18
+ this.sizes = [10, 11, 12, 14, 16, 18, 20, 24, 28, 30];
19
+ },
20
+ // public
21
+ start: function()
22
+ {
23
+ var dropdown = {};
24
+ for (var i = 0; i < this.sizes.length; i++)
25
+ {
26
+ var size = this.sizes[i];
27
+ dropdown[i] = {
28
+ title: size + 'px',
29
+ api: 'plugin.fontsize.set',
30
+ args: size
31
+ };
32
+ }
33
+
34
+ dropdown.remove = {
35
+ title: this.lang.get('remove-size'),
36
+ api: 'plugin.fontsize.remove'
37
+ };
38
+
39
+ var $button = this.toolbar.addButton('fontsize', { title: this.lang.get('size') });
40
+ $button.setIcon('<i class="re-icon-fontsize"></i>');
41
+ $button.setDropdown(dropdown);
42
+ },
43
+ set: function(size)
44
+ {
45
+ var args = {
46
+ tag: 'span',
47
+ style: { 'font-size': size + 'px' },
48
+ type: 'toggle'
49
+ };
50
+
51
+ this.inline.format(args);
52
+ },
53
+ remove: function()
54
+ {
55
+ this.inline.remove({ style: 'font-size' });
56
+ }
57
+ });
58
+ })(Redactor);
@@ -0,0 +1 @@
1
+ Redactor.add("plugin","fontsize",{translations:{en:{size:"Size","remove-size":"Remove Font Size"}},init:function(i){this.app=i,this.lang=i.lang,this.inline=i.inline,this.toolbar=i.toolbar,this.sizes=[10,11,12,14,16,18,20,24,28,30]},start:function(){for(var i={},t=0;t<this.sizes.length;t++){var e=this.sizes[t];i[t]={title:e+"px",api:"plugin.fontsize.set",args:e}}i.remove={title:this.lang.get("remove-size"),api:"plugin.fontsize.remove"};var s=this.toolbar.addButton("fontsize",{title:this.lang.get("size")});s.setIcon('<i class="re-icon-fontsize"></i>'),s.setDropdown(i)},set:function(i){var t={tag:"span",style:{"font-size":i+"px"},type:"toggle"};this.inline.format(t)},remove:function(){this.inline.remove({style:"font-size"})}});
@@ -0,0 +1,82 @@
1
+ (function($R)
2
+ {
3
+ $R.add('plugin', 'imagemanager', {
4
+ translations: {
5
+ en: {
6
+ "choose": "Choose"
7
+ }
8
+ },
9
+ init: function(app)
10
+ {
11
+ this.app = app;
12
+ this.lang = app.lang;
13
+ this.opts = app.opts;
14
+ },
15
+ // messages
16
+ onmodal: {
17
+ image: {
18
+ open: function($modal, $form)
19
+ {
20
+ if (!this.opts.imageManagerJson) return;
21
+ this._load($modal)
22
+ }
23
+ }
24
+ },
25
+
26
+ // private
27
+ _load: function($modal)
28
+ {
29
+ var $body = $modal.getBody();
30
+
31
+ this.$box = $R.dom('<div>');
32
+ this.$box.attr('data-title', this.lang.get('choose'));
33
+ this.$box.addClass('redactor-modal-tab');
34
+ this.$box.hide();
35
+ this.$box.css({
36
+ overflow: 'auto',
37
+ height: '300px',
38
+ 'line-height': 1
39
+ });
40
+
41
+ $body.append(this.$box);
42
+
43
+ $R.ajax.get({
44
+ url: this.opts.imageManagerJson,
45
+ success: this._parse.bind(this)
46
+ });
47
+ },
48
+ _parse: function(data)
49
+ {
50
+ for (var key in data)
51
+ {
52
+ var obj = data[key];
53
+ if (typeof obj !== 'object') continue;
54
+
55
+ var $img = $R.dom('<img>');
56
+ var url = (obj.thumb) ? obj.thumb : obj.url;
57
+
58
+ $img.attr('src', url);
59
+ $img.attr('data-params', encodeURI(JSON.stringify(obj)));
60
+ $img.css({
61
+ width: '96px',
62
+ height: '72px',
63
+ margin: '0 4px 2px 0',
64
+ cursor: 'pointer'
65
+ });
66
+
67
+ $img.on('click', this._insert.bind(this));
68
+
69
+ this.$box.append($img);
70
+ }
71
+ },
72
+ _insert: function(e)
73
+ {
74
+ e.preventDefault();
75
+
76
+ var $el = $R.dom(e.target);
77
+ var data = JSON.parse(decodeURI($el.attr('data-params')));
78
+
79
+ this.app.api('module.image.insert', { image: data });
80
+ }
81
+ });
82
+ })(Redactor);
@@ -0,0 +1 @@
1
+ !function(e){e.add("plugin","imagemanager",{translations:{en:{choose:"Choose"}},init:function(t){this.app=t,this.lang=t.lang,this.opts=t.opts},onmodal:{image:{open:function(t,a){this.opts.imageManagerJson&&this._load(t)}}},_load:function(t){var a=t.getBody();this.$box=e.dom("<div>"),this.$box.attr("data-title",this.lang.get("choose")),this.$box.addClass("redactor-modal-tab"),this.$box.hide(),this.$box.css({overflow:"auto",height:"300px","line-height":1}),a.append(this.$box),e.ajax.get({url:this.opts.imageManagerJson,success:this._parse.bind(this)})},_parse:function(t){for(var a in t){var i=t[a];if("object"==typeof i){var o=e.dom("<img>"),s=i.thumb?i.thumb:i.url;o.attr("src",s),o.attr("data-params",encodeURI(JSON.stringify(i))),o.css({width:"96px",height:"72px",margin:"0 4px 2px 0",cursor:"pointer"}),o.on("click",this._insert.bind(this)),this.$box.append(o)}}},_insert:function(t){t.preventDefault();var a=e.dom(t.target),i=JSON.parse(decodeURI(a.attr("data-params")));this.app.api("module.image.insert",{image:i})}})}(Redactor);
@@ -0,0 +1,34 @@
1
+ .redactor-dropdown-inline .redactor-dropdown-item-marked span {
2
+ font-size: 14px;
3
+ background-color: #fdb833;
4
+ color: #000;
5
+ text-decoration: none;
6
+ }
7
+ .redactor-dropdown-inline .redactor-dropdown-item-code span {
8
+ font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
9
+ font-size: 13px;
10
+ background: rgba(0, 0, 0, .05);
11
+ }
12
+ .redactor-dropdown-inline .redactor-dropdown-item-variable span {
13
+ font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
14
+ font-size: 13px;
15
+ color: rgba(0, 0, 0, .5);
16
+ }
17
+ .redactor-dropdown-inline .redactor-dropdown-item-shortcut span {
18
+ font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
19
+ font-size: 12px;
20
+ padding: 0.25em;
21
+ white-space: nowrap;
22
+ border: 1px solid #e5e7e9;
23
+ }
24
+ .redactor-dropdown-inline .redactor-dropdown-item-sup span,
25
+ .redactor-dropdown-inline .redactor-dropdown-item-sub span {
26
+ position: relative;
27
+ font-size: 12px;
28
+ }
29
+ .redactor-dropdown-inline .redactor-dropdown-item-sup span {
30
+ top: -3px;
31
+ }
32
+ .redactor-dropdown-inline .redactor-dropdown-item-sub span {
33
+ top: 3px;
34
+ }
@@ -0,0 +1,62 @@
1
+ (function($R)
2
+ {
3
+ $R.add('plugin', 'inlinestyle', {
4
+ translations: {
5
+ en: {
6
+ "style": "Style"
7
+ }
8
+ },
9
+ init: function(app)
10
+ {
11
+ this.app = app;
12
+ this.lang = app.lang;
13
+ this.toolbar = app.toolbar;
14
+
15
+ // local
16
+ this.styles = {
17
+ "marked": {
18
+ title: "Marked",
19
+ args: 'mark'
20
+ },
21
+ "code": {
22
+ title: "Code",
23
+ args: 'code'
24
+ },
25
+ "variable": {
26
+ title: "Variable",
27
+ args: 'var'
28
+ },
29
+ "shortcut": {
30
+ title: "Shortcut",
31
+ args: 'kbd'
32
+ },
33
+ "sup": {
34
+ title: "Superscript",
35
+ args: 'sup'
36
+ },
37
+ "sub": {
38
+ title: "Subscript",
39
+ args: 'sub'
40
+ }
41
+ };
42
+ },
43
+ start: function()
44
+ {
45
+ var dropdown = {};
46
+ for (var key in this.styles)
47
+ {
48
+ var style = this.styles[key];
49
+ dropdown[key] = {
50
+ title: style.title,
51
+ api: 'module.inline.format',
52
+ args: style.args
53
+ };
54
+ }
55
+
56
+ var $button = this.toolbar.addButtonAfter('format', 'inline', { title: this.lang.get('style') });
57
+
58
+ $button.setIcon('<i class="re-icon-inline"></i>');
59
+ $button.setDropdown(dropdown);
60
+ }
61
+ });
62
+ })(Redactor);
@@ -0,0 +1 @@
1
+ .redactor-dropdown-inline .redactor-dropdown-item-marked span{font-size:14px;background-color:#fdb833;color:#000;text-decoration:none}.redactor-dropdown-inline .redactor-dropdown-item-code span{font-family:Consolas,Menlo,Monaco,"Courier New",monospace;font-size:13px;background:rgba(0,0,0,.05)}.redactor-dropdown-inline .redactor-dropdown-item-variable span{font-family:Consolas,Menlo,Monaco,"Courier New",monospace;font-size:13px;color:rgba(0,0,0,.5)}.redactor-dropdown-inline .redactor-dropdown-item-shortcut span{font-family:Consolas,Menlo,Monaco,"Courier New",monospace;font-size:12px;padding:.25em;white-space:nowrap;border:1px solid #e5e7e9}.redactor-dropdown-inline .redactor-dropdown-item-sub span,.redactor-dropdown-inline .redactor-dropdown-item-sup span{position:relative;font-size:12px}.redactor-dropdown-inline .redactor-dropdown-item-sup span{top:-3px}.redactor-dropdown-inline .redactor-dropdown-item-sub span{top:3px}
@@ -0,0 +1 @@
1
+ Redactor.add("plugin","inlinestyle",{translations:{en:{style:"Style"}},init:function(t){this.app=t,this.lang=t.lang,this.toolbar=t.toolbar,this.styles={marked:{title:"Marked",args:"mark"},code:{title:"Code",args:"code"},variable:{title:"Variable",args:"var"},shortcut:{title:"Shortcut",args:"kbd"},sup:{title:"Superscript",args:"sup"},sub:{title:"Subscript",args:"sub"}}},start:function(){var t={};for(var i in this.styles){var s=this.styles[i];t[i]={title:s.title,api:"module.inline.format",args:s.args}}var a=this.toolbar.addButtonAfter("format","inline",{title:this.lang.get("style")});a.setIcon('<i class="re-icon-inline"></i>'),a.setDropdown(t)}});
@@ -0,0 +1,78 @@
1
+ (function($R)
2
+ {
3
+ $R.add('plugin', 'specialchars', {
4
+ translations: {
5
+ en: {
6
+ "specialchars": "Special Characters"
7
+ }
8
+ },
9
+ init: function(app)
10
+ {
11
+ this.app = app;
12
+ this.lang = app.lang;
13
+ this.toolbar = app.toolbar;
14
+ this.insertion = app.insertion;
15
+
16
+ // local
17
+ this.chars = [
18
+
19
+ '&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;', '&ndash;', '&mdash;', '&divide;', '&hellip;', '&trade;', '&bull;',
20
+ '&rarr;', '&asymp;', '$', '&euro;', '&cent;', '&pound;', '&yen;', '&iexcl;',
21
+ '&curren;', '&brvbar;', '&sect;', '&uml;', '&copy;', '&ordf;', '&laquo;', '&raquo;', '&not;', '&reg;', '&macr;',
22
+ '&deg;', '&sup1;', '&sup2;', '&sup3;', '&acute;', '&micro;', '&para;', '&middot;', '&cedil;', '&ordm;',
23
+ '&frac14;', '&frac12;', '&frac34;', '&iquest;', '&Agrave;', '&Aacute;', '&Acirc;', '&Atilde;', '&Auml;', '&Aring;',
24
+ '&AElig;', '&Ccedil;', '&Egrave;', '&Eacute;', '&Ecirc;', '&Euml;', '&Igrave;', '&Iacute;', '&Icirc;', '&Iuml;',
25
+ '&ETH;', '&Ntilde;', '&Ograve;', '&Oacute;', '&Ocirc;', '&Otilde;', '&Ouml;', '&times;', '&Oslash;', '&Ugrave;',
26
+ '&Uacute;', '&Ucirc;', '&Uuml;', '&Yacute;', '&THORN;', '&szlig;', '&agrave;', '&aacute;', '&acirc;', '&atilde;',
27
+ '&auml;', '&aring;', '&aelig;', '&ccedil;', '&egrave;', '&eacute;', '&ecirc;', '&euml;', '&igrave;', '&iacute;',
28
+ '&icirc;', '&iuml;', '&eth;', '&ntilde;', '&ograve;', '&oacute;', '&ocirc;', '&otilde;', '&ouml;',
29
+ '&oslash;', '&ugrave;', '&uacute;', '&ucirc;', '&uuml;', '&yacute;', '&thorn;', '&yuml;', '&OElig;', '&oelig;',
30
+ '&#372;', '&#374', '&#373', '&#375;'
31
+ ];
32
+ },
33
+ // public
34
+ start: function()
35
+ {
36
+ var btnObj = {
37
+ title: this.lang.get('specialchars')
38
+ };
39
+
40
+ var $dropdown = this._buildDropdown();
41
+
42
+ this.$button = this.toolbar.addButton('specialchars', btnObj);
43
+ this.$button.setIcon('<i class="re-icon-specialcharacters"></i>');
44
+ this.$button.setDropdown($dropdown);
45
+ },
46
+
47
+ // private
48
+ _set: function(character)
49
+ {
50
+ this.insertion.insertChar(character);
51
+ },
52
+ _buildDropdown: function()
53
+ {
54
+ var self = this;
55
+ var $dropdown = $R.dom('<div class="redactor-dropdown-cells">');
56
+ var func = function(e)
57
+ {
58
+ e.preventDefault();
59
+
60
+ var $el = $R.dom(e.target);
61
+ self._set($el.data('char'));
62
+ };
63
+
64
+ for (var i = 0; i < this.chars.length; i++)
65
+ {
66
+ var $el = $R.dom('<a>');
67
+ $el.attr({ 'href': '#', 'data-char': this.chars[i] });
68
+ $el.css({ 'line-height': '32px', 'width': '32px', 'height': '32px' });
69
+ $el.html(this.chars[i]);
70
+ $el.on('click', func);
71
+
72
+ $dropdown.append($el);
73
+ }
74
+
75
+ return $dropdown;
76
+ }
77
+ });
78
+ })(Redactor);
@@ -0,0 +1 @@
1
+ !function(c){c.add("plugin","specialchars",{translations:{en:{specialchars:"Special Characters"}},init:function(a){this.app=a,this.lang=a.lang,this.toolbar=a.toolbar,this.insertion=a.insertion,this.chars=["&lsquo;","&rsquo;","&ldquo;","&rdquo;","&ndash;","&mdash;","&divide;","&hellip;","&trade;","&bull;","&rarr;","&asymp;","$","&euro;","&cent;","&pound;","&yen;","&iexcl;","&curren;","&brvbar;","&sect;","&uml;","&copy;","&ordf;","&laquo;","&raquo;","&not;","&reg;","&macr;","&deg;","&sup1;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;","&cedil;","&ordm;","&frac14;","&frac12;","&frac34;","&iquest;","&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;","&Egrave;","&Eacute;","&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;","&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;","&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;","&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;","&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;","&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;","&OElig;","&oelig;","&#372;","&#374","&#373","&#375;"]},start:function(){var a={title:this.lang.get("specialchars")},t=this._buildDropdown();this.$button=this.toolbar.addButton("specialchars",a),this.$button.setIcon('<i class="re-icon-specialcharacters"></i>'),this.$button.setDropdown(t)},_set:function(a){this.insertion.insertChar(a)},_buildDropdown:function(){function a(a){a.preventDefault();var t=c.dom(a.target);i._set(t.data("char"))}for(var i=this,t=c.dom('<div class="redactor-dropdown-cells">'),r=0;r<this.chars.length;r++){var e=c.dom("<a>");e.attr({href:"#","data-char":this.chars[r]}),e.css({"line-height":"32px",width:"32px",height:"32px"}),e.html(this.chars[r]),e.on("click",a),t.append(e)}return t}})}(Redactor);