@nascentdigital/funnel-editor 6.1.7 → 6.1.9
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/dist/core/components/interaction/Popup.js +0 -2
- package/dist/core/domain/Block.d.ts +2 -1
- package/dist/core/domain/Block.js +3 -0
- package/dist/core/domain/BlockConfiguration.d.ts +3 -2
- package/dist/core/domain/BlockConfiguration.js +13 -4
- package/dist/page/components/config/BlockConfigButton.js +2 -1
- package/dist/styles/index.css +8 -8
- package/package.json +2 -2
|
@@ -59,7 +59,6 @@ function Popup(_a) {
|
|
|
59
59
|
// handle escape
|
|
60
60
|
if (e.key === 'Escape') {
|
|
61
61
|
// stop propagation
|
|
62
|
-
e.preventDefault();
|
|
63
62
|
e.stopPropagation();
|
|
64
63
|
// close if open
|
|
65
64
|
if (openRef.current) {
|
|
@@ -102,7 +101,6 @@ function Popup(_a) {
|
|
|
102
101
|
const onGuardClick = (e) => {
|
|
103
102
|
// stop propagation
|
|
104
103
|
e.stopPropagation();
|
|
105
|
-
e.preventDefault();
|
|
106
104
|
if (onClick) {
|
|
107
105
|
onClick(e);
|
|
108
106
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Field, FieldModel, Schema } from '@nascentdigital/funnel-core';
|
|
1
|
+
import { Field, FieldModel, Logger, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { StringKeyOf } from 'type-fest';
|
|
3
3
|
import { BlockConfiguration } from './BlockConfiguration';
|
|
4
4
|
import { ItemBase } from './ItemBase';
|
|
5
5
|
import ParentContext = ItemBase.ParentContext;
|
|
6
6
|
export declare class Block<TBlock extends Block.SchemaType = Block.SchemaType> extends ItemBase<Block<TBlock>> {
|
|
7
|
+
readonly log: Logger;
|
|
7
8
|
readonly schema: TBlock;
|
|
8
9
|
readonly config: ReadonlyArray<FieldModel.Config>;
|
|
9
10
|
readonly fields: ReadonlyArray<FieldModel>;
|
|
@@ -12,6 +12,7 @@ class Block extends ItemBase_1.ItemBase {
|
|
|
12
12
|
// construct base
|
|
13
13
|
super(args);
|
|
14
14
|
// initialize instance variables
|
|
15
|
+
this.log = funnel_core_1.Logger.get('editor:page:block');
|
|
15
16
|
this.schema = args.schema;
|
|
16
17
|
this.config = args.config;
|
|
17
18
|
this.fields = args.fields;
|
|
@@ -303,9 +304,11 @@ class Block extends ItemBase_1.ItemBase {
|
|
|
303
304
|
// call base
|
|
304
305
|
super.onActivate();
|
|
305
306
|
this._modifiedOn = Date.now();
|
|
307
|
+
this.log.d('onActivate - activating block');
|
|
306
308
|
// apply default content if specified
|
|
307
309
|
const { defaultContent } = this.schema;
|
|
308
310
|
if (defaultContent) {
|
|
311
|
+
this.log.d('onActivate - applying default content', defaultContent);
|
|
309
312
|
// opt into array of fields
|
|
310
313
|
if (Array.isArray(defaultContent)) {
|
|
311
314
|
for (const fieldId of defaultContent) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { BlockLayout, EventBus, Field, FieldModel, Schema } from '@nascentdigital/funnel-core';
|
|
1
|
+
import { BlockLayout, EventBus, Field, FieldModel, Logger, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { ListPanel, MessagePanel, PanelLayout, SlotVariation, VisualPanel } from '@nascentdigital/funnel-ui';
|
|
3
3
|
import { Block } from './Block';
|
|
4
4
|
import { IAssetStore } from './IAssetStore';
|
|
5
5
|
import { ICollectionStore } from './ICollectionStore';
|
|
6
6
|
import { SectionBlock } from './SectionBlock';
|
|
7
7
|
export declare class BlockConfiguration {
|
|
8
|
+
readonly log: Logger;
|
|
8
9
|
readonly eventBus: EventBus;
|
|
9
10
|
readonly assetStore: IAssetStore;
|
|
10
11
|
readonly collectionStore: ICollectionStore;
|
|
@@ -49,7 +50,7 @@ export declare class BlockConfiguration {
|
|
|
49
50
|
save(): void;
|
|
50
51
|
resetToDefault(): void;
|
|
51
52
|
get isConfigInDefault(): boolean | undefined;
|
|
52
|
-
|
|
53
|
+
setPanelLayout(layout: PanelLayout): void;
|
|
53
54
|
sync(): void;
|
|
54
55
|
reset(): void;
|
|
55
56
|
private setConfigValues;
|
|
@@ -9,6 +9,7 @@ const SectionBlock_1 = require("./SectionBlock");
|
|
|
9
9
|
class BlockConfiguration {
|
|
10
10
|
constructor({ block: blockOrSectionBlock, assetStore, collectionStore }) {
|
|
11
11
|
// initialize core fields
|
|
12
|
+
this.log = funnel_core_1.Logger.get('editor:page:blockConfig');
|
|
12
13
|
this.eventBus = new funnel_core_1.EventBus();
|
|
13
14
|
this.assetStore = assetStore;
|
|
14
15
|
this.collectionStore = collectionStore;
|
|
@@ -398,39 +399,47 @@ class BlockConfiguration {
|
|
|
398
399
|
get isConfigInDefault() {
|
|
399
400
|
return this._isConfigInDefault;
|
|
400
401
|
}
|
|
401
|
-
|
|
402
|
-
var _a;
|
|
402
|
+
setPanelLayout(layout) {
|
|
403
|
+
var _a, _b;
|
|
403
404
|
// bail if no layout field (shouldn't happen)
|
|
404
|
-
const { block, layoutField } = this;
|
|
405
|
+
const { log, block, layoutField } = this;
|
|
405
406
|
if (!layoutField) {
|
|
407
|
+
log.w('setPanelLayout - no layout field exists', layout);
|
|
406
408
|
return;
|
|
407
409
|
}
|
|
408
410
|
// bail if no change in layout
|
|
409
411
|
const previousLayout = (_a = layoutField.value) === null || _a === void 0 ? void 0 : _a.value;
|
|
410
412
|
if (previousLayout === layout) {
|
|
413
|
+
log.v('setPanelLayout - layout is unchanged', layout);
|
|
411
414
|
return;
|
|
412
415
|
}
|
|
416
|
+
log.d('setPanelLayout - changing layout', { from: (_b = layoutField.value) === null || _b === void 0 ? void 0 : _b.value, to: layout });
|
|
413
417
|
// update layout if different
|
|
414
418
|
layoutField.value = funnel_core_1.Schema.EnumField.Value.toData(layout);
|
|
415
419
|
// throw if this isn't a paneled layout (shouldn't happen)
|
|
416
420
|
const { schema } = block;
|
|
417
421
|
if (!(schema instanceof funnel_core_1.Schema.PanelledBlock)) {
|
|
422
|
+
log.e('setPanelLayout - cannot set layout on non-PanelledBlock');
|
|
418
423
|
throw new funnel_core_1.InvalidOperationError('Cannot set layout on non-PanelledBlock instance');
|
|
419
424
|
}
|
|
420
425
|
// finish here if no layout change
|
|
421
426
|
if (!schema.defaultLayoutConfigs) {
|
|
427
|
+
log.v('setPanelLayout - skipping, no layout config to evaluate');
|
|
422
428
|
return;
|
|
423
429
|
}
|
|
424
430
|
// set config for layout
|
|
425
431
|
const configForLayout = schema.defaultLayoutConfigs[layout];
|
|
426
432
|
if (configForLayout) {
|
|
433
|
+
log.d('setPanelLayout - applying default config for layout', configForLayout);
|
|
427
434
|
this.setConfigValues(configForLayout);
|
|
428
435
|
}
|
|
429
436
|
}
|
|
430
437
|
sync() {
|
|
431
438
|
var _a;
|
|
439
|
+
// resolve props
|
|
440
|
+
const { log, block, blockFieldData: fieldData, fields, editableFields } = this;
|
|
441
|
+
log.v('sync - starting sync for block');
|
|
432
442
|
// recompute the editable fields
|
|
433
|
-
const { block, blockFieldData: fieldData, fields, editableFields } = this;
|
|
434
443
|
const configData = editableFields.reduce((data, field) => {
|
|
435
444
|
data[field.id] = field.value;
|
|
436
445
|
// keep reducing
|
|
@@ -68,8 +68,9 @@ function BlockConfigButton({ target, anchorId: anchorOverrideId, children = 'Con
|
|
|
68
68
|
})),
|
|
69
69
|
selectedItem: layoutData === null || layoutData === void 0 ? void 0 : layoutData.value
|
|
70
70
|
}));
|
|
71
|
+
// update if there was a selection
|
|
71
72
|
if (selectedLayout) {
|
|
72
|
-
configuration.
|
|
73
|
+
configuration.setPanelLayout(selectedLayout);
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
// set variables
|
package/dist/styles/index.css
CHANGED
|
@@ -501,10 +501,10 @@ video {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
[popover]{
|
|
504
|
-
inset: var(--toolwind-toggle-
|
|
505
|
-
background-color: var(--toolwind-toggle-
|
|
506
|
-
color: var(--toolwind-toggle-
|
|
507
|
-
margin: var(--toolwind-toggle-
|
|
504
|
+
inset: var(--toolwind-toggle-UbXIq9VuRW, 0px);
|
|
505
|
+
background-color: var(--toolwind-toggle-PiZ7gFhJ3L, canvas);
|
|
506
|
+
color: var(--toolwind-toggle-HDTdGb80s0, canvastext);
|
|
507
|
+
margin: var(--toolwind-toggle-Fqnd2sQ6u0, auto);
|
|
508
508
|
}
|
|
509
509
|
html, body, #__next, #root, .Editor-wrap{
|
|
510
510
|
position: relative;
|
|
@@ -6214,10 +6214,10 @@ img.nd-Visual-image {
|
|
|
6214
6214
|
.anchored\/\[--nd-popup-anchor\]:where(.anchored\/\[--nd-popup-anchor\]){
|
|
6215
6215
|
position: absolute;
|
|
6216
6216
|
view-transition-name: --tw-anchor-view-transition-2j1919322s193433343934192p322r2w33362l;
|
|
6217
|
-
--toolwind-toggle-
|
|
6218
|
-
--toolwind-toggle-
|
|
6219
|
-
--toolwind-toggle-
|
|
6220
|
-
--toolwind-toggle-
|
|
6217
|
+
--toolwind-toggle-UbXIq9VuRW: auto;
|
|
6218
|
+
--toolwind-toggle-PiZ7gFhJ3L: transparent;
|
|
6219
|
+
--toolwind-toggle-HDTdGb80s0: inherit;
|
|
6220
|
+
--toolwind-toggle-Fqnd2sQ6u0: 0px;
|
|
6221
6221
|
}
|
|
6222
6222
|
.counter-l1{
|
|
6223
6223
|
counter-reset: l1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-editor",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"ts-jest": "^29",
|
|
93
93
|
"type-fest": "^4"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "83ecdaec850b6acd417f60a890e4a62c6534da12"
|
|
96
96
|
}
|