@themarioga/grid-editor 7.3.0 → 8.0.0-beta.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.
- package/CHANGELOG.md +76 -0
- package/README.md +34 -30
- package/UPGRADING.md +55 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +72 -6
- package/dist/grideditor.d.ts +24 -3
- package/dist/grideditor.esm.js +7 -58
- package/dist/grideditor.jquery.js +0 -13
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +3 -3
- package/dist/grideditor.js +7 -58
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +30 -6
- package/dist/locales/grideditor.es.js +30 -6
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.esm.js +11 -38
- package/dist/plugins/grideditor.alignment.js +11 -38
- package/dist/plugins/grideditor.alignment.min.js +1 -1
- package/dist/plugins/grideditor.alignment.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
- package/dist/plugins/grideditor.ckeditor.js +0 -5
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +2 -2
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.style.esm.js +393 -60
- package/dist/plugins/grideditor.style.js +387 -56
- package/dist/plugins/grideditor.style.min.js +4 -2
- package/dist/plugins/grideditor.style.min.js.map +4 -4
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.esm.js +274 -6
- package/dist/plugins/grideditor.tabs.js +274 -6
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/dist/plugins/grideditor.tinymce.esm.js +1 -8
- package/dist/plugins/grideditor.tinymce.js +1 -8
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +4 -6
- package/docs/locale-keys.md +35 -13
- package/docs/plugins.md +15 -35
- package/example/ckeditor.html +0 -5
- package/example/containers.html +64 -2
- package/example/index.html +5 -4
- package/example/style.html +16 -4
- package/example/utilities.html +12 -11
- package/package.json +1 -1
- package/src/js/dom.js +1 -2
- package/src/js/grideditor.jquery.js +7 -28
- package/src/js/grideditor.js +12 -81
- package/src/js/locales/grideditor.es.js +30 -6
- package/src/js/plugins/grideditor.alignment.js +21 -50
- package/src/js/plugins/grideditor.ckeditor.js +10 -23
- package/src/js/plugins/grideditor.style.js +18 -12
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tabs.js +311 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +14 -3
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/style/float.js +2 -4
- package/src/js/style/options.js +5 -20
- package/src/js/style/sections.js +42 -15
- package/src/js/style/spacing.js +2 -4
- package/src/js/style/sticky.js +39 -0
- package/src/js/style/textalign.js +2 -4
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +68 -10
- package/types/grideditor.d.ts +24 -3
- package/dist/plugins/grideditor.float.esm.js +0 -43
- package/dist/plugins/grideditor.float.js +0 -47
- package/dist/plugins/grideditor.float.min.js +0 -1
- package/dist/plugins/grideditor.float.min.js.map +0 -7
- package/dist/plugins/grideditor.spacing.esm.js +0 -327
- package/dist/plugins/grideditor.spacing.js +0 -329
- package/dist/plugins/grideditor.spacing.min.js +0 -1
- package/dist/plugins/grideditor.spacing.min.js.map +0 -7
- package/dist/plugins/grideditor.textalign.esm.js +0 -49
- package/dist/plugins/grideditor.textalign.js +0 -53
- package/dist/plugins/grideditor.textalign.min.js +0 -1
- package/dist/plugins/grideditor.textalign.min.js.map +0 -7
- package/dist/plugins/grideditor.visibility.esm.js +0 -167
- package/dist/plugins/grideditor.visibility.js +0 -169
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.float.js +0 -29
- package/src/js/plugins/grideditor.spacing.js +0 -31
- package/src/js/plugins/grideditor.textalign.js +0 -27
- package/src/js/plugins/grideditor.visibility.js +0 -32
- package/src/js/style/visibility.js +0 -160
package/dist/grideditor.css
CHANGED
|
@@ -401,6 +401,13 @@
|
|
|
401
401
|
--bs-popover-max-width: 360px;
|
|
402
402
|
width: 360px;
|
|
403
403
|
max-width: calc(100vw - 16px);
|
|
404
|
+
/* Bootstrap's css leaves the arrow's position to Popper, which puts it on
|
|
405
|
+
as an inline style. Without it the arrow stays in the flow, a strip as
|
|
406
|
+
tall as the arrow above the header; out of it, the top or bottom of
|
|
407
|
+
.bs-popover-bottom and .bs-popover-top hang it outside the edge */
|
|
408
|
+
}
|
|
409
|
+
.ge-settings-popover > .popover-arrow {
|
|
410
|
+
position: absolute;
|
|
404
411
|
}
|
|
405
412
|
.ge-settings-popover > .popover-header {
|
|
406
413
|
display: flex;
|
|
@@ -430,6 +437,12 @@
|
|
|
430
437
|
beside the content areas, and each of its panes is an ordinary region */
|
|
431
438
|
/* A pane's own drawer is small and sits with its label rather than
|
|
432
439
|
above it: a tab strip is a row of tabs, not a stack of them */
|
|
440
|
+
/* A tabs container laid out vertically from a breakpoint: Bootstrap's
|
|
441
|
+
classes answer to the window, and a breakpoint view narrows the canvas
|
|
442
|
+
instead, so the tabs plugin says which layout the view has and that is
|
|
443
|
+
what shows. The selectors outweigh Bootstrap's !important utilities.
|
|
444
|
+
Vertical, the container wraps, so its drawer is a line of its own
|
|
445
|
+
above the strip and the panes */
|
|
433
446
|
/* The label is edited in place, so it needs to look like it can be */
|
|
434
447
|
/* Open and closed while editing is what the page will ship, which is what
|
|
435
448
|
data-ge-open says. Bootstrap's own collapse is not involved: its
|
|
@@ -632,6 +645,25 @@
|
|
|
632
645
|
.ge-canvas.ge-editing .ge-tab .nav-link {
|
|
633
646
|
padding-left: 4px;
|
|
634
647
|
}
|
|
648
|
+
.ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] {
|
|
649
|
+
display: flex !important;
|
|
650
|
+
flex-wrap: wrap;
|
|
651
|
+
align-items: flex-start !important;
|
|
652
|
+
}
|
|
653
|
+
.ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] > .ge-container-drawer {
|
|
654
|
+
flex-shrink: 0;
|
|
655
|
+
}
|
|
656
|
+
.ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] > .nav {
|
|
657
|
+
flex-direction: column !important;
|
|
658
|
+
margin-right: 1rem !important;
|
|
659
|
+
}
|
|
660
|
+
.ge-canvas.ge-editing [data-ge-tabs-layout="horizontal"] {
|
|
661
|
+
display: block !important;
|
|
662
|
+
}
|
|
663
|
+
.ge-canvas.ge-editing [data-ge-tabs-layout="horizontal"] > .nav {
|
|
664
|
+
flex-direction: row !important;
|
|
665
|
+
margin-right: 0 !important;
|
|
666
|
+
}
|
|
635
667
|
.ge-canvas.ge-editing .ge-pane-label:hover {
|
|
636
668
|
outline: 1px dotted #197550;
|
|
637
669
|
}
|
|
@@ -4583,20 +4615,35 @@
|
|
|
4583
4615
|
margin-left: 91.66666667%;
|
|
4584
4616
|
}
|
|
4585
4617
|
/*
|
|
4586
|
-
* The
|
|
4587
|
-
* there would be nothing left to click to show it again - and shown
|
|
4588
|
-
*
|
|
4589
|
-
* which are !important too.
|
|
4618
|
+
* The style plugin's display. A node Bootstrap would hide is kept on the
|
|
4619
|
+
* canvas - there would be nothing left to click to show it again - and shown
|
|
4620
|
+
* as it would be if it were not hidden, which data-ge-display says. The
|
|
4621
|
+
* selectors outweigh Bootstrap's d-* classes, which are !important too.
|
|
4590
4622
|
*/
|
|
4591
4623
|
.ge-canvas.ge-editing {
|
|
4592
4624
|
/* The all view: hidden at some breakpoints, said in a corner */
|
|
4593
4625
|
}
|
|
4594
|
-
.ge-canvas.ge-editing
|
|
4626
|
+
.ge-canvas.ge-editing [data-ge-display="inline"] {
|
|
4627
|
+
display: inline !important;
|
|
4628
|
+
}
|
|
4629
|
+
.ge-canvas.ge-editing [data-ge-display="inline-block"] {
|
|
4630
|
+
display: inline-block !important;
|
|
4631
|
+
}
|
|
4632
|
+
.ge-canvas.ge-editing [data-ge-display="block"] {
|
|
4595
4633
|
display: block !important;
|
|
4596
4634
|
}
|
|
4597
|
-
.ge-canvas.ge-editing
|
|
4635
|
+
.ge-canvas.ge-editing [data-ge-display="grid"] {
|
|
4636
|
+
display: grid !important;
|
|
4637
|
+
}
|
|
4638
|
+
.ge-canvas.ge-editing [data-ge-display="inline-grid"] {
|
|
4639
|
+
display: inline-grid !important;
|
|
4640
|
+
}
|
|
4641
|
+
.ge-canvas.ge-editing [data-ge-display="flex"] {
|
|
4598
4642
|
display: flex !important;
|
|
4599
4643
|
}
|
|
4644
|
+
.ge-canvas.ge-editing [data-ge-display="inline-flex"] {
|
|
4645
|
+
display: inline-flex !important;
|
|
4646
|
+
}
|
|
4600
4647
|
.ge-canvas.ge-editing .ge-hidden-in-view {
|
|
4601
4648
|
opacity: 0.45;
|
|
4602
4649
|
background-image: repeating-linear-gradient(-45deg, transparent 0, transparent 6px, rgba(0, 0, 0, 0.07) 6px, rgba(0, 0, 0, 0.07) 12px);
|
|
@@ -4618,6 +4665,25 @@
|
|
|
4618
4665
|
line-height: 16px;
|
|
4619
4666
|
pointer-events: none;
|
|
4620
4667
|
}
|
|
4668
|
+
/*
|
|
4669
|
+
* The style plugin's drawer on a flex or grid node: out of the flow, on top
|
|
4670
|
+
* and as wide as the node, over a transparent top border as tall as it is.
|
|
4671
|
+
* The border's width comes with the node's data-ge-drawer-out, from a rule
|
|
4672
|
+
* per height the plugin writes. The selectors outweigh Bootstrap's border
|
|
4673
|
+
* classes and the drawer's own margins, which the spacing part sets inline.
|
|
4674
|
+
*/
|
|
4675
|
+
.ge-canvas.ge-editing .ge-drawer-out {
|
|
4676
|
+
position: relative;
|
|
4677
|
+
border-top-style: solid !important;
|
|
4678
|
+
border-top-color: transparent !important;
|
|
4679
|
+
}
|
|
4680
|
+
.ge-canvas.ge-editing .ge-drawer-out > .ge-tools-drawer {
|
|
4681
|
+
position: absolute;
|
|
4682
|
+
left: 0;
|
|
4683
|
+
right: 0;
|
|
4684
|
+
width: auto !important;
|
|
4685
|
+
margin: 0 !important;
|
|
4686
|
+
}
|
|
4621
4687
|
/* The order plugin: a column ordered by class in this view says where */
|
|
4622
4688
|
.ge-canvas.ge-editing .column[data-ge-order]::before {
|
|
4623
4689
|
content: attr(data-ge-order);
|
package/dist/grideditor.d.ts
CHANGED
|
@@ -54,18 +54,36 @@ export interface PresetClass {
|
|
|
54
54
|
|
|
55
55
|
/** A content filter: run on init and deinit with the canvas. A string names a function on window. */
|
|
56
56
|
/** A section of the style plugin's accordion. */
|
|
57
|
-
export type StyleSectionKey = 'size' | 'spacing' | 'border' | 'background' | 'text' | 'typography' | 'display' | 'position' | 'custom';
|
|
57
|
+
export type StyleSectionKey = 'size' | 'spacing' | 'border' | 'background' | 'text' | 'typography' | 'display' | 'flex' | 'position' | 'custom';
|
|
58
58
|
|
|
59
59
|
/** A section on or off, or on with some of its properties and without its catalog. */
|
|
60
60
|
export type StyleSection = boolean | { properties?: string[]; catalog?: boolean };
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* A tabs container's variant: its strip's style, width and alignment, and
|
|
64
|
+
* whether it is laid out vertically - always, or from a breakpoint up.
|
|
65
|
+
*/
|
|
66
|
+
export interface TabsOptions {
|
|
67
|
+
variant?: 'tabs' | 'pills' | 'underline';
|
|
68
|
+
width?: 'natural' | 'fill' | 'justified';
|
|
69
|
+
/** Only with the natural width, and horizontal. */
|
|
70
|
+
align?: 'start' | 'center' | 'end';
|
|
71
|
+
vertical?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** createContainer('tabs', …): how many tabs, their labels, and the variant. */
|
|
75
|
+
export interface CreateTabsOptions extends Placement, TabsOptions {
|
|
76
|
+
tabs?: number;
|
|
77
|
+
labels?: string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
/** The style plugin's settings. */
|
|
63
81
|
export interface StyleOptions {
|
|
64
82
|
/** Every section is on unless it is turned off here. */
|
|
65
83
|
sections?: Partial<Record<StyleSectionKey, StyleSection>>;
|
|
66
|
-
/**
|
|
84
|
+
/** The spacing section: the values offered, and what 0 to 5 come to - for the gaps too. */
|
|
67
85
|
spacing?: { values?: string[]; scale?: string[] };
|
|
68
|
-
/**
|
|
86
|
+
/** The eye that hides and shows a node, the display family's: false leaves it out of the drawers. */
|
|
69
87
|
visibility?: { drawer?: boolean };
|
|
70
88
|
}
|
|
71
89
|
|
|
@@ -97,6 +115,8 @@ export interface GridEditorOptions {
|
|
|
97
115
|
utilities?: Record<string, unknown>;
|
|
98
116
|
/** The style plugin's sections, and the options of the utilities it carries. */
|
|
99
117
|
style?: StyleOptions;
|
|
118
|
+
/** The tabs plugin: the variant of the tabs containers made new. */
|
|
119
|
+
tabs?: TabsOptions;
|
|
100
120
|
elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean };
|
|
101
121
|
custom_filter?: CustomFilter | CustomFilter[] | '';
|
|
102
122
|
valid_col_sizes?: ColumnSize[];
|
|
@@ -328,6 +348,7 @@ export declare class GridEditor {
|
|
|
328
348
|
createText(options: CreateTextOptions): HTMLElement | null;
|
|
329
349
|
createElement(content: string | Node | ArrayLike<Node>, options?: CreateElementOptions): HTMLElement | null;
|
|
330
350
|
createSection(options?: CreateSectionOptions): HTMLElement | null;
|
|
351
|
+
createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
|
|
331
352
|
createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
|
|
332
353
|
addTab(container: Target, options?: PaneOptions): HTMLElement | null;
|
|
333
354
|
addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;
|
package/dist/grideditor.esm.js
CHANGED
|
@@ -341,7 +341,6 @@ var ALL_VIEW_LABEL_KEY = "view.all";
|
|
|
341
341
|
var VIEW_KEYS = [ALL_VIEW].concat(BREAKPOINTS.map(function(tier) {
|
|
342
342
|
return tier.key;
|
|
343
343
|
}));
|
|
344
|
-
var LEGACY_VIEW_INDEXES = ["lg", "sm", "xs"];
|
|
345
344
|
var MAX_COL_SIZE = 12;
|
|
346
345
|
var MAX_COL_OFFSET = 11;
|
|
347
346
|
var FLEX_SIZES = ["equal", "auto"];
|
|
@@ -414,10 +413,6 @@ var NESTED_SETTINGS = {
|
|
|
414
413
|
// Scroll the page when a drag reaches its edge
|
|
415
414
|
}
|
|
416
415
|
};
|
|
417
|
-
var REMOVED_SETTINGS = {
|
|
418
|
-
sortable_options: "drag",
|
|
419
|
-
resizable_options: "resize"
|
|
420
|
-
};
|
|
421
416
|
var warned = {};
|
|
422
417
|
var editorCounter = 0;
|
|
423
418
|
var instances = /* @__PURE__ */ new WeakMap();
|
|
@@ -571,7 +566,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
571
566
|
"element_classes": [],
|
|
572
567
|
// Preset class toggles on an element's settings panel
|
|
573
568
|
// content_types, text_tools and text_classes are the text editor
|
|
574
|
-
// plugins' settings
|
|
569
|
+
// plugins' settings: see grideditor.text.js
|
|
575
570
|
"container_classes": [],
|
|
576
571
|
// The same, on a container's panel
|
|
577
572
|
"pane_classes": [],
|
|
@@ -619,14 +614,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
619
614
|
Object.keys(NESTED_SETTINGS).forEach(function(name) {
|
|
620
615
|
settings[name] = Object.assign({}, NESTED_SETTINGS[name], settings[name]);
|
|
621
616
|
});
|
|
622
|
-
Object.keys(REMOVED_SETTINGS).forEach(function(name) {
|
|
623
|
-
if (optionsOrMethod && optionsOrMethod[name] !== void 0) {
|
|
624
|
-
warn(translate(settings, "warning.setting_removed", {
|
|
625
|
-
setting: name,
|
|
626
|
-
replacement: REMOVED_SETTINGS[name]
|
|
627
|
-
}));
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
617
|
var canvas, mainControls, wrapper, addRowGroup, addContainerGroup, layoutDropdown, htmlTextArea;
|
|
631
618
|
var curView = settings.default_view;
|
|
632
619
|
var confirmDialog = null;
|
|
@@ -1689,53 +1676,25 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1689
1676
|
if (settings.row_cols !== false) {
|
|
1690
1677
|
registerFamily("grid", {}, rowColsFamily());
|
|
1691
1678
|
}
|
|
1692
|
-
var replacedBy = {};
|
|
1693
|
-
[GridEditor.containers, GridEditor.features, GridEditor.utilities].forEach(function(registry) {
|
|
1694
|
-
Object.keys(registry).forEach(function(name) {
|
|
1695
|
-
(registry[name].replaces || []).forEach(function(old) {
|
|
1696
|
-
if (!replacedBy[old]) {
|
|
1697
|
-
replacedBy[old] = name;
|
|
1698
|
-
}
|
|
1699
|
-
});
|
|
1700
|
-
});
|
|
1701
|
-
});
|
|
1702
|
-
var named = function(name) {
|
|
1703
|
-
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1704
|
-
};
|
|
1705
|
-
var namedAsOld = function(name) {
|
|
1706
|
-
return !!settings.plugins && settings.plugins.some(function(old) {
|
|
1707
|
-
return replacedBy[old] === name;
|
|
1708
|
-
});
|
|
1709
|
-
};
|
|
1710
|
-
var standsDown = function(name) {
|
|
1711
|
-
return !!replacedBy[name] && wanted(replacedBy[name]);
|
|
1712
|
-
};
|
|
1713
1679
|
var wanted = function(name) {
|
|
1714
|
-
return !
|
|
1715
|
-
};
|
|
1716
|
-
var replaced = function(name) {
|
|
1717
|
-
if (!standsDown(name) || !named(name)) {
|
|
1718
|
-
return false;
|
|
1719
|
-
}
|
|
1720
|
-
warnOnceHere("replaced:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '", which is loaded: ignoring it');
|
|
1721
|
-
return true;
|
|
1680
|
+
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1722
1681
|
};
|
|
1723
1682
|
var featureWanted = function(name, factory) {
|
|
1724
1683
|
return factory.always === true || wanted(name);
|
|
1725
1684
|
};
|
|
1726
1685
|
Object.keys(GridEditor.containers).forEach(function(type) {
|
|
1727
|
-
if (
|
|
1686
|
+
if (wanted(type)) {
|
|
1728
1687
|
CONTAINERS[type] = GridEditor.containers[type](api);
|
|
1729
1688
|
}
|
|
1730
1689
|
});
|
|
1731
1690
|
Object.keys(GridEditor.features).forEach(function(name) {
|
|
1732
1691
|
var factory = GridEditor.features[name];
|
|
1733
|
-
if (
|
|
1692
|
+
if (featureWanted(name, factory)) {
|
|
1734
1693
|
FEATURES[name] = factory(api);
|
|
1735
1694
|
}
|
|
1736
1695
|
});
|
|
1737
1696
|
Object.keys(GridEditor.utilities).forEach(function(name) {
|
|
1738
|
-
if (
|
|
1697
|
+
if (!wanted(name)) {
|
|
1739
1698
|
return;
|
|
1740
1699
|
}
|
|
1741
1700
|
UTILITIES[name] = GridEditor.utilities[name](api);
|
|
@@ -1753,10 +1712,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1753
1712
|
if (CONTAINERS[name] || FEATURES[name] || UTILITIES[name]) {
|
|
1754
1713
|
return;
|
|
1755
1714
|
}
|
|
1756
|
-
if (standsDown(name)) {
|
|
1757
|
-
warnOnceHere("renamed:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '" now: name "' + replacedBy[name] + '" in the plugins setting instead');
|
|
1758
|
-
return;
|
|
1759
|
-
}
|
|
1760
1715
|
warnOnceHere("plugin:" + name, 'the "' + name + '" plugin is not loaded: include dist/plugins/grideditor.' + name + ".js after the editor");
|
|
1761
1716
|
});
|
|
1762
1717
|
}
|
|
@@ -4038,10 +3993,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
4038
3993
|
one(layoutDropdown, "button").textContent = t(labelKeyFor(view));
|
|
4039
3994
|
}
|
|
4040
3995
|
function viewKey(view) {
|
|
4041
|
-
if (typeof view == "number") {
|
|
4042
|
-
warnOnceHere("changeView-index", "changeView(" + view + "): layout modes are identified by breakpoint key now, so pass one of " + JSON.stringify(VIEW_KEYS) + ". Numeric indexes still work, but they mean what they meant in 2.x (" + LEGACY_VIEW_INDEXES.join(", ") + ") and will be dropped.");
|
|
4043
|
-
return LEGACY_VIEW_INDEXES[view] || null;
|
|
4044
|
-
}
|
|
4045
3996
|
return VIEW_KEYS.indexOf(view) === -1 ? null : view;
|
|
4046
3997
|
}
|
|
4047
3998
|
function changeView(view) {
|
|
@@ -4149,7 +4100,7 @@ GridEditor.t = translate;
|
|
|
4149
4100
|
GridEditor._plainHtml = plainHtml;
|
|
4150
4101
|
GridEditor.Sortable = null;
|
|
4151
4102
|
GridEditor.bootstrap = null;
|
|
4152
|
-
GridEditor.version = false ? "dev" : "
|
|
4103
|
+
GridEditor.version = false ? "dev" : "8.0.0-beta.3";
|
|
4153
4104
|
GridEditor.locales = {
|
|
4154
4105
|
en: {
|
|
4155
4106
|
"tool.move": "Move",
|
|
@@ -4219,14 +4170,12 @@ GridEditor.locales = {
|
|
|
4219
4170
|
"utility.inherit": "Inherit: {value} (from {breakpoint})",
|
|
4220
4171
|
"utility.varies": "Changes at {breakpoints}; choosing here replaces that",
|
|
4221
4172
|
"error.sortable_missing": "SortableJS not available! Make sure you loaded the Sortable js file; dragging is off without it.",
|
|
4222
|
-
"warning.setting_removed": "The {setting} setting was removed in 4.0. Use {replacement} instead.",
|
|
4223
4173
|
"warning.already_editing": "This element already has an editor: that one is handed back, with the options it was made with.",
|
|
4224
4174
|
"warning.destroyed": "{method}() was called on an editor that has been destroyed, and does nothing.",
|
|
4225
4175
|
"warning.duplicate_build": "grideditor.js was loaded twice: the first GridEditor is kept.",
|
|
4226
|
-
"warning.plugin_6x": 'The "{name}" plugin is written for grid-editor 6 and is not loaded. Plugins register on GridEditor since 7.0: see UPGRADING.md.',
|
|
4227
4176
|
"warning.adapter_no_jquery": "grideditor.jquery.js needs jQuery 4, and there is no jQuery on the page: the jQuery API is not there.",
|
|
4228
4177
|
"error.tinymce_missing": "tinyMCE not available! Make sure you loaded the tinyMCE js file.",
|
|
4229
|
-
"error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file
|
|
4178
|
+
"error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file.",
|
|
4230
4179
|
"error.summernote_missing": "Summernote not available! Make sure you loaded jQuery and the Summernote js file."
|
|
4231
4180
|
}
|
|
4232
4181
|
};
|
|
@@ -192,13 +192,6 @@
|
|
|
192
192
|
return result;
|
|
193
193
|
};
|
|
194
194
|
});
|
|
195
|
-
function warnAboutLegacyPlugins() {
|
|
196
|
-
["containers", "features", "utilities", "texts"].forEach(function(registry) {
|
|
197
|
-
Object.keys(legacy[registry]).forEach(function(name) {
|
|
198
|
-
warnOnce("plugin-6x:" + registry + ":" + name, english("warning.plugin_6x", { name }));
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
195
|
function dispatchMethod(set, name, args) {
|
|
203
196
|
var descriptor = METHODS[name];
|
|
204
197
|
if (!descriptor) {
|
|
@@ -235,18 +228,12 @@
|
|
|
235
228
|
if (typeof optionsOrMethod == "string") {
|
|
236
229
|
return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));
|
|
237
230
|
}
|
|
238
|
-
warnAboutLegacyPlugins();
|
|
239
231
|
var options = adaptOptions(optionsOrMethod);
|
|
240
232
|
this.each(function() {
|
|
241
233
|
GridEditor.create(this, options);
|
|
242
234
|
});
|
|
243
235
|
return this;
|
|
244
236
|
};
|
|
245
|
-
var legacy = { containers: {}, features: {}, utilities: {}, texts: {} };
|
|
246
|
-
$.fn.gridEditor.containers = legacy.containers;
|
|
247
|
-
$.fn.gridEditor.features = legacy.features;
|
|
248
|
-
$.fn.gridEditor.utilities = legacy.utilities;
|
|
249
|
-
$.fn.gridEditor.texts = legacy.texts;
|
|
250
237
|
$.fn.gridEditor.locales = GridEditor.locales;
|
|
251
238
|
$.fn.gridEditor.t = GridEditor.t;
|
|
252
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var u=window.GridEditor;if(!u||typeof u.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");var
|
|
1
|
+
(()=>{var u=window.GridEditor;if(!u||typeof u.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");var i=window.jQuery,x=function(c,a){return u.t({locale:"en"},c,a)},m={};function b(c,a){m[c]||(m[c]=!0,window.console&&window.console.warn&&window.console.warn("grid-editor: "+a))}!i||!i.fn?b("no-jquery",x("warning.adapter_no_jquery")):T();function T(){var c={getHtml:{value:!0},getPlainHtml:{value:!0},init:{},deinit:{},reset:{},destroy:{},changeView:{},getView:{value:!0},createRow:{value:!0},createColumn:{value:!0},createElement:{value:!0},createText:{value:!0},createSection:{value:!0},createContainer:{value:!0},addTab:{value:!0},addAccordionItem:{value:!0},setLocale:{},getUtility:{value:!0},setUtility:{value:!0}},a=["row_tools","col_tools","element_tools","container_tools","tab_tools","accordion_tools","text_tools"];function g(r){return!!r&&r.nodeType===1}function l(r){return r instanceof i?r[0]||null:r}function h(r){if(r instanceof i)return l(r);if(r&&typeof r=="object"&&!Array.isArray(r)&&!g(r)){var t={};return Object.keys(r).forEach(function(e){t[e]=l(r[e])}),t}return r}function w(r){return g(r)?i(r):r}var s=new WeakMap;function p(r){if(!r||typeof r!="object")return r;if(s.has(r))return s.get(r);var t=Object.assign({},r);return["node","parent","canvas"].forEach(function(e){e in r&&(t[e]=i(r[e]||[]))}),r.container&&(t.container=i(r.container)),Array.isArray(r.nodes)&&(t.node=i(r.nodes)),["from","to"].forEach(function(e){var n=r[e];n&&typeof n=="object"&&"parent"in n&&(t[e]=Object.assign({},n,{parent:i(n.parent||[])}))}),s.set(r,t),t}var y=i.event.dispatch;i.event.dispatch=function(r){return arguments.length===1&&r instanceof window.CustomEvent&&typeof r.type=="string"&&r.type.indexOf("grideditor:")===0?y.call(this,r,p(r.detail)):y.apply(this,arguments)};function v(r){return function(t){return r.call(this,i.event.fix(t))}}function _(r){if(!r||!r.on)return r;var t;return typeof r.on=="function"?t=v(r.on):(t={},Object.keys(r.on).forEach(function(e){t[e]=v(r.on[e])})),Object.assign({},r,{on:t})}function j(r){return function(t,e){var n=typeof r=="string"?window[r]:r;return n(i(t),e)}}function E(r){if(r=Object.assign({},r||{}),r.callbacks){var t={};Object.keys(r.callbacks).forEach(function(n){var o=r.callbacks[n];t[n]=typeof o=="function"?function(f){return o(p(f))}:o}),r.callbacks=t}if(r.custom_filter&&r.custom_filter.length){var e=typeof r.custom_filter=="string"||typeof r.custom_filter=="function"?[r.custom_filter]:Array.prototype.slice.call(r.custom_filter);r.custom_filter=e.map(j)}return a.forEach(function(n){Array.isArray(r[n])&&(r[n]=r[n].map(_))}),r.source_textarea=l(r.source_textarea),r}function O(r){var t={canvas:i(r.canvas)};return Object.keys(c).forEach(function(e){t[e]=function(){var n=r[e].apply(r,Array.prototype.map.call(arguments,h));return n===r?void 0:w(n)}}),Object.defineProperty(t,"settings",{enumerable:!0,get:function(){return r.settings}}),t}u._created.push(function(r){i.data(r.canvas,"grideditor",O(r));var t=r.destroy;r.destroy=function(){var e=t.apply(this,arguments);return i.removeData(r.canvas,"grideditor"),e}});function A(r,t,e){var n=c[t];if(!n)return b("method:"+t,'unknown method "'+t+'"'),r;if(e=e.map(h),n.value){var o=r.first();if(!o.length)return null;var f=u.get(o[0]);return f?w(f[t].apply(f,e)):t==="getHtml"?o.html():t==="getPlainHtml"?u._plainHtml(o.html()):null}return r.each(function(){var d=u.get(this);d&&d[t].apply(d,e)}),r}i.fn.gridEditor=function(r){if(typeof r=="string")return A(this,r,Array.prototype.slice.call(arguments,1));var t=E(r);return this.each(function(){u.create(this,t)}),this},i.fn.gridEditor.locales=u.locales,i.fn.gridEditor.t=u.t}})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/js/register.js", "../src/js/grideditor.jquery.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The jQuery API of grid-editor 6, on top of the 7.0 editor.\n *\n * grid-editor is plain DOM since 7.0. A page written for 6.x - one that\n * calls $(el).gridEditor(...), listens with $(el).on('grideditor:...') and\n * reads jQuery objects out of the payloads - loads jQuery 4 and this file\n * after grideditor.js, and runs unchanged:\n *\n * <script src=\"jquery.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/grideditor.jquery.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.tabs.min.js\"></script>\n *\n * What it keeps is the host's side of 6.x. Plugins are not: a plugin\n * written for 6.x registered on $.fn.gridEditor.containers, .features,\n * .utilities or .texts, and is warned about and left out, since the plugin\n * contract hands out elements now. UPGRADING.md says how to port one.\n *\n * Every value 6.x gave host code as a jQuery object is one again: the event\n * payloads and the callbacks' arguments, what the create* methods return,\n * the handle $(el).data('grideditor') gives, the canvas custom_filter gets,\n * and the event a host tool's handler gets. What the host hands in may be a\n * jQuery object wherever 6.x took one.\n */\nimport { GridEditor } from './grideditor.js';\n\nvar $ = window.jQuery;\n\nvar english = function(key, params) { return GridEditor.t({ locale: 'en' }, key, params); };\n\nvar warned = {};\n\nfunction warnOnce(key, message) {\n if (warned[key]) { return; }\n warned[key] = true;\n if (window.console && window.console.warn) { window.console.warn('grid-editor: ' + message); }\n}\n\nif (!$ || !$.fn) {\n warnOnce('no-jquery', english('warning.adapter_no_jquery'));\n} else {\n install();\n}\n\nfunction install() {\n\n /**\n * Every method 6.x dispatched, and which hand back something other than\n * the jQuery set: those run against the first element only, and do not\n * chain.\n */\n var METHODS = {\n getHtml: { value: true },\n getPlainHtml: { value: true },\n init: {},\n deinit: {},\n reset: {},\n destroy: {},\n changeView: {},\n getView: { value: true },\n createRow: { value: true },\n createColumn: { value: true },\n createElement: { value: true },\n createText: { value: true },\n createSection: { value: true },\n createContainer: { value: true },\n addTab: { value: true },\n addAccordionItem: { value: true },\n setLocale: {},\n getUtility: { value: true },\n setUtility: { value: true },\n };\n\n /** The *_tools settings, whose handlers 6.x bound with jQuery. */\n var TOOL_SETTINGS = ['row_tools', 'col_tools', 'element_tools', 'container_tools',\n 'tab_tools', 'accordion_tools', 'text_tools'];\n\n function isElement(value) {\n return !!value && value.nodeType === 1;\n }\n\n /** What the host handed in, as the editor takes it: a jQuery object is its first element. */\n function unwrap(value) {\n if (value instanceof $) { return value[0] || null; }\n return value;\n }\n\n /** An argument, and the options object an argument may be, unwrapped one level down. */\n function unwrapArgument(value) {\n if (value instanceof $) { return unwrap(value); }\n\n if (value && typeof value === 'object' && !Array.isArray(value) && !isElement(value)) {\n var copy = {};\n Object.keys(value).forEach(function(key) { copy[key] = unwrap(value[key]); });\n return copy;\n }\n\n return value;\n }\n\n /** What the editor handed back, as 6.x did: an element is a jQuery object. */\n function wrapResult(value) {\n return isElement(value) ? $(value) : value;\n }\n\n /**\n * A payload as 6.x built it: its nodes jQuery objects, and an empty set\n * where there is no node - a detached node's parent. The same payload\n * wraps to the same object, so every listener of one notification sees\n * one payload, as they did.\n */\n var wrappedPayloads = new WeakMap();\n\n function wrapPayload(payload) {\n if (!payload || typeof payload !== 'object') { return payload; }\n if (wrappedPayloads.has(payload)) { return wrappedPayloads.get(payload); }\n\n var copy = Object.assign({}, payload);\n\n ['node', 'parent', 'canvas'].forEach(function(key) {\n if (key in payload) { copy[key] = $(payload[key] || []); }\n });\n if (payload.container) { copy.container = $(payload.container); }\n // edit-html writes any number of nodes, which 6.x gave as one set\n if (Array.isArray(payload.nodes)) { copy.node = $(payload.nodes); }\n ['from', 'to'].forEach(function(key) {\n var position = payload[key];\n if (position && typeof position === 'object' && 'parent' in position) {\n copy[key] = Object.assign({}, position, { parent: $(position.parent || []) });\n }\n });\n\n wrappedPayloads.set(payload, copy);\n return copy;\n }\n\n /**\n * The events, as jQuery handlers had them: (event, payload).\n *\n * The editor dispatches DOM events, which jQuery hands its handlers with\n * no second argument. Its dispatcher is where every one of them passes,\n * delegated ones too, so that is where the payload goes back in: once,\n * for each handler, and preventDefault() on the jQuery event is\n * preventDefault() on the editor's.\n */\n var dispatch = $.event.dispatch;\n $.event.dispatch = function(nativeEvent) {\n if (arguments.length === 1 && nativeEvent instanceof window.CustomEvent &&\n typeof nativeEvent.type === 'string' && nativeEvent.type.indexOf('grideditor:') === 0) {\n return dispatch.call(this, nativeEvent, wrapPayload(nativeEvent.detail));\n }\n\n return dispatch.apply(this, arguments);\n };\n\n /** A handler of a host's tool, given a jQuery event as 6.x gave it. */\n function jqueryHandler(handler) {\n return function(event) {\n return handler.call(this, $.event.fix(event));\n };\n }\n\n function adaptTool(tool) {\n if (!tool || !tool.on) { return tool; }\n\n var on;\n if (typeof tool.on === 'function') {\n on = jqueryHandler(tool.on);\n } else {\n on = {};\n Object.keys(tool.on).forEach(function(name) { on[name] = jqueryHandler(tool.on[name]); });\n }\n\n return Object.assign({}, tool, { on: on });\n }\n\n /** A custom_filter, as a function of a jQuery canvas; a name is looked up when it runs. */\n function adaptFilter(filter) {\n return function(canvas, isInit) {\n var func = typeof filter === 'string' ? window[filter] : filter;\n return func($(canvas), isInit);\n };\n }\n\n /** The host's 6.x options, as the editor takes them. */\n function adaptOptions(options) {\n options = Object.assign({}, options || {});\n\n if (options.callbacks) {\n var callbacks = {};\n Object.keys(options.callbacks).forEach(function(name) {\n var callback = options.callbacks[name];\n callbacks[name] = typeof callback === 'function'\n ? function(payload) { return callback(wrapPayload(payload)); }\n : callback;\n });\n options.callbacks = callbacks;\n }\n\n if (options.custom_filter && options.custom_filter.length) {\n var filters = typeof options.custom_filter === 'string' || typeof options.custom_filter === 'function'\n ? [options.custom_filter]\n : Array.prototype.slice.call(options.custom_filter);\n options.custom_filter = filters.map(adaptFilter);\n }\n\n TOOL_SETTINGS.forEach(function(name) {\n if (Array.isArray(options[name])) { options[name] = options[name].map(adaptTool); }\n });\n\n options.source_textarea = unwrap(options.source_textarea);\n\n return options;\n }\n\n /**\n * The handle $(el).data('grideditor') gave in 6.x: the same methods, with\n * jQuery going in and coming out, and the canvas as a jQuery object.\n */\n function handleFor(instance) {\n var handle = { canvas: $(instance.canvas) };\n\n Object.keys(METHODS).forEach(function(name) {\n handle[name] = function() {\n var result = instance[name].apply(instance, Array.prototype.map.call(arguments, unwrapArgument));\n return result === instance ? undefined : wrapResult(result);\n };\n });\n\n Object.defineProperty(handle, 'settings', {\n enumerable: true,\n get: function() { return instance.settings; },\n });\n\n return handle;\n }\n\n /**\n * Every editor gets its 6.x handle, whoever made it: $(el).gridEditor()\n * or new GridEditor(el). It goes with the editor.\n */\n GridEditor._created.push(function(instance) {\n $.data(instance.canvas, 'grideditor', handleFor(instance));\n\n var destroy = instance.destroy;\n instance.destroy = function() {\n var result = destroy.apply(this, arguments);\n $.removeData(instance.canvas, 'grideditor');\n return result;\n };\n });\n\n /** Plugins registered the 6.x way: said once each, and never called. */\n function warnAboutLegacyPlugins() {\n ['containers', 'features', 'utilities', 'texts'].forEach(function(registry) {\n Object.keys(legacy[registry]).forEach(function(name) {\n warnOnce('plugin-6x:' + registry + ':' + name, english('warning.plugin_6x', { name: name }));\n });\n });\n }\n\n function dispatchMethod(set, name, args) {\n var descriptor = METHODS[name];\n\n if (!descriptor) {\n warnOnce('method:' + name, 'unknown method \"' + name + '\"');\n return set;\n }\n\n args = args.map(unwrapArgument);\n\n if (descriptor.value) {\n var element = set.first();\n if (!element.length) { return null; }\n\n var instance = GridEditor.get(element[0]);\n if (!instance) {\n if (name === 'getHtml') { return element.html(); }\n if (name === 'getPlainHtml') { return GridEditor._plainHtml(element.html()); }\n return null;\n }\n\n return wrapResult(instance[name].apply(instance, args));\n }\n\n set.each(function() {\n var found = GridEditor.get(this);\n if (found) { found[name].apply(found, args); }\n });\n\n return set;\n }\n\n /**\n * $(el).gridEditor(options): an editor on each element that has none.\n * $(el).gridEditor('method', ...): a method, 6.x style.\n */\n $.fn.gridEditor = function(optionsOrMethod) {\n if (typeof optionsOrMethod == 'string') {\n return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));\n }\n\n warnAboutLegacyPlugins();\n\n var options = adaptOptions(optionsOrMethod);\n\n this.each(function() {\n GridEditor.create(this, options);\n });\n\n return this;\n };\n\n // Where a 6.x plugin registers. Kept, so one does not throw as it\n // loads, and read only to say it is not used.\n var legacy = { containers: {}, features: {}, utilities: {}, texts: {} };\n $.fn.gridEditor.containers = legacy.containers;\n $.fn.gridEditor.features = legacy.features;\n $.fn.gridEditor.utilities = legacy.utilities;\n $.fn.gridEditor.texts = legacy.texts;\n\n // Strings are the same thing in both: a 6.x locale file loads unchanged\n $.fn.gridEditor.locales = GridEditor.locales;\n $.fn.gridEditor.t = GridEditor.t;\n}\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,
|
|
6
|
-
"names": ["GridEditor", "$", "english", "key", "params", "GridEditor", "warned", "warnOnce", "message", "install", "METHODS", "TOOL_SETTINGS", "isElement", "value", "unwrap", "unwrapArgument", "copy", "wrapResult", "wrappedPayloads", "wrapPayload", "payload", "position", "dispatch", "nativeEvent", "jqueryHandler", "handler", "event", "adaptTool", "tool", "on", "name", "adaptFilter", "filter", "canvas", "isInit", "func", "adaptOptions", "options", "callbacks", "callback", "filters", "handleFor", "instance", "handle", "result", "destroy", "
|
|
4
|
+
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The jQuery API of grid-editor 6, on top of the plain DOM editor.\n *\n * A page written for 6.x - one that calls $(el).gridEditor(...), listens\n * with $(el).on('grideditor:...') and reads jQuery objects out of the\n * payloads - loads jQuery 4 and this file after grideditor.js, and runs\n * unchanged:\n *\n * <script src=\"jquery.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/grideditor.jquery.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.tabs.min.js\"></script>\n *\n * What it keeps is the host's side of 6.x. Plugins are not: they register\n * on GridEditor, and the plugin contract hands out elements.\n *\n * Every value 6.x gave host code as a jQuery object is one again: the event\n * payloads and the callbacks' arguments, what the create* methods return,\n * the handle $(el).data('grideditor') gives, the canvas custom_filter gets,\n * and the event a host tool's handler gets. What the host hands in may be a\n * jQuery object wherever 6.x took one.\n */\nimport { GridEditor } from './grideditor.js';\n\nvar $ = window.jQuery;\n\nvar english = function(key, params) { return GridEditor.t({ locale: 'en' }, key, params); };\n\nvar warned = {};\n\nfunction warnOnce(key, message) {\n if (warned[key]) { return; }\n warned[key] = true;\n if (window.console && window.console.warn) { window.console.warn('grid-editor: ' + message); }\n}\n\nif (!$ || !$.fn) {\n warnOnce('no-jquery', english('warning.adapter_no_jquery'));\n} else {\n install();\n}\n\nfunction install() {\n\n /**\n * Every method 6.x dispatched, and which hand back something other than\n * the jQuery set: those run against the first element only, and do not\n * chain.\n */\n var METHODS = {\n getHtml: { value: true },\n getPlainHtml: { value: true },\n init: {},\n deinit: {},\n reset: {},\n destroy: {},\n changeView: {},\n getView: { value: true },\n createRow: { value: true },\n createColumn: { value: true },\n createElement: { value: true },\n createText: { value: true },\n createSection: { value: true },\n createContainer: { value: true },\n addTab: { value: true },\n addAccordionItem: { value: true },\n setLocale: {},\n getUtility: { value: true },\n setUtility: { value: true },\n };\n\n /** The *_tools settings, whose handlers 6.x bound with jQuery. */\n var TOOL_SETTINGS = ['row_tools', 'col_tools', 'element_tools', 'container_tools',\n 'tab_tools', 'accordion_tools', 'text_tools'];\n\n function isElement(value) {\n return !!value && value.nodeType === 1;\n }\n\n /** What the host handed in, as the editor takes it: a jQuery object is its first element. */\n function unwrap(value) {\n if (value instanceof $) { return value[0] || null; }\n return value;\n }\n\n /** An argument, and the options object an argument may be, unwrapped one level down. */\n function unwrapArgument(value) {\n if (value instanceof $) { return unwrap(value); }\n\n if (value && typeof value === 'object' && !Array.isArray(value) && !isElement(value)) {\n var copy = {};\n Object.keys(value).forEach(function(key) { copy[key] = unwrap(value[key]); });\n return copy;\n }\n\n return value;\n }\n\n /** What the editor handed back, as 6.x did: an element is a jQuery object. */\n function wrapResult(value) {\n return isElement(value) ? $(value) : value;\n }\n\n /**\n * A payload as 6.x built it: its nodes jQuery objects, and an empty set\n * where there is no node - a detached node's parent. The same payload\n * wraps to the same object, so every listener of one notification sees\n * one payload, as they did.\n */\n var wrappedPayloads = new WeakMap();\n\n function wrapPayload(payload) {\n if (!payload || typeof payload !== 'object') { return payload; }\n if (wrappedPayloads.has(payload)) { return wrappedPayloads.get(payload); }\n\n var copy = Object.assign({}, payload);\n\n ['node', 'parent', 'canvas'].forEach(function(key) {\n if (key in payload) { copy[key] = $(payload[key] || []); }\n });\n if (payload.container) { copy.container = $(payload.container); }\n // edit-html writes any number of nodes, which 6.x gave as one set\n if (Array.isArray(payload.nodes)) { copy.node = $(payload.nodes); }\n ['from', 'to'].forEach(function(key) {\n var position = payload[key];\n if (position && typeof position === 'object' && 'parent' in position) {\n copy[key] = Object.assign({}, position, { parent: $(position.parent || []) });\n }\n });\n\n wrappedPayloads.set(payload, copy);\n return copy;\n }\n\n /**\n * The events, as jQuery handlers had them: (event, payload).\n *\n * The editor dispatches DOM events, which jQuery hands its handlers with\n * no second argument. Its dispatcher is where every one of them passes,\n * delegated ones too, so that is where the payload goes back in: once,\n * for each handler, and preventDefault() on the jQuery event is\n * preventDefault() on the editor's.\n */\n var dispatch = $.event.dispatch;\n $.event.dispatch = function(nativeEvent) {\n if (arguments.length === 1 && nativeEvent instanceof window.CustomEvent &&\n typeof nativeEvent.type === 'string' && nativeEvent.type.indexOf('grideditor:') === 0) {\n return dispatch.call(this, nativeEvent, wrapPayload(nativeEvent.detail));\n }\n\n return dispatch.apply(this, arguments);\n };\n\n /** A handler of a host's tool, given a jQuery event as 6.x gave it. */\n function jqueryHandler(handler) {\n return function(event) {\n return handler.call(this, $.event.fix(event));\n };\n }\n\n function adaptTool(tool) {\n if (!tool || !tool.on) { return tool; }\n\n var on;\n if (typeof tool.on === 'function') {\n on = jqueryHandler(tool.on);\n } else {\n on = {};\n Object.keys(tool.on).forEach(function(name) { on[name] = jqueryHandler(tool.on[name]); });\n }\n\n return Object.assign({}, tool, { on: on });\n }\n\n /** A custom_filter, as a function of a jQuery canvas; a name is looked up when it runs. */\n function adaptFilter(filter) {\n return function(canvas, isInit) {\n var func = typeof filter === 'string' ? window[filter] : filter;\n return func($(canvas), isInit);\n };\n }\n\n /** The host's 6.x options, as the editor takes them. */\n function adaptOptions(options) {\n options = Object.assign({}, options || {});\n\n if (options.callbacks) {\n var callbacks = {};\n Object.keys(options.callbacks).forEach(function(name) {\n var callback = options.callbacks[name];\n callbacks[name] = typeof callback === 'function'\n ? function(payload) { return callback(wrapPayload(payload)); }\n : callback;\n });\n options.callbacks = callbacks;\n }\n\n if (options.custom_filter && options.custom_filter.length) {\n var filters = typeof options.custom_filter === 'string' || typeof options.custom_filter === 'function'\n ? [options.custom_filter]\n : Array.prototype.slice.call(options.custom_filter);\n options.custom_filter = filters.map(adaptFilter);\n }\n\n TOOL_SETTINGS.forEach(function(name) {\n if (Array.isArray(options[name])) { options[name] = options[name].map(adaptTool); }\n });\n\n options.source_textarea = unwrap(options.source_textarea);\n\n return options;\n }\n\n /**\n * The handle $(el).data('grideditor') gave in 6.x: the same methods, with\n * jQuery going in and coming out, and the canvas as a jQuery object.\n */\n function handleFor(instance) {\n var handle = { canvas: $(instance.canvas) };\n\n Object.keys(METHODS).forEach(function(name) {\n handle[name] = function() {\n var result = instance[name].apply(instance, Array.prototype.map.call(arguments, unwrapArgument));\n return result === instance ? undefined : wrapResult(result);\n };\n });\n\n Object.defineProperty(handle, 'settings', {\n enumerable: true,\n get: function() { return instance.settings; },\n });\n\n return handle;\n }\n\n /**\n * Every editor gets its 6.x handle, whoever made it: $(el).gridEditor()\n * or new GridEditor(el). It goes with the editor.\n */\n GridEditor._created.push(function(instance) {\n $.data(instance.canvas, 'grideditor', handleFor(instance));\n\n var destroy = instance.destroy;\n instance.destroy = function() {\n var result = destroy.apply(this, arguments);\n $.removeData(instance.canvas, 'grideditor');\n return result;\n };\n });\n\n function dispatchMethod(set, name, args) {\n var descriptor = METHODS[name];\n\n if (!descriptor) {\n warnOnce('method:' + name, 'unknown method \"' + name + '\"');\n return set;\n }\n\n args = args.map(unwrapArgument);\n\n if (descriptor.value) {\n var element = set.first();\n if (!element.length) { return null; }\n\n var instance = GridEditor.get(element[0]);\n if (!instance) {\n if (name === 'getHtml') { return element.html(); }\n if (name === 'getPlainHtml') { return GridEditor._plainHtml(element.html()); }\n return null;\n }\n\n return wrapResult(instance[name].apply(instance, args));\n }\n\n set.each(function() {\n var found = GridEditor.get(this);\n if (found) { found[name].apply(found, args); }\n });\n\n return set;\n }\n\n /**\n * $(el).gridEditor(options): an editor on each element that has none.\n * $(el).gridEditor('method', ...): a method, 6.x style.\n */\n $.fn.gridEditor = function(optionsOrMethod) {\n if (typeof optionsOrMethod == 'string') {\n return dispatchMethod(this, optionsOrMethod, Array.prototype.slice.call(arguments, 1));\n }\n\n var options = adaptOptions(optionsOrMethod);\n\n this.each(function() {\n GridEditor.create(this, options);\n });\n\n return this;\n };\n\n // Strings are the same thing in both: a 6.x locale file loads unchanged\n $.fn.gridEditor.locales = GridEditor.locales;\n $.fn.gridEditor.t = GridEditor.t;\n}\n"],
|
|
5
|
+
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECW9C,IAAIC,EAAI,OAAO,OAEXC,EAAU,SAASC,EAAKC,EAAQ,CAAE,OAAOC,EAAW,EAAE,CAAE,OAAQ,IAAK,EAAGF,EAAKC,CAAM,CAAG,EAEtFE,EAAS,CAAC,EAEd,SAASC,EAASJ,EAAKK,EAAS,CACxBF,EAAOH,CAAG,IACdG,EAAOH,CAAG,EAAI,GACV,OAAO,SAAW,OAAO,QAAQ,MAAQ,OAAO,QAAQ,KAAK,gBAAkBK,CAAO,EAC9F,CAEI,CAACP,GAAK,CAACA,EAAE,GACTM,EAAS,YAAaL,E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WrC,EAAW,IAAI6C,EAAQ,CAAC,CAAC,EACxC,OAAKR,EAMEzB,EAAWyB,EAASZ,CAAI,EAAE,MAAMY,EAAUM,CAAI,CAAC,EAL9ClB,IAAS,UAAoBoB,EAAQ,KAAK,EAC1CpB,IAAS,eAAyBzB,EAAW,WAAW6C,EAAQ,KAAK,CAAC,EACnE,IAIf,CAEA,OAAAH,EAAI,KAAK,UAAW,CAChB,IAAII,EAAQ9C,EAAW,IAAI,IAAI,EAC3B8C,GAASA,EAAMrB,CAAI,EAAE,MAAMqB,EAAOH,CAAI,CAC9C,CAAC,EAEMD,CACX,CAMA9C,EAAE,GAAG,WAAa,SAASmD,EAAiB,CACxC,GAAI,OAAOA,GAAmB,SAC1B,OAAON,EAAe,KAAMM,EAAiB,MAAM,UAAU,MAAM,KAAK,UAAW,CAAC,CAAC,EAGzF,IAAIf,EAAUD,EAAagB,CAAe,EAE1C,YAAK,KAAK,UAAW,CACjB/C,EAAW,OAAO,KAAMgC,CAAO,CACnC,CAAC,EAEM,IACX,EAGApC,EAAE,GAAG,WAAW,QAAUI,EAAW,QACrCJ,EAAE,GAAG,WAAW,EAAII,EAAW,CACnC",
|
|
6
|
+
"names": ["GridEditor", "$", "english", "key", "params", "GridEditor", "warned", "warnOnce", "message", "install", "METHODS", "TOOL_SETTINGS", "isElement", "value", "unwrap", "unwrapArgument", "copy", "wrapResult", "wrappedPayloads", "wrapPayload", "payload", "position", "dispatch", "nativeEvent", "jqueryHandler", "handler", "event", "adaptTool", "tool", "on", "name", "adaptFilter", "filter", "canvas", "isInit", "func", "adaptOptions", "options", "callbacks", "callback", "filters", "handleFor", "instance", "handle", "result", "destroy", "dispatchMethod", "set", "args", "descriptor", "element", "found", "optionsOrMethod"]
|
|
7
7
|
}
|
package/dist/grideditor.js
CHANGED
|
@@ -342,7 +342,6 @@
|
|
|
342
342
|
var VIEW_KEYS = [ALL_VIEW].concat(BREAKPOINTS.map(function(tier) {
|
|
343
343
|
return tier.key;
|
|
344
344
|
}));
|
|
345
|
-
var LEGACY_VIEW_INDEXES = ["lg", "sm", "xs"];
|
|
346
345
|
var MAX_COL_SIZE = 12;
|
|
347
346
|
var MAX_COL_OFFSET = 11;
|
|
348
347
|
var FLEX_SIZES = ["equal", "auto"];
|
|
@@ -415,10 +414,6 @@
|
|
|
415
414
|
// Scroll the page when a drag reaches its edge
|
|
416
415
|
}
|
|
417
416
|
};
|
|
418
|
-
var REMOVED_SETTINGS = {
|
|
419
|
-
sortable_options: "drag",
|
|
420
|
-
resizable_options: "resize"
|
|
421
|
-
};
|
|
422
417
|
var warned = {};
|
|
423
418
|
var editorCounter = 0;
|
|
424
419
|
var instances = /* @__PURE__ */ new WeakMap();
|
|
@@ -572,7 +567,7 @@
|
|
|
572
567
|
"element_classes": [],
|
|
573
568
|
// Preset class toggles on an element's settings panel
|
|
574
569
|
// content_types, text_tools and text_classes are the text editor
|
|
575
|
-
// plugins' settings
|
|
570
|
+
// plugins' settings: see grideditor.text.js
|
|
576
571
|
"container_classes": [],
|
|
577
572
|
// The same, on a container's panel
|
|
578
573
|
"pane_classes": [],
|
|
@@ -620,14 +615,6 @@
|
|
|
620
615
|
Object.keys(NESTED_SETTINGS).forEach(function(name) {
|
|
621
616
|
settings[name] = Object.assign({}, NESTED_SETTINGS[name], settings[name]);
|
|
622
617
|
});
|
|
623
|
-
Object.keys(REMOVED_SETTINGS).forEach(function(name) {
|
|
624
|
-
if (optionsOrMethod && optionsOrMethod[name] !== void 0) {
|
|
625
|
-
warn(translate(settings, "warning.setting_removed", {
|
|
626
|
-
setting: name,
|
|
627
|
-
replacement: REMOVED_SETTINGS[name]
|
|
628
|
-
}));
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
618
|
var canvas, mainControls, wrapper, addRowGroup, addContainerGroup, layoutDropdown, htmlTextArea;
|
|
632
619
|
var curView = settings.default_view;
|
|
633
620
|
var confirmDialog = null;
|
|
@@ -1690,53 +1677,25 @@
|
|
|
1690
1677
|
if (settings.row_cols !== false) {
|
|
1691
1678
|
registerFamily("grid", {}, rowColsFamily());
|
|
1692
1679
|
}
|
|
1693
|
-
var replacedBy = {};
|
|
1694
|
-
[GridEditor.containers, GridEditor.features, GridEditor.utilities].forEach(function(registry) {
|
|
1695
|
-
Object.keys(registry).forEach(function(name) {
|
|
1696
|
-
(registry[name].replaces || []).forEach(function(old) {
|
|
1697
|
-
if (!replacedBy[old]) {
|
|
1698
|
-
replacedBy[old] = name;
|
|
1699
|
-
}
|
|
1700
|
-
});
|
|
1701
|
-
});
|
|
1702
|
-
});
|
|
1703
|
-
var named = function(name) {
|
|
1704
|
-
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1705
|
-
};
|
|
1706
|
-
var namedAsOld = function(name) {
|
|
1707
|
-
return !!settings.plugins && settings.plugins.some(function(old) {
|
|
1708
|
-
return replacedBy[old] === name;
|
|
1709
|
-
});
|
|
1710
|
-
};
|
|
1711
|
-
var standsDown = function(name) {
|
|
1712
|
-
return !!replacedBy[name] && wanted(replacedBy[name]);
|
|
1713
|
-
};
|
|
1714
1680
|
var wanted = function(name) {
|
|
1715
|
-
return !
|
|
1716
|
-
};
|
|
1717
|
-
var replaced = function(name) {
|
|
1718
|
-
if (!standsDown(name) || !named(name)) {
|
|
1719
|
-
return false;
|
|
1720
|
-
}
|
|
1721
|
-
warnOnceHere("replaced:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '", which is loaded: ignoring it');
|
|
1722
|
-
return true;
|
|
1681
|
+
return !settings.plugins || settings.plugins.indexOf(name) !== -1;
|
|
1723
1682
|
};
|
|
1724
1683
|
var featureWanted = function(name, factory) {
|
|
1725
1684
|
return factory.always === true || wanted(name);
|
|
1726
1685
|
};
|
|
1727
1686
|
Object.keys(GridEditor.containers).forEach(function(type) {
|
|
1728
|
-
if (
|
|
1687
|
+
if (wanted(type)) {
|
|
1729
1688
|
CONTAINERS[type] = GridEditor.containers[type](api);
|
|
1730
1689
|
}
|
|
1731
1690
|
});
|
|
1732
1691
|
Object.keys(GridEditor.features).forEach(function(name) {
|
|
1733
1692
|
var factory = GridEditor.features[name];
|
|
1734
|
-
if (
|
|
1693
|
+
if (featureWanted(name, factory)) {
|
|
1735
1694
|
FEATURES[name] = factory(api);
|
|
1736
1695
|
}
|
|
1737
1696
|
});
|
|
1738
1697
|
Object.keys(GridEditor.utilities).forEach(function(name) {
|
|
1739
|
-
if (
|
|
1698
|
+
if (!wanted(name)) {
|
|
1740
1699
|
return;
|
|
1741
1700
|
}
|
|
1742
1701
|
UTILITIES[name] = GridEditor.utilities[name](api);
|
|
@@ -1754,10 +1713,6 @@
|
|
|
1754
1713
|
if (CONTAINERS[name] || FEATURES[name] || UTILITIES[name]) {
|
|
1755
1714
|
return;
|
|
1756
1715
|
}
|
|
1757
|
-
if (standsDown(name)) {
|
|
1758
|
-
warnOnceHere("renamed:" + name, 'the "' + name + '" plugin is part of "' + replacedBy[name] + '" now: name "' + replacedBy[name] + '" in the plugins setting instead');
|
|
1759
|
-
return;
|
|
1760
|
-
}
|
|
1761
1716
|
warnOnceHere("plugin:" + name, 'the "' + name + '" plugin is not loaded: include dist/plugins/grideditor.' + name + ".js after the editor");
|
|
1762
1717
|
});
|
|
1763
1718
|
}
|
|
@@ -4039,10 +3994,6 @@
|
|
|
4039
3994
|
one(layoutDropdown, "button").textContent = t(labelKeyFor(view));
|
|
4040
3995
|
}
|
|
4041
3996
|
function viewKey(view) {
|
|
4042
|
-
if (typeof view == "number") {
|
|
4043
|
-
warnOnceHere("changeView-index", "changeView(" + view + "): layout modes are identified by breakpoint key now, so pass one of " + JSON.stringify(VIEW_KEYS) + ". Numeric indexes still work, but they mean what they meant in 2.x (" + LEGACY_VIEW_INDEXES.join(", ") + ") and will be dropped.");
|
|
4044
|
-
return LEGACY_VIEW_INDEXES[view] || null;
|
|
4045
|
-
}
|
|
4046
3997
|
return VIEW_KEYS.indexOf(view) === -1 ? null : view;
|
|
4047
3998
|
}
|
|
4048
3999
|
function changeView(view) {
|
|
@@ -4150,7 +4101,7 @@
|
|
|
4150
4101
|
GridEditor._plainHtml = plainHtml;
|
|
4151
4102
|
GridEditor.Sortable = null;
|
|
4152
4103
|
GridEditor.bootstrap = null;
|
|
4153
|
-
GridEditor.version = false ? "dev" : "
|
|
4104
|
+
GridEditor.version = false ? "dev" : "8.0.0-beta.3";
|
|
4154
4105
|
GridEditor.locales = {
|
|
4155
4106
|
en: {
|
|
4156
4107
|
"tool.move": "Move",
|
|
@@ -4220,14 +4171,12 @@
|
|
|
4220
4171
|
"utility.inherit": "Inherit: {value} (from {breakpoint})",
|
|
4221
4172
|
"utility.varies": "Changes at {breakpoints}; choosing here replaces that",
|
|
4222
4173
|
"error.sortable_missing": "SortableJS not available! Make sure you loaded the Sortable js file; dragging is off without it.",
|
|
4223
|
-
"warning.setting_removed": "The {setting} setting was removed in 4.0. Use {replacement} instead.",
|
|
4224
4174
|
"warning.already_editing": "This element already has an editor: that one is handed back, with the options it was made with.",
|
|
4225
4175
|
"warning.destroyed": "{method}() was called on an editor that has been destroyed, and does nothing.",
|
|
4226
4176
|
"warning.duplicate_build": "grideditor.js was loaded twice: the first GridEditor is kept.",
|
|
4227
|
-
"warning.plugin_6x": 'The "{name}" plugin is written for grid-editor 6 and is not loaded. Plugins register on GridEditor since 7.0: see UPGRADING.md.',
|
|
4228
4177
|
"warning.adapter_no_jquery": "grideditor.jquery.js needs jQuery 4, and there is no jQuery on the page: the jQuery API is not there.",
|
|
4229
4178
|
"error.tinymce_missing": "tinyMCE not available! Make sure you loaded the tinyMCE js file.",
|
|
4230
|
-
"error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file
|
|
4179
|
+
"error.ckeditor_missing": "CKEditor 5 not available! Make sure you loaded its ckeditor5.umd.js file.",
|
|
4231
4180
|
"error.summernote_missing": "Summernote not available! Make sure you loaded jQuery and the Summernote js file."
|
|
4232
4181
|
}
|
|
4233
4182
|
};
|