@themarioga/grid-editor 5.1.2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/BUILDING.md +6 -0
  2. package/CHANGELOG.md +58 -0
  3. package/README.md +46 -9
  4. package/UPGRADING.md +25 -0
  5. package/dist/grideditor.css +28 -0
  6. package/dist/grideditor.min.css +1 -1
  7. package/dist/grideditor.min.css.map +1 -1
  8. package/dist/jquery.grideditor.bundle.min.js +2 -2
  9. package/dist/jquery.grideditor.js +760 -245
  10. package/dist/jquery.grideditor.min.js +1 -1
  11. package/dist/jquery.grideditor.min.js.map +1 -1
  12. package/dist/locales/grideditor.es.js +11 -0
  13. package/dist/locales/grideditor.es.min.js +1 -1
  14. package/dist/locales/grideditor.es.min.js.map +1 -1
  15. package/dist/plugins/grideditor.ckeditor.js +120 -0
  16. package/dist/plugins/grideditor.ckeditor.min.js +2 -0
  17. package/dist/plugins/grideditor.ckeditor.min.js.map +1 -0
  18. package/dist/plugins/grideditor.clipboard.js +8 -7
  19. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  20. package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
  21. package/dist/plugins/grideditor.spacing.js +1 -1
  22. package/dist/plugins/grideditor.spacing.min.js +1 -1
  23. package/dist/plugins/grideditor.spacing.min.js.map +1 -1
  24. package/dist/plugins/grideditor.summernote.js +98 -0
  25. package/dist/plugins/grideditor.summernote.min.js +2 -0
  26. package/dist/plugins/grideditor.summernote.min.js.map +1 -0
  27. package/dist/plugins/grideditor.textalign.js +1 -1
  28. package/dist/plugins/grideditor.textalign.min.js +1 -1
  29. package/dist/plugins/grideditor.textalign.min.js.map +1 -1
  30. package/dist/plugins/grideditor.tinymce.js +162 -0
  31. package/dist/plugins/grideditor.tinymce.min.js +2 -0
  32. package/dist/plugins/grideditor.tinymce.min.js.map +1 -0
  33. package/dist/plugins/grideditor.visibility.js +3 -3
  34. package/dist/plugins/grideditor.visibility.min.js +1 -1
  35. package/dist/plugins/grideditor.visibility.min.js.map +1 -1
  36. package/docs/events.md +5 -2
  37. package/docs/locale-keys.md +23 -1
  38. package/docs/plugins.md +61 -4
  39. package/example/attributes.html +4 -2
  40. package/example/autosave.html +2 -0
  41. package/example/basic.html +2 -0
  42. package/example/ckeditor.html +2 -0
  43. package/example/clipboard.html +2 -0
  44. package/example/containers.html +2 -0
  45. package/example/elements.html +2 -0
  46. package/example/summernote.html +2 -0
  47. package/example/wrap_content.html +2 -0
  48. package/package.json +1 -1
  49. package/src/js/compat/bundled-texts.js +14 -0
  50. package/src/js/jquery.grideditor.js +444 -33
  51. package/src/js/locales/grideditor.es.js +11 -0
  52. package/src/js/plugins/grideditor.ckeditor.js +120 -0
  53. package/src/js/plugins/grideditor.clipboard.js +8 -7
  54. package/src/js/plugins/grideditor.spacing.js +1 -1
  55. package/src/js/plugins/grideditor.summernote.js +98 -0
  56. package/src/js/plugins/grideditor.textalign.js +1 -1
  57. package/src/js/plugins/grideditor.tinymce.js +162 -0
  58. package/src/js/plugins/grideditor.visibility.js +3 -3
  59. package/src/less/grideditor.less +34 -0
  60. package/src/js/jquery.grideditor.ckeditor.js +0 -77
  61. package/src/js/jquery.grideditor.summernote.js +0 -72
  62. package/src/js/jquery.grideditor.tinymce.js +0 -143
@@ -1,72 +0,0 @@
1
- (function($) {
2
-
3
- $.fn.gridEditor.RTEs.summernote = {
4
-
5
- init: function(settings, contentAreas) {
6
-
7
- if (!jQuery().summernote) {
8
- console.error($.fn.gridEditor.t(settings, 'error.summernote_missing'));
9
- }
10
-
11
- var self = this;
12
- contentAreas.each(function() {
13
- var contentArea = $(this);
14
- if (!contentArea.hasClass('active')) {
15
- if (contentArea.html() == self.initialContent) {
16
- contentArea.html('');
17
- }
18
- contentArea.addClass('active');
19
-
20
- var configuration = $.extend(
21
- true, // deep copy
22
- {},
23
- (settings.summernote && settings.summernote.config ? settings.summernote.config : {}),
24
- {
25
- tabsize: 2,
26
- airMode: true,
27
- // Focus editor on creation
28
- callbacks: {
29
- onInit: function() {
30
-
31
- // Call original oninit function, if one was passed in the config
32
- var callback;
33
- try {
34
- callback = settings.summernote.config.callbacks.onInit;
35
- } catch (err) {
36
- // No callback passed
37
- }
38
- if (callback) {
39
- callback.call(this);
40
- }
41
-
42
- // The editor owns what is inside the
43
- // content area now, so the grid editor is
44
- // told to put its own furniture back
45
- contentArea.trigger('ge-rte-ready');
46
-
47
- contentArea.summernote('focus');
48
- }
49
- }
50
- }
51
- );
52
- contentArea.summernote(configuration);
53
- }
54
- });
55
- },
56
-
57
- deinit: function(settings, contentAreas) {
58
- contentAreas.filter('.active').each(function() {
59
- var contentArea = $(this);
60
- contentArea.summernote('destroy');
61
- contentArea
62
- .removeClass('active')
63
- .removeAttr('id')
64
- .removeAttr('style')
65
- .removeAttr('spellcheck')
66
- ;
67
- });
68
- },
69
-
70
- initialContent: '<p>Lorem ipsum dolores</p>',
71
- };
72
- })(jQuery);
@@ -1,143 +0,0 @@
1
- (function($) {
2
-
3
- // tinyMCE snapshots the target element's attributes when an inline editor is
4
- // created and restores them on remove(), so this has to run *after* remove()
5
- // to keep the grid editor's own class and tinyMCE's leftovers off the element.
6
- function cleanUp(contentArea) {
7
- contentArea
8
- .removeClass('active')
9
- .removeClass('ge-rte-active')
10
- .removeAttr('id')
11
- .removeAttr('style')
12
- .removeAttr('spellcheck')
13
- .removeAttr('contenteditable')
14
- .removeAttr('data-mce-style')
15
- ;
16
- }
17
-
18
- $.fn.gridEditor.RTEs.tinymce = {
19
-
20
- init: function(settings, contentAreas) {
21
-
22
- if (!window.tinymce) {
23
- console.error($.fn.gridEditor.t(settings, 'error.tinymce_missing'));
24
- return;
25
- }
26
-
27
- var self = this;
28
- var userConfig = (settings.tinymce && settings.tinymce.config) ? settings.tinymce.config : {};
29
-
30
- contentAreas.each(function() {
31
- var contentArea = $(this);
32
- if (contentArea.hasClass('active')) { return; }
33
-
34
- if (contentArea.html() == self.initialContent) {
35
- contentArea.html('');
36
- }
37
- contentArea.addClass('active');
38
-
39
- var configuration = $.extend({
40
- // tinyMCE's own "Upgrade" badge in the menubar. Off by
41
- // default because an inline editor here is a column of
42
- // someone's page, not tinyMCE's own interface; a host that
43
- // wants it back passes promotion: true.
44
- promotion: false,
45
- }, userConfig, {
46
- target: this,
47
- inline: true,
48
- init_instance_callback: function(editor) {
49
- // deinit ran before this init finished, so tear it down again
50
- if (contentArea.data('ge-tinymce-pending-remove')) {
51
- contentArea.removeData('ge-tinymce-pending-remove');
52
- editor.remove();
53
- // deinit already ran and cannot clean up after this
54
- // late remove(), so do it here instead
55
- cleanUp(contentArea);
56
- return;
57
- }
58
-
59
- contentArea.data('ge-tinymce', editor);
60
-
61
- // The editor rewrote what is inside this content area
62
- // while it took it over, so whatever the grid editor
63
- // had in there is gone. Saying so lets it put its own
64
- // furniture back (see RTE_READY in the core).
65
- contentArea.trigger('ge-rte-ready');
66
-
67
- // Undo and redo rewrite it too, from snapshots that
68
- // leave out whatever is marked data-mce-bogus - an
69
- // element's drawer among them - so it goes back in
70
- // after each of those as well
71
- editor.on('Undo Redo', function() {
72
- contentArea.trigger('ge-rte-ready');
73
- });
74
-
75
- // The inline toolbar is laid out against the element's
76
- // geometry at the moment tinyMCE draws it, and an
77
- // element that has just appeared - a tab pane, an
78
- // accordion body, a column whose width is still
79
- // settling - may not have its own width yet. Asking
80
- // for the ui again once the browser has laid the frame
81
- // out measures it as it now is, instead of leaving a
82
- // toolbar wrapped into a narrow column.
83
- window.requestAnimationFrame(function() {
84
- if (editor.removed || !editor.ui || !editor.ui.show) { return; }
85
-
86
- editor.ui.show();
87
- });
88
-
89
- // And again whenever the user comes back to this
90
- // editor: by then the element may have been resized,
91
- // hidden and shown again - a tab switched away from
92
- // and back, a column made narrower - and the toolbar
93
- // is only ever as right as its last measurement.
94
- editor.on('focus', function() {
95
- window.requestAnimationFrame(function() {
96
- if (editor.removed || !editor.ui || !editor.ui.show) { return; }
97
-
98
- editor.ui.show();
99
- });
100
- });
101
-
102
- // Bring focus to text field
103
- editor.focus();
104
-
105
- // Call the original callbacks, if any were passed in the config
106
- if (userConfig.init_instance_callback) {
107
- userConfig.init_instance_callback.call(this, editor);
108
- }
109
- // 'oninit' is the pre-6 name, honoured so existing configs keep working
110
- if (userConfig.oninit) {
111
- userConfig.oninit.call(this, editor);
112
- }
113
- }
114
- });
115
- // We always edit the element we were handed, so a selector in the
116
- // user config would only fight with target
117
- delete configuration.selector;
118
-
119
- window.tinymce.init(configuration);
120
- });
121
- },
122
-
123
- deinit: function(settings, contentAreas) {
124
- contentAreas.filter('.active').each(function() {
125
- var contentArea = $(this);
126
- var editor = contentArea.data('ge-tinymce');
127
-
128
- if (editor) {
129
- contentArea.removeData('ge-tinymce');
130
- editor.remove();
131
- } else {
132
- // tinymce.init() is asynchronous, so the editor may not exist
133
- // yet. Leave a note for init_instance_callback to remove it.
134
- contentArea.data('ge-tinymce-pending-remove', true);
135
- }
136
-
137
- cleanUp(contentArea);
138
- });
139
- },
140
-
141
- initialContent: '<p>Lorem ipsum dolores</p>',
142
- };
143
- })(jQuery);