@themarioga/grid-editor 5.2.0 → 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.
- package/CHANGELOG.md +33 -0
- package/README.md +29 -1
- package/dist/grideditor.css +28 -0
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/jquery.grideditor.bundle.min.js +2 -2
- package/dist/jquery.grideditor.js +395 -26
- package/dist/jquery.grideditor.min.js +1 -1
- package/dist/jquery.grideditor.min.js.map +1 -1
- package/dist/locales/grideditor.es.js +11 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.js +5 -0
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +1 -1
- package/dist/plugins/grideditor.clipboard.js +8 -7
- package/dist/plugins/grideditor.clipboard.min.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- package/dist/plugins/grideditor.spacing.js +1 -1
- package/dist/plugins/grideditor.spacing.min.js +1 -1
- package/dist/plugins/grideditor.spacing.min.js.map +1 -1
- package/dist/plugins/grideditor.summernote.js +5 -0
- package/dist/plugins/grideditor.summernote.min.js +1 -1
- package/dist/plugins/grideditor.summernote.min.js.map +1 -1
- package/dist/plugins/grideditor.textalign.js +1 -1
- package/dist/plugins/grideditor.textalign.min.js +1 -1
- package/dist/plugins/grideditor.textalign.min.js.map +1 -1
- package/dist/plugins/grideditor.tinymce.js +5 -0
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +1 -1
- package/dist/plugins/grideditor.visibility.js +3 -3
- package/dist/plugins/grideditor.visibility.min.js +1 -1
- package/dist/plugins/grideditor.visibility.min.js.map +1 -1
- package/docs/events.md +5 -2
- package/docs/locale-keys.md +23 -1
- package/docs/plugins.md +7 -2
- package/example/attributes.html +2 -2
- package/package.json +1 -1
- package/src/js/jquery.grideditor.js +380 -26
- package/src/js/locales/grideditor.es.js +11 -0
- package/src/js/plugins/grideditor.ckeditor.js +5 -0
- package/src/js/plugins/grideditor.clipboard.js +8 -7
- package/src/js/plugins/grideditor.spacing.js +1 -1
- package/src/js/plugins/grideditor.summernote.js +5 -0
- package/src/js/plugins/grideditor.textalign.js +1 -1
- package/src/js/plugins/grideditor.tinymce.js +5 -0
- package/src/js/plugins/grideditor.visibility.js +3 -3
- package/src/less/grideditor.less +34 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Copy and paste for grid-editor.
|
|
3
3
|
*
|
|
4
4
|
* A feature plugin: load this file after the editor and every row, column,
|
|
5
|
-
* section, container and element gets a copy tool, and every
|
|
6
|
-
* them can go gets a paste tool while there is something copied
|
|
5
|
+
* section, text block, container and element gets a copy tool, and every
|
|
6
|
+
* place one of them can go gets a paste tool while there is something copied
|
|
7
|
+
* that fits.
|
|
7
8
|
* What it can ask the editor for is the handle its factory is called with,
|
|
8
9
|
* described in docs/plugins.md.
|
|
9
10
|
*
|
|
@@ -37,10 +38,10 @@ var editors = 0;
|
|
|
37
38
|
/**
|
|
38
39
|
* What each drawer takes when something is pasted into it, by the kind of the
|
|
39
40
|
* node the drawer belongs to. A category is what was copied: a row, a column,
|
|
40
|
-
* a section, a container of any type, an element.
|
|
41
|
+
* a section, a text block, a container of any type, an element.
|
|
41
42
|
*/
|
|
42
43
|
var TARGETS = {
|
|
43
|
-
column: ['row', 'container', 'element'],
|
|
44
|
+
column: ['row', 'text', 'container', 'element'],
|
|
44
45
|
row: ['column'],
|
|
45
46
|
section: ['row'],
|
|
46
47
|
};
|
|
@@ -117,7 +118,7 @@ $.fn.gridEditor.features.clipboard = function(ge) {
|
|
|
117
118
|
function categoryOf(kind) {
|
|
118
119
|
if ($.fn.gridEditor.containers[kind]) { return 'container'; }
|
|
119
120
|
|
|
120
|
-
return ['row', 'column', 'section', 'element'].indexOf(kind) !== -1 ? kind : null;
|
|
121
|
+
return ['row', 'column', 'section', 'text', 'element'].indexOf(kind) !== -1 ? kind : null;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
function copy(node, kind) {
|
|
@@ -128,7 +129,7 @@ $.fn.gridEditor.features.clipboard = function(ge) {
|
|
|
128
129
|
|
|
129
130
|
// The canvas came back with new drawers: the one to flash is the
|
|
130
131
|
// node's new copy tool
|
|
131
|
-
var tool =
|
|
132
|
+
var tool = ge.drawerOf(node).find('> .ge-copy');
|
|
132
133
|
tool.addClass('ge-copied').find('i').attr('class', 'bi bi-check2');
|
|
133
134
|
setTimeout(function() {
|
|
134
135
|
tool.removeClass('ge-copied').find('i').attr('class', 'bi bi-copy');
|
|
@@ -145,7 +146,7 @@ $.fn.gridEditor.features.clipboard = function(ge) {
|
|
|
145
146
|
// An element goes into the column's last content area. With none,
|
|
146
147
|
// the column's next init wraps it in one of its own
|
|
147
148
|
if (clip.category === 'element') {
|
|
148
|
-
var area = target.
|
|
149
|
+
var area = target.find('> .ge-text-block > .ge-content, > .ge-content').last();
|
|
149
150
|
if (area.length) { into = area; }
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -252,7 +252,7 @@ $.fn.gridEditor.utilities.spacing = function(ge) {
|
|
|
252
252
|
name: key + side,
|
|
253
253
|
prefix: key + side,
|
|
254
254
|
values: values,
|
|
255
|
-
appliesTo: ['row', 'column', 'element', 'container'],
|
|
255
|
+
appliesTo: ['row', 'column', 'text', 'element', 'container'],
|
|
256
256
|
labelKey: labelKey,
|
|
257
257
|
panel: false,
|
|
258
258
|
choices: function() {
|
|
@@ -14,10 +14,15 @@
|
|
|
14
14
|
*/
|
|
15
15
|
(function($) {
|
|
16
16
|
|
|
17
|
+
$.extend($.fn.gridEditor.locales.en, {
|
|
18
|
+
'text.summernote': 'Summernote',
|
|
19
|
+
});
|
|
20
|
+
|
|
17
21
|
var INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';
|
|
18
22
|
|
|
19
23
|
$.fn.gridEditor.texts.summernote = function(ge) {
|
|
20
24
|
return {
|
|
25
|
+
labelKey: 'text.summernote',
|
|
21
26
|
initialContent: INITIAL_CONTENT,
|
|
22
27
|
missingKey: 'error.summernote_missing',
|
|
23
28
|
|
|
@@ -39,7 +39,7 @@ $.fn.gridEditor.utilities.textalign = function(ge) {
|
|
|
39
39
|
name: 'text-align',
|
|
40
40
|
prefix: 'text',
|
|
41
41
|
values: ['start', 'center', 'end'],
|
|
42
|
-
appliesTo: ['row', 'column', 'element', 'container'],
|
|
42
|
+
appliesTo: ['row', 'column', 'text', 'element', 'container'],
|
|
43
43
|
labelKey: 'utility.text_align',
|
|
44
44
|
label: label,
|
|
45
45
|
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
(function($) {
|
|
16
16
|
|
|
17
|
+
$.extend($.fn.gridEditor.locales.en, {
|
|
18
|
+
'text.tinymce': 'tinyMCE',
|
|
19
|
+
});
|
|
20
|
+
|
|
17
21
|
// tinyMCE snapshots the target element's attributes when an inline editor is
|
|
18
22
|
// created and restores them on remove(), so this has to run *after* remove()
|
|
19
23
|
// to keep the grid editor's own class and tinyMCE's leftovers off the element.
|
|
@@ -33,6 +37,7 @@
|
|
|
33
37
|
|
|
34
38
|
$.fn.gridEditor.texts.tinymce = function(ge) {
|
|
35
39
|
return {
|
|
40
|
+
labelKey: 'text.tinymce',
|
|
36
41
|
initialContent: INITIAL_CONTENT,
|
|
37
42
|
missingKey: 'error.tinymce_missing',
|
|
38
43
|
|
|
@@ -32,7 +32,7 @@ $.extend($.fn.gridEditor.locales.en, {
|
|
|
32
32
|
/** A node that carries any class of the family, at any breakpoint. */
|
|
33
33
|
var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
|
|
34
34
|
|
|
35
|
-
var NODES = '.row, .column, .ge-element, [data-ge-container]';
|
|
35
|
+
var NODES = '.row, .column, .ge-content, .ge-element, [data-ge-container]';
|
|
36
36
|
|
|
37
37
|
$.fn.gridEditor.utilities.visibility = function(ge) {
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ $.fn.gridEditor.utilities.visibility = function(ge) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function applies(node, kind) {
|
|
47
|
-
return kind === 'row' || kind === 'column' || kind === 'element' ||
|
|
47
|
+
return kind === 'row' || kind === 'column' || kind === 'element' || kind === 'text' ||
|
|
48
48
|
node.is('[data-ge-container]');
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -143,7 +143,7 @@ $.fn.gridEditor.utilities.visibility = function(ge) {
|
|
|
143
143
|
name: 'visibility',
|
|
144
144
|
prefix: 'd',
|
|
145
145
|
values: ['none', 'block', 'flex'],
|
|
146
|
-
appliesTo: ['row', 'column', 'element', 'container'],
|
|
146
|
+
appliesTo: ['row', 'column', 'text', 'element', 'container'],
|
|
147
147
|
labelKey: 'utility.visibility',
|
|
148
148
|
|
|
149
149
|
/** Hidden, or shown the way this kind of node is shown. */
|
package/src/less/grideditor.less
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@colTextColor: darken(@colColor, 10%);
|
|
6
6
|
@elementColor: #7B5EA7;
|
|
7
7
|
@elementTextColor: darken(@elementColor, 5%);
|
|
8
|
+
@textColor: #5A6F8A;
|
|
9
|
+
@textTextColor: darken(@textColor, 5%);
|
|
8
10
|
@containerColor: #1D8A5E;
|
|
9
11
|
@containerTextColor: darken(@containerColor, 5%);
|
|
10
12
|
|
|
@@ -549,6 +551,38 @@
|
|
|
549
551
|
}
|
|
550
552
|
}
|
|
551
553
|
|
|
554
|
+
/* A text block: a content area and, beside it rather than inside,
|
|
555
|
+
where the text editor would take it, its drawer */
|
|
556
|
+
.ge-text-block {
|
|
557
|
+
position: relative;
|
|
558
|
+
outline: 1px dashed fadeout(@textColor, 40%);
|
|
559
|
+
margin-bottom: @editGutter;
|
|
560
|
+
|
|
561
|
+
> .ge-text-drawer {
|
|
562
|
+
background: fadeout(@textColor, 88%);
|
|
563
|
+
|
|
564
|
+
> a {
|
|
565
|
+
color: @textTextColor;
|
|
566
|
+
padding: 2px 5px;
|
|
567
|
+
}
|
|
568
|
+
> a.ge-text-info {
|
|
569
|
+
cursor: default;
|
|
570
|
+
}
|
|
571
|
+
> a.ge-text-missing {
|
|
572
|
+
color: #b02a37;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/* A column with nothing in it but its drawer still has room to drop a
|
|
578
|
+
block into */
|
|
579
|
+
.column:not(:has(> :not(.ge-tools-drawer, .ge-resize-handle)))::after {
|
|
580
|
+
content: '';
|
|
581
|
+
display: block;
|
|
582
|
+
min-height: 40px;
|
|
583
|
+
border: 1px dashed fadeout(@colColor, 50%);
|
|
584
|
+
}
|
|
585
|
+
|
|
552
586
|
/* Sorting. The dragged node stays in the list and shows where it would
|
|
553
587
|
land - that is the placeholder - while a copy of it follows the
|
|
554
588
|
pointer. */
|