@innovastudio/contentbuilder 1.5.223 → 1.5.225
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/package.json +1 -1
- package/public/contentbuilder/contentbuilder.css +112 -7
- package/public/contentbuilder/contentbuilder.esm.js +682 -225
- package/public/contentbuilder/contentbuilder.min.js +5 -5
- package/public/contentbuilder/lang/en.js +3 -0
- package/public/contentbuilder/lang/fr.js +3 -0
- package/readme.txt +7 -1
|
@@ -9,6 +9,17 @@ function snippetInCategory(item, cat) {
|
|
|
9
9
|
|
|
10
10
|
// Snippets browser — renders directly in the editor's [data-cb-ui] modal (no iframe).
|
|
11
11
|
// Data is already loaded in the parent window by loadSnippets() as opts.snippetJSON.
|
|
12
|
+
// How many of the first categories show as tabs at this dialog width. The rest
|
|
13
|
+
// are reached from the All Categories list, which appears only when some are left.
|
|
14
|
+
const tabsForWidth = width => {
|
|
15
|
+
if (width > 1212) return 7;
|
|
16
|
+
if (width > 1070) return 6;
|
|
17
|
+
if (width > 940) return 5;
|
|
18
|
+
if (width > 700) return 4;
|
|
19
|
+
if (width > 555) return 3;
|
|
20
|
+
if (width > 415) return 2;
|
|
21
|
+
return 1;
|
|
22
|
+
};
|
|
12
23
|
class Snippets {
|
|
13
24
|
constructor(builder) {
|
|
14
25
|
this.builder = builder;
|
|
@@ -49,11 +60,137 @@ class Snippets {
|
|
|
49
60
|
const gridEl = modal.querySelector('.snippet-grid');
|
|
50
61
|
if (!tabsEl || !gridEl) return;
|
|
51
62
|
const cats = builder.opts.snippetCategories; // [[id,'Label'], …]
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
const content = modal.querySelector('.is-modal-content');
|
|
64
|
+
const allBtn = modal.querySelector('.snippet-cats-all');
|
|
65
|
+
const menu = modal.querySelector('.snippet-cats-menu');
|
|
66
|
+
const hasCat = (list, catId) => list.some(([id]) => id + '' === catId);
|
|
67
|
+
let current = builder.opts.defaultSnippetCategory + '';
|
|
68
|
+
let extra = null; // a category outside the row, shown as one more tab once picked
|
|
69
|
+
let tabCount = tabsForWidth(content.clientWidth);
|
|
70
|
+
let tabsScroll = null;
|
|
71
|
+
const renderTabs = () => {
|
|
72
|
+
const row = cats.slice(0, tabCount);
|
|
73
|
+
if (!hasCat(row, current)) extra = cats.find(([id]) => id + '' === current) || null;else if (extra && hasCat(row, extra[0] + '')) extra = null;
|
|
74
|
+
tabsEl.innerHTML = (extra ? row.concat([extra]) : row).map(([id, label]) => {
|
|
75
|
+
const on = id + '' === current;
|
|
76
|
+
return `<button type="button" role="tab" data-tab="${id}" aria-selected="${on ? 'true' : 'false'}" tabindex="${on ? '0' : '-1'}">${util.out(label)}</button>`;
|
|
77
|
+
}).join('');
|
|
78
|
+
|
|
79
|
+
// Shared, accessible tab kit (arrow keys, roving tabindex).
|
|
80
|
+
this.dom.accessibleTabs(tabsEl, tabId => {
|
|
81
|
+
current = tabId;
|
|
82
|
+
renderGrid(tabId);
|
|
83
|
+
});
|
|
84
|
+
allBtn.hidden = cats.length <= tabCount;
|
|
85
|
+
if (tabsScroll) tabsScroll.update();
|
|
86
|
+
};
|
|
87
|
+
const closeMenu = () => {
|
|
88
|
+
menu.hidden = true;
|
|
89
|
+
allBtn.setAttribute('aria-expanded', 'false');
|
|
90
|
+
};
|
|
91
|
+
const openMenu = () => {
|
|
92
|
+
menu.innerHTML = cats.map(([id, label]) => {
|
|
93
|
+
const on = id + '' === current;
|
|
94
|
+
return `<button type="button" data-cat="${id}"${on ? ' aria-current="true"' : ''}>${util.out(label)}</button>`;
|
|
95
|
+
}).join('');
|
|
96
|
+
menu.hidden = false;
|
|
97
|
+
allBtn.setAttribute('aria-expanded', 'true');
|
|
98
|
+
const box = content.getBoundingClientRect();
|
|
99
|
+
const btn = allBtn.getBoundingClientRect();
|
|
100
|
+
const top = btn.bottom - box.top + 4;
|
|
101
|
+
menu.style.top = top + 'px';
|
|
102
|
+
menu.style.maxHeight = box.height - top - 12 + 'px';
|
|
103
|
+
menu.style.left = Math.max(12, Math.min(btn.left - box.left, box.width - menu.offsetWidth - 12)) + 'px';
|
|
104
|
+
builder.toolbarKeys.openPanel(menu, {
|
|
105
|
+
label: util.out('All Categories'),
|
|
106
|
+
close: closeMenu
|
|
107
|
+
});
|
|
108
|
+
menu._opener = allBtn;
|
|
109
|
+
const selected = menu.querySelector('[aria-current]');
|
|
110
|
+
if (selected) selected.focus({
|
|
111
|
+
preventScroll: true
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// render() runs on every open: drop the previous open's listeners.
|
|
116
|
+
if (modal._snippetCatsCleanup) modal._snippetCatsCleanup();
|
|
117
|
+
const listeners = new AbortController();
|
|
118
|
+
const resize = new ResizeObserver(() => {
|
|
119
|
+
const count = tabsForWidth(content.clientWidth);
|
|
120
|
+
if (count === tabCount) return;
|
|
121
|
+
tabCount = count;
|
|
122
|
+
closeMenu();
|
|
123
|
+
const hadFocus = tabsEl.contains(document.activeElement);
|
|
124
|
+
renderTabs();
|
|
125
|
+
if (hadFocus) tabsEl.querySelector('[aria-selected="true"]').focus({
|
|
126
|
+
preventScroll: true
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
resize.observe(content);
|
|
130
|
+
modal._snippetCatsCleanup = () => {
|
|
131
|
+
listeners.abort();
|
|
132
|
+
resize.disconnect();
|
|
133
|
+
};
|
|
134
|
+
allBtn.addEventListener('click', () => {
|
|
135
|
+
if (menu.hidden) openMenu();else closeMenu();
|
|
136
|
+
}, {
|
|
137
|
+
signal: listeners.signal
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Keep Tab inside the dialog. The stops change with the category, so they
|
|
141
|
+
// are read on each press; the ones recorded when the dialog opened are stale.
|
|
142
|
+
modal.addEventListener('keydown', e => {
|
|
143
|
+
if (e.key !== 'Tab' || !menu.hidden) return;
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
const stops = Array.from(modal.querySelectorAll('button, [tabindex]')).filter(el => el.tabIndex === 0 && el.offsetParent !== null);
|
|
146
|
+
const i = stops.indexOf(document.activeElement);
|
|
147
|
+
let to = null;
|
|
148
|
+
if (e.shiftKey && i <= 0) to = stops[stops.length - 1];else if (!e.shiftKey && i === stops.length - 1) to = stops[0];
|
|
149
|
+
if (to) {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
to.focus();
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
capture: true,
|
|
155
|
+
signal: listeners.signal
|
|
156
|
+
});
|
|
157
|
+
allBtn.addEventListener('keydown', e => {
|
|
158
|
+
if (e.key !== 'ArrowDown' || !menu.hidden) return;
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
openMenu();
|
|
161
|
+
}, {
|
|
162
|
+
signal: listeners.signal
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// The list reads down its columns, so Up and Down step through it. Left,
|
|
166
|
+
// Right, Home, End, Tab and Escape come from the shared panel keys.
|
|
167
|
+
menu.addEventListener('keydown', e => {
|
|
168
|
+
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
const items = Array.from(menu.querySelectorAll('[data-cat]'));
|
|
171
|
+
const step = e.key === 'ArrowDown' ? 1 : -1;
|
|
172
|
+
items[(items.indexOf(document.activeElement) + step + items.length) % items.length].focus();
|
|
173
|
+
}, {
|
|
174
|
+
signal: listeners.signal
|
|
175
|
+
});
|
|
176
|
+
menu.addEventListener('click', e => {
|
|
177
|
+
const item = e.target.closest('[data-cat]');
|
|
178
|
+
if (!item) return;
|
|
179
|
+
current = item.getAttribute('data-cat');
|
|
180
|
+
closeMenu();
|
|
181
|
+
renderTabs();
|
|
182
|
+
renderGrid(current);
|
|
183
|
+
tabsEl.querySelector('[aria-selected="true"]').focus({
|
|
184
|
+
preventScroll: true
|
|
185
|
+
});
|
|
186
|
+
}, {
|
|
187
|
+
signal: listeners.signal
|
|
188
|
+
});
|
|
189
|
+
modal.addEventListener('click', e => {
|
|
190
|
+
if (!menu.hidden && !menu.contains(e.target) && !allBtn.contains(e.target)) closeMenu();
|
|
191
|
+
}, {
|
|
192
|
+
signal: listeners.signal
|
|
193
|
+
});
|
|
57
194
|
const renderGrid = catId => {
|
|
58
195
|
catId = catId + '';
|
|
59
196
|
gridEl.innerHTML = '';
|
|
@@ -77,11 +214,10 @@ class Snippets {
|
|
|
77
214
|
gridEl.appendChild(frag);
|
|
78
215
|
gridEl.scrollTop = 0;
|
|
79
216
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.dom.
|
|
83
|
-
|
|
84
|
-
renderGrid(defaultCat);
|
|
217
|
+
closeMenu();
|
|
218
|
+
renderTabs();
|
|
219
|
+
tabsScroll = this.dom.scrollableTabs(modal.querySelector('.cb-tabs-scroller'));
|
|
220
|
+
renderGrid(current);
|
|
85
221
|
}
|
|
86
222
|
addSnippet(snippetid) {
|
|
87
223
|
const builder = this.builder;
|
|
@@ -4027,6 +4163,24 @@ function readHoverColor(el, aspect) {
|
|
|
4027
4163
|
return '';
|
|
4028
4164
|
}
|
|
4029
4165
|
|
|
4166
|
+
// The colour a button shows, for a swatch or a colour picker. A colour written as a mode role
|
|
4167
|
+
// (var(--cb-mode-button, ...), see the runtime's modes) is resolved to the colour it gives here and
|
|
4168
|
+
// now, so the picker opens on a real colour; any other value is returned as it is. Reading only:
|
|
4169
|
+
// the role stays in the markup until the user picks a colour.
|
|
4170
|
+
// property: a CSS property ('color', 'backgroundColor') or a hover variable ('--cb-hover-bg')
|
|
4171
|
+
function resolveColor(el, value, property) {
|
|
4172
|
+
if (!value || value.indexOf('var(') === -1) return value;
|
|
4173
|
+
const win = el.ownerDocument && el.ownerDocument.defaultView;
|
|
4174
|
+
if (!win) return value;
|
|
4175
|
+
const cs = win.getComputedStyle(el);
|
|
4176
|
+
// Read the role's own variable, not the property: the property shows the hover colour while
|
|
4177
|
+
// the pointer is over the button (as it is right after the button is clicked)
|
|
4178
|
+
const role = value.trim().match(/^var\(\s*(--[\w-]+)\s*(?:,\s*([\s\S]+))?\)$/);
|
|
4179
|
+
if (role) return cs.getPropertyValue(role[1]).trim() || (role[2] || '').trim() || value;
|
|
4180
|
+
const shown = property.indexOf('--') === 0 ? cs.getPropertyValue(property).trim() : cs[property];
|
|
4181
|
+
return shown || value;
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4030
4184
|
// Write one hover aspect, and drop every legacy form of THAT aspect.
|
|
4031
4185
|
//
|
|
4032
4186
|
// Per aspect, not per button: editing the hover background must not silently
|
|
@@ -4267,7 +4421,7 @@ const BUTTON_PRESETS = [
|
|
|
4267
4421
|
type: 'solid',
|
|
4268
4422
|
shape: 'rounded',
|
|
4269
4423
|
text: 'Read More',
|
|
4270
|
-
color: 'rgb(24, 24, 27)',
|
|
4424
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4271
4425
|
bg: 'transparent',
|
|
4272
4426
|
hoverBg: 'transparent',
|
|
4273
4427
|
customClasses: 'underline'
|
|
@@ -4275,33 +4429,35 @@ const BUTTON_PRESETS = [
|
|
|
4275
4429
|
type: 'outline',
|
|
4276
4430
|
shape: 'rounded',
|
|
4277
4431
|
text: 'Read More',
|
|
4278
|
-
color: 'rgb(24, 24, 27)',
|
|
4432
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4279
4433
|
bg: 'transparent',
|
|
4280
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
4281
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
4434
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4435
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
4282
4436
|
}, {
|
|
4283
4437
|
type: 'solid',
|
|
4284
4438
|
shape: 'rounded',
|
|
4285
4439
|
text: 'Read More',
|
|
4286
|
-
color: 'rgb(24, 24, 27)',
|
|
4287
|
-
bg: 'rgb(240, 240, 241)',
|
|
4288
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
4440
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4441
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
4442
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
4289
4443
|
}, {
|
|
4290
4444
|
type: 'solid',
|
|
4291
4445
|
shape: 'rounded',
|
|
4292
4446
|
text: 'Read More',
|
|
4293
|
-
color: 'rgb(250, 250, 250)',
|
|
4294
|
-
bg: 'rgb(24, 24, 27)',
|
|
4295
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
4296
|
-
},
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4447
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
4448
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4449
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
4450
|
+
},
|
|
4451
|
+
// {
|
|
4452
|
+
// type: 'outline',
|
|
4453
|
+
// shape: 'rounded',
|
|
4454
|
+
// text: 'Read More',
|
|
4455
|
+
// color: 'rgb(250, 250, 250)',
|
|
4456
|
+
// bg: 'transparent',
|
|
4457
|
+
// hoverBg: '#fff',
|
|
4458
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
4459
|
+
// },
|
|
4460
|
+
{
|
|
4305
4461
|
type: 'solid',
|
|
4306
4462
|
shape: 'rounded',
|
|
4307
4463
|
text: 'Read More',
|
|
@@ -4410,7 +4566,7 @@ const BUTTON_PRESETS = [
|
|
|
4410
4566
|
type: 'solid',
|
|
4411
4567
|
shape: 'slightly-rounded',
|
|
4412
4568
|
text: 'Read More',
|
|
4413
|
-
color: 'rgb(24, 24, 27)',
|
|
4569
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4414
4570
|
bg: 'transparent',
|
|
4415
4571
|
hoverBg: 'transparent',
|
|
4416
4572
|
customClasses: 'underline'
|
|
@@ -4418,33 +4574,35 @@ const BUTTON_PRESETS = [
|
|
|
4418
4574
|
type: 'outline',
|
|
4419
4575
|
shape: 'slightly-rounded',
|
|
4420
4576
|
text: 'Read More',
|
|
4421
|
-
color: 'rgb(24, 24, 27)',
|
|
4577
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4422
4578
|
bg: 'transparent',
|
|
4423
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
4424
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
4579
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4580
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
4425
4581
|
}, {
|
|
4426
4582
|
type: 'solid',
|
|
4427
4583
|
shape: 'slightly-rounded',
|
|
4428
4584
|
text: 'Read More',
|
|
4429
|
-
color: 'rgb(24, 24, 27)',
|
|
4430
|
-
bg: 'rgb(240, 240, 241)',
|
|
4431
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
4585
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4586
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
4587
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
4432
4588
|
}, {
|
|
4433
4589
|
type: 'solid',
|
|
4434
4590
|
shape: 'slightly-rounded',
|
|
4435
4591
|
text: 'Read More',
|
|
4436
|
-
color: 'rgb(250, 250, 250)',
|
|
4437
|
-
bg: 'rgb(24, 24, 27)',
|
|
4438
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
4439
|
-
},
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4592
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
4593
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4594
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
4595
|
+
},
|
|
4596
|
+
// {
|
|
4597
|
+
// type: 'outline',
|
|
4598
|
+
// shape: 'slightly-rounded',
|
|
4599
|
+
// text: 'Read More',
|
|
4600
|
+
// color: 'rgb(250, 250, 250)',
|
|
4601
|
+
// bg: 'transparent',
|
|
4602
|
+
// hoverBg: '#fff',
|
|
4603
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
4604
|
+
// },
|
|
4605
|
+
{
|
|
4448
4606
|
type: 'solid',
|
|
4449
4607
|
shape: 'slightly-rounded',
|
|
4450
4608
|
text: 'Read More',
|
|
@@ -4553,7 +4711,7 @@ const BUTTON_PRESETS = [
|
|
|
4553
4711
|
type: 'solid',
|
|
4554
4712
|
shape: 'square',
|
|
4555
4713
|
text: 'Read More',
|
|
4556
|
-
color: 'rgb(24, 24, 27)',
|
|
4714
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4557
4715
|
bg: 'transparent',
|
|
4558
4716
|
hoverBg: 'transparent',
|
|
4559
4717
|
customClasses: 'underline px-0'
|
|
@@ -4561,33 +4719,35 @@ const BUTTON_PRESETS = [
|
|
|
4561
4719
|
type: 'outline',
|
|
4562
4720
|
shape: 'square',
|
|
4563
4721
|
text: 'Read More',
|
|
4564
|
-
color: 'rgb(24, 24, 27)',
|
|
4722
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4565
4723
|
bg: 'transparent',
|
|
4566
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
4567
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
4724
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4725
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
4568
4726
|
}, {
|
|
4569
4727
|
type: 'solid',
|
|
4570
4728
|
shape: 'square',
|
|
4571
4729
|
text: 'Read More',
|
|
4572
|
-
color: 'rgb(24, 24, 27)',
|
|
4573
|
-
bg: 'rgb(240, 240, 241)',
|
|
4574
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
4730
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4731
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
4732
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
4575
4733
|
}, {
|
|
4576
4734
|
type: 'solid',
|
|
4577
4735
|
shape: 'square',
|
|
4578
4736
|
text: 'Read More',
|
|
4579
|
-
color: 'rgb(250, 250, 250)',
|
|
4580
|
-
bg: 'rgb(24, 24, 27)',
|
|
4581
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
4582
|
-
},
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4737
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
4738
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4739
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
4740
|
+
},
|
|
4741
|
+
// {
|
|
4742
|
+
// type: 'outline',
|
|
4743
|
+
// shape: 'square',
|
|
4744
|
+
// text: 'Read More',
|
|
4745
|
+
// color: 'rgb(250, 250, 250)',
|
|
4746
|
+
// bg: 'transparent',
|
|
4747
|
+
// hoverBg: '#fff',
|
|
4748
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
4749
|
+
// },
|
|
4750
|
+
{
|
|
4591
4751
|
type: 'solid',
|
|
4592
4752
|
shape: 'square',
|
|
4593
4753
|
text: 'Read More',
|
|
@@ -4697,7 +4857,7 @@ const BUTTON_PRESETS = [
|
|
|
4697
4857
|
shape: 'rounded',
|
|
4698
4858
|
size: 'small',
|
|
4699
4859
|
text: 'Read More',
|
|
4700
|
-
color: 'rgb(24, 24, 27)',
|
|
4860
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4701
4861
|
bg: 'transparent',
|
|
4702
4862
|
hoverBg: 'transparent',
|
|
4703
4863
|
customClasses: 'underline'
|
|
@@ -4706,36 +4866,38 @@ const BUTTON_PRESETS = [
|
|
|
4706
4866
|
shape: 'rounded',
|
|
4707
4867
|
size: 'small',
|
|
4708
4868
|
text: 'Read More',
|
|
4709
|
-
color: 'rgb(24, 24, 27)',
|
|
4869
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4710
4870
|
bg: 'transparent',
|
|
4711
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
4712
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
4871
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4872
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
4713
4873
|
}, {
|
|
4714
4874
|
type: 'solid',
|
|
4715
4875
|
shape: 'rounded',
|
|
4716
4876
|
size: 'small',
|
|
4717
4877
|
text: 'Read More',
|
|
4718
|
-
color: 'rgb(24, 24, 27)',
|
|
4719
|
-
bg: 'rgb(240, 240, 241)',
|
|
4720
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
4878
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4879
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
4880
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
4721
4881
|
}, {
|
|
4722
4882
|
type: 'solid',
|
|
4723
4883
|
shape: 'rounded',
|
|
4724
4884
|
size: 'small',
|
|
4725
4885
|
text: 'Read More',
|
|
4726
|
-
color: 'rgb(250, 250, 250)',
|
|
4727
|
-
bg: 'rgb(24, 24, 27)',
|
|
4728
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
4729
|
-
},
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4886
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
4887
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4888
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
4889
|
+
},
|
|
4890
|
+
// {
|
|
4891
|
+
// type: 'outline',
|
|
4892
|
+
// shape: 'rounded',
|
|
4893
|
+
// size: 'small',
|
|
4894
|
+
// text: 'Read More',
|
|
4895
|
+
// color: 'rgb(250, 250, 250)',
|
|
4896
|
+
// bg: 'transparent',
|
|
4897
|
+
// hoverBg: '#fff',
|
|
4898
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
4899
|
+
// },
|
|
4900
|
+
{
|
|
4739
4901
|
type: 'solid',
|
|
4740
4902
|
shape: 'rounded',
|
|
4741
4903
|
size: 'small',
|
|
@@ -4848,7 +5010,7 @@ const BUTTON_PRESETS = [
|
|
|
4848
5010
|
shape: 'slightly-rounded',
|
|
4849
5011
|
size: 'small',
|
|
4850
5012
|
text: 'Read More',
|
|
4851
|
-
color: 'rgb(24, 24, 27)',
|
|
5013
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4852
5014
|
bg: 'transparent',
|
|
4853
5015
|
hoverBg: 'transparent',
|
|
4854
5016
|
customClasses: 'underline'
|
|
@@ -4857,36 +5019,38 @@ const BUTTON_PRESETS = [
|
|
|
4857
5019
|
shape: 'slightly-rounded',
|
|
4858
5020
|
size: 'small',
|
|
4859
5021
|
text: 'Read More',
|
|
4860
|
-
color: 'rgb(24, 24, 27)',
|
|
5022
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
4861
5023
|
bg: 'transparent',
|
|
4862
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
4863
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
5024
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5025
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
4864
5026
|
}, {
|
|
4865
5027
|
type: 'solid',
|
|
4866
5028
|
shape: 'slightly-rounded',
|
|
4867
5029
|
size: 'small',
|
|
4868
5030
|
text: 'Read More',
|
|
4869
|
-
color: 'rgb(24, 24, 27)',
|
|
4870
|
-
bg: 'rgb(240, 240, 241)',
|
|
4871
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
5031
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5032
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
5033
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
4872
5034
|
}, {
|
|
4873
5035
|
type: 'solid',
|
|
4874
5036
|
shape: 'slightly-rounded',
|
|
4875
5037
|
size: 'small',
|
|
4876
5038
|
text: 'Read More',
|
|
4877
|
-
color: 'rgb(250, 250, 250)',
|
|
4878
|
-
bg: 'rgb(24, 24, 27)',
|
|
4879
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
4880
|
-
},
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
5039
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
5040
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5041
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
5042
|
+
},
|
|
5043
|
+
// {
|
|
5044
|
+
// type: 'outline',
|
|
5045
|
+
// shape: 'slightly-rounded',
|
|
5046
|
+
// size: 'small',
|
|
5047
|
+
// text: 'Read More',
|
|
5048
|
+
// color: 'rgb(250, 250, 250)',
|
|
5049
|
+
// bg: 'transparent',
|
|
5050
|
+
// hoverBg: '#fff',
|
|
5051
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
5052
|
+
// },
|
|
5053
|
+
{
|
|
4890
5054
|
type: 'solid',
|
|
4891
5055
|
shape: 'slightly-rounded',
|
|
4892
5056
|
size: 'small',
|
|
@@ -4999,7 +5163,7 @@ const BUTTON_PRESETS = [
|
|
|
4999
5163
|
shape: 'rounded',
|
|
5000
5164
|
size: 'large',
|
|
5001
5165
|
text: 'Read More',
|
|
5002
|
-
color: 'rgb(24, 24, 27)',
|
|
5166
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5003
5167
|
bg: 'transparent',
|
|
5004
5168
|
hoverBg: 'transparent',
|
|
5005
5169
|
customClasses: 'underline'
|
|
@@ -5008,36 +5172,38 @@ const BUTTON_PRESETS = [
|
|
|
5008
5172
|
shape: 'rounded',
|
|
5009
5173
|
size: 'large',
|
|
5010
5174
|
text: 'Read More',
|
|
5011
|
-
color: 'rgb(24, 24, 27)',
|
|
5175
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5012
5176
|
bg: 'transparent',
|
|
5013
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
5014
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
5177
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5178
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
5015
5179
|
}, {
|
|
5016
5180
|
type: 'solid',
|
|
5017
5181
|
shape: 'rounded',
|
|
5018
5182
|
size: 'large',
|
|
5019
5183
|
text: 'Read More',
|
|
5020
|
-
color: 'rgb(24, 24, 27)',
|
|
5021
|
-
bg: 'rgb(240, 240, 241)',
|
|
5022
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
5184
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5185
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
5186
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
5023
5187
|
}, {
|
|
5024
5188
|
type: 'solid',
|
|
5025
5189
|
shape: 'rounded',
|
|
5026
5190
|
size: 'large',
|
|
5027
5191
|
text: 'Read More',
|
|
5028
|
-
color: 'rgb(250, 250, 250)',
|
|
5029
|
-
bg: 'rgb(24, 24, 27)',
|
|
5030
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
5031
|
-
},
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5192
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
5193
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5194
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
5195
|
+
},
|
|
5196
|
+
// {
|
|
5197
|
+
// type: 'outline',
|
|
5198
|
+
// shape: 'rounded',
|
|
5199
|
+
// size: 'large',
|
|
5200
|
+
// text: 'Read More',
|
|
5201
|
+
// color: 'rgb(250, 250, 250)',
|
|
5202
|
+
// bg: 'transparent',
|
|
5203
|
+
// hoverBg: '#fff',
|
|
5204
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
5205
|
+
// },
|
|
5206
|
+
{
|
|
5041
5207
|
type: 'solid',
|
|
5042
5208
|
shape: 'rounded',
|
|
5043
5209
|
size: 'large',
|
|
@@ -5150,7 +5316,7 @@ const BUTTON_PRESETS = [
|
|
|
5150
5316
|
shape: 'slightly-rounded',
|
|
5151
5317
|
size: 'large',
|
|
5152
5318
|
text: 'Read More',
|
|
5153
|
-
color: 'rgb(24, 24, 27)',
|
|
5319
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5154
5320
|
bg: 'transparent',
|
|
5155
5321
|
hoverBg: 'transparent',
|
|
5156
5322
|
customClasses: 'underline'
|
|
@@ -5159,36 +5325,38 @@ const BUTTON_PRESETS = [
|
|
|
5159
5325
|
shape: 'slightly-rounded',
|
|
5160
5326
|
size: 'large',
|
|
5161
5327
|
text: 'Read More',
|
|
5162
|
-
color: 'rgb(24, 24, 27)',
|
|
5328
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5163
5329
|
bg: 'transparent',
|
|
5164
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
5165
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
5330
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5331
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
5166
5332
|
}, {
|
|
5167
5333
|
type: 'solid',
|
|
5168
5334
|
shape: 'slightly-rounded',
|
|
5169
5335
|
size: 'large',
|
|
5170
5336
|
text: 'Read More',
|
|
5171
|
-
color: 'rgb(24, 24, 27)',
|
|
5172
|
-
bg: 'rgb(240, 240, 241)',
|
|
5173
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
5337
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5338
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
5339
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
5174
5340
|
}, {
|
|
5175
5341
|
type: 'solid',
|
|
5176
5342
|
shape: 'slightly-rounded',
|
|
5177
5343
|
size: 'large',
|
|
5178
5344
|
text: 'Read More',
|
|
5179
|
-
color: 'rgb(250, 250, 250)',
|
|
5180
|
-
bg: 'rgb(24, 24, 27)',
|
|
5181
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
5182
|
-
},
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5345
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
5346
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5347
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
5348
|
+
},
|
|
5349
|
+
// {
|
|
5350
|
+
// type: 'outline',
|
|
5351
|
+
// shape: 'slightly-rounded',
|
|
5352
|
+
// size: 'large',
|
|
5353
|
+
// text: 'Read More',
|
|
5354
|
+
// color: 'rgb(250, 250, 250)',
|
|
5355
|
+
// bg: 'transparent',
|
|
5356
|
+
// hoverBg: '#fff',
|
|
5357
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
5358
|
+
// },
|
|
5359
|
+
{
|
|
5192
5360
|
type: 'solid',
|
|
5193
5361
|
shape: 'slightly-rounded',
|
|
5194
5362
|
size: 'large',
|
|
@@ -5301,7 +5469,7 @@ const BUTTON_PRESETS = [
|
|
|
5301
5469
|
shape: 'square',
|
|
5302
5470
|
size: 'large',
|
|
5303
5471
|
text: 'Read More',
|
|
5304
|
-
color: 'rgb(24, 24, 27)',
|
|
5472
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5305
5473
|
bg: 'transparent',
|
|
5306
5474
|
hoverBg: 'transparent',
|
|
5307
5475
|
customClasses: 'underline'
|
|
@@ -5310,36 +5478,38 @@ const BUTTON_PRESETS = [
|
|
|
5310
5478
|
shape: 'square',
|
|
5311
5479
|
size: 'large',
|
|
5312
5480
|
text: 'Read More',
|
|
5313
|
-
color: 'rgb(24, 24, 27)',
|
|
5481
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5314
5482
|
bg: 'transparent',
|
|
5315
|
-
hoverBg: 'rgb(24, 24, 27)',
|
|
5316
|
-
hoverColor: 'rgb(255, 255, 255)'
|
|
5483
|
+
hoverBg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5484
|
+
hoverColor: 'var(--cb-mode-button-on, rgb(255, 255, 255))'
|
|
5317
5485
|
}, {
|
|
5318
5486
|
type: 'solid',
|
|
5319
5487
|
shape: 'square',
|
|
5320
5488
|
size: 'large',
|
|
5321
5489
|
text: 'Read More',
|
|
5322
|
-
color: 'rgb(24, 24, 27)',
|
|
5323
|
-
bg: 'rgb(240, 240, 241)',
|
|
5324
|
-
hoverBg: 'rgb(236, 236, 238)'
|
|
5490
|
+
color: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5491
|
+
bg: 'var(--cb-mode-button-soft, rgb(240, 240, 241))',
|
|
5492
|
+
hoverBg: 'var(--cb-mode-button-soft-hover, rgb(236, 236, 238))'
|
|
5325
5493
|
}, {
|
|
5326
5494
|
type: 'solid',
|
|
5327
5495
|
shape: 'square',
|
|
5328
5496
|
size: 'large',
|
|
5329
5497
|
text: 'Read More',
|
|
5330
|
-
color: 'rgb(250, 250, 250)',
|
|
5331
|
-
bg: 'rgb(24, 24, 27)',
|
|
5332
|
-
hoverBg: 'rgb(63, 63, 70)'
|
|
5333
|
-
},
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5498
|
+
color: 'var(--cb-mode-button-on, rgb(250, 250, 250))',
|
|
5499
|
+
bg: 'var(--cb-mode-button, rgb(24, 24, 27))',
|
|
5500
|
+
hoverBg: 'var(--cb-mode-button-hover, rgb(63, 63, 70))'
|
|
5501
|
+
},
|
|
5502
|
+
// {
|
|
5503
|
+
// type: 'outline',
|
|
5504
|
+
// shape: 'square',
|
|
5505
|
+
// size: 'large',
|
|
5506
|
+
// text: 'Read More',
|
|
5507
|
+
// color: 'rgb(250, 250, 250)',
|
|
5508
|
+
// bg: 'transparent',
|
|
5509
|
+
// hoverBg: '#fff',
|
|
5510
|
+
// hoverColor: 'rgb(0, 0, 0)'
|
|
5511
|
+
// },
|
|
5512
|
+
{
|
|
5343
5513
|
type: 'solid',
|
|
5344
5514
|
shape: 'square',
|
|
5345
5515
|
size: 'large',
|
|
@@ -7658,6 +7828,7 @@ class Util {
|
|
|
7658
7828
|
selection.removeAllRanges();
|
|
7659
7829
|
selection.addRange(range);
|
|
7660
7830
|
element.click();
|
|
7831
|
+
if (this.isEmbed(element)) this.repositionToolsUntilSettled(element);
|
|
7661
7832
|
}
|
|
7662
7833
|
} catch (e) {
|
|
7663
7834
|
// Do Nothing
|
|
@@ -7745,6 +7916,7 @@ class Util {
|
|
|
7745
7916
|
selection.removeAllRanges();
|
|
7746
7917
|
selection.addRange(range);
|
|
7747
7918
|
element.click();
|
|
7919
|
+
if (this.isEmbed(element)) this.repositionToolsUntilSettled(element);
|
|
7748
7920
|
}
|
|
7749
7921
|
} catch (e) {
|
|
7750
7922
|
// Do Nothing
|
|
@@ -7797,48 +7969,9 @@ class Util {
|
|
|
7797
7969
|
clearInterval(checkLoad);
|
|
7798
7970
|
}
|
|
7799
7971
|
}, 30);
|
|
7800
|
-
} else if (
|
|
7801
|
-
// A plugin/module or media embed (map / YouTube / video) renders
|
|
7802
|
-
// and lays out asynchronously AFTER this insert returns: the
|
|
7803
|
-
// plugin fills/replaces the frame (DOM change), a <video>/iframe
|
|
7804
|
-
// takes its size (resize), siblings reflow. The tool positioned
|
|
7805
|
-
// now is stale, and the plugin may REPLACE the inserted node so
|
|
7806
|
-
// anything tied to `newelement` breaks. Instead of guessing a
|
|
7807
|
-
// delay, react to the actual layout events on the PERSISTENT
|
|
7808
|
-
// container and reposition via the live activeElement until they
|
|
7809
|
-
// settle (debounced), then stop.
|
|
7972
|
+
} else if (this.isEmbed(newelement)) {
|
|
7810
7973
|
newelement.click();
|
|
7811
|
-
|
|
7812
|
-
const _cwin = _cont && _cont.ownerDocument.defaultView || this.builder.win || window;
|
|
7813
|
-
if (_cont && (_cwin.ResizeObserver || _cwin.MutationObserver)) {
|
|
7814
|
-
let _ro, _mo, _quiet;
|
|
7815
|
-
const _stop = () => {
|
|
7816
|
-
if (_ro) _ro.disconnect();
|
|
7817
|
-
if (_mo) _mo.disconnect();
|
|
7818
|
-
clearTimeout(_quiet);
|
|
7819
|
-
};
|
|
7820
|
-
const _bump = () => {
|
|
7821
|
-
if (this.builder.activeElement && this.builder.elmTool && this.builder.elmTool.repositionElementTool) {
|
|
7822
|
-
this.builder.elmTool.repositionElementTool();
|
|
7823
|
-
}
|
|
7824
|
-
clearTimeout(_quiet);
|
|
7825
|
-
_quiet = setTimeout(_stop, 300); // settled: 300ms with no further layout events
|
|
7826
|
-
};
|
|
7827
|
-
|
|
7828
|
-
if (_cwin.ResizeObserver) {
|
|
7829
|
-
_ro = new _cwin.ResizeObserver(_bump);
|
|
7830
|
-
_ro.observe(_cont);
|
|
7831
|
-
}
|
|
7832
|
-
if (_cwin.MutationObserver) {
|
|
7833
|
-
_mo = new _cwin.MutationObserver(_bump);
|
|
7834
|
-
_mo.observe(_cont, {
|
|
7835
|
-
childList: true,
|
|
7836
|
-
subtree: true
|
|
7837
|
-
});
|
|
7838
|
-
}
|
|
7839
|
-
_bump(); // initial position + arm the settle timer
|
|
7840
|
-
setTimeout(_stop, 3000); // hard safety cap
|
|
7841
|
-
}
|
|
7974
|
+
this.repositionToolsUntilSettled(newelement);
|
|
7842
7975
|
} else {
|
|
7843
7976
|
// newelement.click();
|
|
7844
7977
|
|
|
@@ -7891,6 +8024,50 @@ class Util {
|
|
|
7891
8024
|
}, 400);
|
|
7892
8025
|
}
|
|
7893
8026
|
|
|
8027
|
+
// A plugin/module or media embed (map / YouTube / video).
|
|
8028
|
+
isEmbed(element) {
|
|
8029
|
+
return element.hasAttribute('data-cb-type') || element.tagName.toLowerCase() === 'video' || !!element.querySelector('iframe, video, [data-cb-type]');
|
|
8030
|
+
}
|
|
8031
|
+
|
|
8032
|
+
// An embed renders and lays out asynchronously AFTER its insert returns: the
|
|
8033
|
+
// plugin fills/replaces the frame (DOM change), a <video>/iframe takes its size
|
|
8034
|
+
// (resize), siblings reflow. A tool positioned now is stale, and the plugin may
|
|
8035
|
+
// REPLACE the inserted node so anything tied to it breaks. Instead of guessing
|
|
8036
|
+
// a delay, react to the actual layout events on the PERSISTENT container and
|
|
8037
|
+
// reposition via the live activeElement until they settle (debounced), then stop.
|
|
8038
|
+
repositionToolsUntilSettled(inserted) {
|
|
8039
|
+
const cont = inserted.closest('.is-container') || inserted.parentNode;
|
|
8040
|
+
const cwin = cont && cont.ownerDocument.defaultView || this.builder.win || window;
|
|
8041
|
+
if (!cont || !(cwin.ResizeObserver || cwin.MutationObserver)) return;
|
|
8042
|
+
let ro, mo, quiet;
|
|
8043
|
+
const stop = () => {
|
|
8044
|
+
if (ro) ro.disconnect();
|
|
8045
|
+
if (mo) mo.disconnect();
|
|
8046
|
+
clearTimeout(quiet);
|
|
8047
|
+
};
|
|
8048
|
+
const bump = () => {
|
|
8049
|
+
if (this.builder.activeElement && this.builder.elmTool && this.builder.elmTool.repositionElementTool) {
|
|
8050
|
+
this.builder.elmTool.repositionElementTool();
|
|
8051
|
+
}
|
|
8052
|
+
clearTimeout(quiet);
|
|
8053
|
+
quiet = setTimeout(stop, 300); // settled: 300ms with no further layout events
|
|
8054
|
+
};
|
|
8055
|
+
|
|
8056
|
+
if (cwin.ResizeObserver) {
|
|
8057
|
+
ro = new cwin.ResizeObserver(bump);
|
|
8058
|
+
ro.observe(cont);
|
|
8059
|
+
}
|
|
8060
|
+
if (cwin.MutationObserver) {
|
|
8061
|
+
mo = new cwin.MutationObserver(bump);
|
|
8062
|
+
mo.observe(cont, {
|
|
8063
|
+
childList: true,
|
|
8064
|
+
subtree: true
|
|
8065
|
+
});
|
|
8066
|
+
}
|
|
8067
|
+
bump(); // initial position + arm the settle timer
|
|
8068
|
+
setTimeout(stop, 3000); // hard safety cap
|
|
8069
|
+
}
|
|
8070
|
+
|
|
7894
8071
|
// https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro
|
|
7895
8072
|
htmlToElement(html) {
|
|
7896
8073
|
var template = document.createElement('template');
|
|
@@ -17007,7 +17184,7 @@ class HtmlUtil {
|
|
|
17007
17184
|
});
|
|
17008
17185
|
});
|
|
17009
17186
|
let elms;
|
|
17010
|
-
elms = tmp.querySelectorAll('.sortable-chosen, .sortable-ghost, .elm-active, .icon-active, .elm-inspected, .cell-active, .row-active, .row-outline, .is-builder, [data-cb-nohighlight]');
|
|
17187
|
+
elms = tmp.querySelectorAll('.sortable-chosen, .sortable-ghost, .elm-active, .icon-active, .elm-inspected, .cell-active, .row-active, .row-outline, .row-marked, .is-builder, [data-cb-nohighlight]');
|
|
17011
17188
|
elms.forEach(elm => {
|
|
17012
17189
|
elm.removeAttribute('data-cb-nohighlight');
|
|
17013
17190
|
elm.classList.remove('sortable-chosen');
|
|
@@ -17018,6 +17195,7 @@ class HtmlUtil {
|
|
|
17018
17195
|
elm.classList.remove('cell-active');
|
|
17019
17196
|
elm.classList.remove('row-active');
|
|
17020
17197
|
elm.classList.remove('row-outline');
|
|
17198
|
+
elm.classList.remove('row-marked');
|
|
17021
17199
|
elm.classList.remove('is-builder');
|
|
17022
17200
|
});
|
|
17023
17201
|
elms = tmp.querySelectorAll('[data-click], [contenteditable], [draggridoutline], [between-blocks-left], [between-blocks-center], [hideelementhighlight], [data-module-active], [draggable], [aria-keyshortcuts], [aria-describedby], [data-cb-panel]');
|
|
@@ -31813,7 +31991,7 @@ class ButtonEditor {
|
|
|
31813
31991
|
|
|
31814
31992
|
const dom = this.dom;
|
|
31815
31993
|
let current = '';
|
|
31816
|
-
if (cmd === 'color-bg') current = el.style.backgroundColor || dom.getStyle(el, 'background-color');else if (cmd === 'color-text') current = el.style.color || dom.getStyle(el, 'color');else if (cmd === 'hover-bg') current = readButton(el).hoverBg;else if (cmd === 'hover-text') current = readButton(el).hoverColor;else if (cmd === 'hover-border') current = readButton(el).hoverBorder;
|
|
31994
|
+
if (cmd === 'color-bg') current = resolveColor(el, el.style.backgroundColor, 'backgroundColor') || dom.getStyle(el, 'background-color');else if (cmd === 'color-text') current = resolveColor(el, el.style.color, 'color') || dom.getStyle(el, 'color');else if (cmd === 'hover-bg') current = resolveColor(el, readButton(el).hoverBg, '--cb-hover-bg');else if (cmd === 'hover-text') current = resolveColor(el, readButton(el).hoverColor, '--cb-hover-color');else if (cmd === 'hover-border') current = resolveColor(el, readButton(el).hoverBorder, '--cb-hover-border');
|
|
31817
31995
|
btn.setAttribute('data-focus', true);
|
|
31818
31996
|
this.builder.colorPicker.open(color => {
|
|
31819
31997
|
const el = this.getButton();
|
|
@@ -31996,9 +32174,9 @@ class ButtonEditor {
|
|
|
31996
32174
|
this.paintSwatch('color-bg', dom.getStyle(el, 'background-color'));
|
|
31997
32175
|
this.paintSwatch('color-text', dom.getStyle(el, 'color'));
|
|
31998
32176
|
// Hover colours straight from the model.
|
|
31999
|
-
this.paintSwatch('hover-bg', r.hoverBg);
|
|
32000
|
-
this.paintSwatch('hover-text', r.hoverColor);
|
|
32001
|
-
this.paintSwatch('hover-border', r.hoverBorder);
|
|
32177
|
+
this.paintSwatch('hover-bg', resolveColor(el, r.hoverBg, '--cb-hover-bg'));
|
|
32178
|
+
this.paintSwatch('hover-text', resolveColor(el, r.hoverColor, '--cb-hover-color'));
|
|
32179
|
+
this.paintSwatch('hover-border', resolveColor(el, r.hoverBorder, '--cb-hover-border'));
|
|
32002
32180
|
}
|
|
32003
32181
|
syncSeg(cmd, value) {
|
|
32004
32182
|
this.buttonModal.querySelectorAll(`[data-cmd="${cmd}"]`).forEach(b => {
|
|
@@ -76682,6 +76860,25 @@ class ContentStuff {
|
|
|
76682
76860
|
.is-builder .row-active:not([data-protected]).row-outline {
|
|
76683
76861
|
outline: 1px solid rgba(132, 132, 132, 0.2);
|
|
76684
76862
|
}
|
|
76863
|
+
.is-builder .row-marked:not([data-protected]) {
|
|
76864
|
+
z-index: 1;
|
|
76865
|
+
}
|
|
76866
|
+
.is-builder .row-marked:not([data-protected])::after {
|
|
76867
|
+
content: '';
|
|
76868
|
+
position: absolute;
|
|
76869
|
+
inset: 0;
|
|
76870
|
+
z-index: 10;
|
|
76871
|
+
background-color: #a9c4e442;
|
|
76872
|
+
pointer-events: none;
|
|
76873
|
+
}
|
|
76874
|
+
.cb-block-band {
|
|
76875
|
+
position: fixed;
|
|
76876
|
+
z-index: 10000;
|
|
76877
|
+
box-sizing: border-box;
|
|
76878
|
+
border: 1px solid #c2e2ff;
|
|
76879
|
+
background-color: #a9c4e442;
|
|
76880
|
+
pointer-events: none;
|
|
76881
|
+
}
|
|
76685
76882
|
.is-builder .row-active:not([data-protected]):not(.row-outline) > div.cell-active {
|
|
76686
76883
|
outline: none;
|
|
76687
76884
|
}
|
|
@@ -77747,6 +77944,257 @@ class ContentStuff {
|
|
|
77747
77944
|
}
|
|
77748
77945
|
}
|
|
77749
77946
|
|
|
77947
|
+
/*
|
|
77948
|
+
Drag from the empty area around a container to select its blocks, then press
|
|
77949
|
+
Delete to remove them. Mouse only. The look follows the canvas selection.
|
|
77950
|
+
|
|
77951
|
+
The selection is its own mark (.row-marked), separate from the active block, and
|
|
77952
|
+
works with no active block at all. A press there changes nothing until the mouse
|
|
77953
|
+
moves, so a plain click behaves exactly as it always has.
|
|
77954
|
+
*/
|
|
77955
|
+
|
|
77956
|
+
const MARK = 'row-marked';
|
|
77957
|
+
const START_DISTANCE = 4;
|
|
77958
|
+
const SCROLL_EDGE = 40;
|
|
77959
|
+
const SCROLL_STEP = 14;
|
|
77960
|
+
const MODIFIER_KEYS = ['Shift', 'Control', 'Alt', 'Meta'];
|
|
77961
|
+
class BlockSelect {
|
|
77962
|
+
constructor(builder) {
|
|
77963
|
+
this.builder = builder;
|
|
77964
|
+
this.doc = builder.doc;
|
|
77965
|
+
this.win = builder.win;
|
|
77966
|
+
this.press = null;
|
|
77967
|
+
this.band = null;
|
|
77968
|
+
this.container = null;
|
|
77969
|
+
this.scrollFrame = null;
|
|
77970
|
+
this.onPress = this.onPress.bind(this);
|
|
77971
|
+
this.onPressOutside = this.onPressOutside.bind(this);
|
|
77972
|
+
this.onMove = this.onMove.bind(this);
|
|
77973
|
+
this.onMouseMove = this.onMouseMove.bind(this);
|
|
77974
|
+
this.clearSelection = this.clearSelection.bind(this);
|
|
77975
|
+
this.autoScroll = this.autoScroll.bind(this);
|
|
77976
|
+
this.onRelease = this.onRelease.bind(this);
|
|
77977
|
+
this.onKeydown = this.onKeydown.bind(this);
|
|
77978
|
+
this.doc.addEventListener('pointerdown', this.onPress, true);
|
|
77979
|
+
this.doc.addEventListener('keydown', this.onKeydown, true);
|
|
77980
|
+
|
|
77981
|
+
// The editor can live in an iframe: its page around the frame counts too.
|
|
77982
|
+
if (this.doc !== document) {
|
|
77983
|
+
document.addEventListener('pointerdown', this.onPressOutside, true);
|
|
77984
|
+
document.addEventListener('keydown', this.onKeydown, true);
|
|
77985
|
+
}
|
|
77986
|
+
}
|
|
77987
|
+
onPress(e) {
|
|
77988
|
+
this.clear();
|
|
77989
|
+
const builder = this.builder;
|
|
77990
|
+
if (builder.canvas && !builder.isContentBox) return; // freeform has its own selection
|
|
77991
|
+
if (e.pointerType !== 'mouse' || e.button !== 0) return;
|
|
77992
|
+
if (e.shiftKey || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
77993
|
+
const container = this.containerBeside(e);
|
|
77994
|
+
if (!container) return;
|
|
77995
|
+
const selection = this.win.getSelection();
|
|
77996
|
+
this.press = {
|
|
77997
|
+
container,
|
|
77998
|
+
pointerId: e.pointerId,
|
|
77999
|
+
startX: e.clientX,
|
|
78000
|
+
startY: e.clientY + this.win.pageYOffset,
|
|
78001
|
+
x: e.clientX,
|
|
78002
|
+
y: e.clientY,
|
|
78003
|
+
range: selection.rangeCount ? selection.getRangeAt(0).cloneRange() : null
|
|
78004
|
+
};
|
|
78005
|
+
this.doc.addEventListener('pointermove', this.onMove, true);
|
|
78006
|
+
this.doc.addEventListener('mousemove', this.onMouseMove, true);
|
|
78007
|
+
this.doc.addEventListener('pointerup', this.onRelease, true);
|
|
78008
|
+
this.doc.addEventListener('pointercancel', this.onRelease, true);
|
|
78009
|
+
}
|
|
78010
|
+
|
|
78011
|
+
// Cancelling the move stops the browser extending a text selection from the press.
|
|
78012
|
+
onMouseMove(e) {
|
|
78013
|
+
if (this.band) e.preventDefault();
|
|
78014
|
+
}
|
|
78015
|
+
onPressOutside() {
|
|
78016
|
+
this.clear();
|
|
78017
|
+
}
|
|
78018
|
+
|
|
78019
|
+
// The container nearest the press, which must be outside it: at its side, above
|
|
78020
|
+
// or below. The pressed element must be one
|
|
78021
|
+
// that holds the container (the page or a wrapper), never something of the host
|
|
78022
|
+
// page that merely sits beside it. A section's bare background layer also counts:
|
|
78023
|
+
// it fills the section behind the container rather than around it.
|
|
78024
|
+
containerBeside(e) {
|
|
78025
|
+
const target = e.target;
|
|
78026
|
+
|
|
78027
|
+
// The container's own padding, above or below its blocks.
|
|
78028
|
+
if (target.matches(this.builder.opts.container) && !target.closest('[data-top-locked], [data-bottom-locked], .is-block')) return target;
|
|
78029
|
+
const area = target.matches('.is-overlay, .is-overlay-bg') ? target.closest('.is-box') : target;
|
|
78030
|
+
if (!area) return null;
|
|
78031
|
+
const containers = this.doc.querySelectorAll(this.builder.opts.container);
|
|
78032
|
+
let nearest = null;
|
|
78033
|
+
let nearestDistance = Infinity;
|
|
78034
|
+
for (let i = 0; i < containers.length; i++) {
|
|
78035
|
+
const container = containers[i];
|
|
78036
|
+
if (target === container || !area.contains(container)) continue;
|
|
78037
|
+
if (container.closest('[data-top-locked], [data-bottom-locked], .is-block')) continue;
|
|
78038
|
+
const rect = container.getBoundingClientRect();
|
|
78039
|
+
const inside = e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom;
|
|
78040
|
+
if (inside) continue;
|
|
78041
|
+
const distance = Math.max(rect.top - e.clientY, e.clientY - rect.bottom, 0);
|
|
78042
|
+
if (distance < nearestDistance) {
|
|
78043
|
+
nearest = container;
|
|
78044
|
+
nearestDistance = distance;
|
|
78045
|
+
}
|
|
78046
|
+
}
|
|
78047
|
+
return nearest;
|
|
78048
|
+
}
|
|
78049
|
+
onMove(e) {
|
|
78050
|
+
const press = this.press;
|
|
78051
|
+
if (!press) return;
|
|
78052
|
+
press.x = e.clientX;
|
|
78053
|
+
press.y = e.clientY;
|
|
78054
|
+
if (!this.band) {
|
|
78055
|
+
const distance = Math.max(Math.abs(e.clientX - press.startX), Math.abs(e.clientY + this.win.pageYOffset - press.startY));
|
|
78056
|
+
if (distance < START_DISTANCE) return;
|
|
78057
|
+
this.begin();
|
|
78058
|
+
}
|
|
78059
|
+
this.update();
|
|
78060
|
+
}
|
|
78061
|
+
begin() {
|
|
78062
|
+
const press = this.press;
|
|
78063
|
+
this.container = press.container;
|
|
78064
|
+
this.band = this.doc.createElement('div');
|
|
78065
|
+
this.band.className = 'cb-block-band';
|
|
78066
|
+
this.doc.body.appendChild(this.band);
|
|
78067
|
+
try {
|
|
78068
|
+
this.doc.documentElement.setPointerCapture(press.pointerId);
|
|
78069
|
+
} catch (err) {/* the pointer is already gone */}
|
|
78070
|
+
this.doc.addEventListener('selectionchange', this.clearSelection);
|
|
78071
|
+
this.clearSelection();
|
|
78072
|
+
this.scrollFrame = this.win.requestAnimationFrame(this.autoScroll);
|
|
78073
|
+
}
|
|
78074
|
+
|
|
78075
|
+
// A caret or text selection left in place would be extended by the drag, so
|
|
78076
|
+
// there is none until the release puts back what the user had.
|
|
78077
|
+
clearSelection() {
|
|
78078
|
+
const selection = this.win.getSelection();
|
|
78079
|
+
if (selection.rangeCount) selection.removeAllRanges();
|
|
78080
|
+
}
|
|
78081
|
+
restoreSelection() {
|
|
78082
|
+
const range = this.press.range;
|
|
78083
|
+
this.clearSelection();
|
|
78084
|
+
if (range) this.win.getSelection().addRange(range.cloneRange());
|
|
78085
|
+
}
|
|
78086
|
+
update() {
|
|
78087
|
+
const press = this.press;
|
|
78088
|
+
const startY = press.startY - this.win.pageYOffset;
|
|
78089
|
+
const left = Math.min(press.startX, press.x);
|
|
78090
|
+
const top = Math.min(startY, press.y);
|
|
78091
|
+
const right = Math.max(press.startX, press.x);
|
|
78092
|
+
const bottom = Math.max(startY, press.y);
|
|
78093
|
+
this.band.style.left = left + 'px';
|
|
78094
|
+
this.band.style.top = top + 'px';
|
|
78095
|
+
this.band.style.width = right - left + 'px';
|
|
78096
|
+
this.band.style.height = bottom - top + 'px';
|
|
78097
|
+
this.selectableRows().forEach(row => {
|
|
78098
|
+
const rect = row.getBoundingClientRect();
|
|
78099
|
+
const touched = rect.left < right && rect.right > left && rect.top < bottom && rect.bottom > top;
|
|
78100
|
+
row.classList.toggle(MARK, touched);
|
|
78101
|
+
});
|
|
78102
|
+
}
|
|
78103
|
+
selectableRows() {
|
|
78104
|
+
return Array.from(this.container.children).filter(row => {
|
|
78105
|
+
return row.tagName === 'DIV' && !row.matches('.row-add-initial, .dummy-space, [data-protected]');
|
|
78106
|
+
});
|
|
78107
|
+
}
|
|
78108
|
+
autoScroll() {
|
|
78109
|
+
if (!this.band) return;
|
|
78110
|
+
const y = this.press.y;
|
|
78111
|
+
let step = 0;
|
|
78112
|
+
if (y < SCROLL_EDGE) step = -SCROLL_STEP;else if (y > this.win.innerHeight - SCROLL_EDGE) step = SCROLL_STEP;
|
|
78113
|
+
if (step) {
|
|
78114
|
+
this.win.scrollBy(0, step);
|
|
78115
|
+
this.update();
|
|
78116
|
+
}
|
|
78117
|
+
this.scrollFrame = this.win.requestAnimationFrame(this.autoScroll);
|
|
78118
|
+
}
|
|
78119
|
+
onRelease() {
|
|
78120
|
+
this.doc.removeEventListener('pointermove', this.onMove, true);
|
|
78121
|
+
this.doc.removeEventListener('mousemove', this.onMouseMove, true);
|
|
78122
|
+
this.doc.removeEventListener('pointerup', this.onRelease, true);
|
|
78123
|
+
this.doc.removeEventListener('pointercancel', this.onRelease, true);
|
|
78124
|
+
if (this.band) {
|
|
78125
|
+
this.endBand();
|
|
78126
|
+
this.restoreSelection();
|
|
78127
|
+
|
|
78128
|
+
// The click ending a drag is not a click on the page.
|
|
78129
|
+
const stopClick = e => e.stopPropagation();
|
|
78130
|
+
this.win.addEventListener('click', stopClick, true);
|
|
78131
|
+
this.win.setTimeout(() => this.win.removeEventListener('click', stopClick, true), 0);
|
|
78132
|
+
}
|
|
78133
|
+
this.press = null;
|
|
78134
|
+
}
|
|
78135
|
+
endBand() {
|
|
78136
|
+
this.win.cancelAnimationFrame(this.scrollFrame);
|
|
78137
|
+
this.doc.removeEventListener('selectionchange', this.clearSelection);
|
|
78138
|
+
this.band.remove();
|
|
78139
|
+
this.band = null;
|
|
78140
|
+
}
|
|
78141
|
+
onKeydown(e) {
|
|
78142
|
+
const rows = this.markedRows();
|
|
78143
|
+
if (!rows.length || MODIFIER_KEYS.includes(e.key)) return;
|
|
78144
|
+
const plain = !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
78145
|
+
if (plain && (e.key === 'Delete' || e.key === 'Backspace')) {
|
|
78146
|
+
e.preventDefault();
|
|
78147
|
+
e.stopPropagation();
|
|
78148
|
+
this.removeRows(rows);
|
|
78149
|
+
return;
|
|
78150
|
+
}
|
|
78151
|
+
this.clear();
|
|
78152
|
+
if (e.key === 'Escape') {
|
|
78153
|
+
e.preventDefault();
|
|
78154
|
+
e.stopPropagation();
|
|
78155
|
+
}
|
|
78156
|
+
}
|
|
78157
|
+
markedRows() {
|
|
78158
|
+
if (!this.container) return [];
|
|
78159
|
+
return Array.from(this.container.querySelectorAll(':scope > .' + MARK));
|
|
78160
|
+
}
|
|
78161
|
+
clear() {
|
|
78162
|
+
this.markedRows().forEach(row => row.classList.remove(MARK));
|
|
78163
|
+
}
|
|
78164
|
+
removeRows(rows) {
|
|
78165
|
+
const builder = this.builder;
|
|
78166
|
+
const util = builder.util;
|
|
78167
|
+
const activeRemoved = rows.some(row => row.classList.contains('row-active'));
|
|
78168
|
+
this.clear();
|
|
78169
|
+
builder.uo.saveForUndo();
|
|
78170
|
+
rows.forEach(row => row.parentNode.removeChild(row));
|
|
78171
|
+
util.checkEmpty();
|
|
78172
|
+
if (activeRemoved) util.clearActiveCell();
|
|
78173
|
+
builder.opts.onChange();
|
|
78174
|
+
|
|
78175
|
+
// Same as the row tool's Delete: its tools and the panel were about that block.
|
|
78176
|
+
if (activeRemoved) {
|
|
78177
|
+
util.clearControls();
|
|
78178
|
+
util.clearModals();
|
|
78179
|
+
if (builder.onSelectChange) builder.onSelectChange();
|
|
78180
|
+
}
|
|
78181
|
+
}
|
|
78182
|
+
destroy() {
|
|
78183
|
+
this.doc.removeEventListener('pointerdown', this.onPress, true);
|
|
78184
|
+
this.doc.removeEventListener('keydown', this.onKeydown, true);
|
|
78185
|
+
this.doc.removeEventListener('pointermove', this.onMove, true);
|
|
78186
|
+
this.doc.removeEventListener('mousemove', this.onMouseMove, true);
|
|
78187
|
+
this.doc.removeEventListener('pointerup', this.onRelease, true);
|
|
78188
|
+
this.doc.removeEventListener('pointercancel', this.onRelease, true);
|
|
78189
|
+
if (this.doc !== document) {
|
|
78190
|
+
document.removeEventListener('pointerdown', this.onPressOutside, true);
|
|
78191
|
+
document.removeEventListener('keydown', this.onKeydown, true);
|
|
78192
|
+
}
|
|
78193
|
+
if (this.band) this.endBand();
|
|
78194
|
+
this.clear();
|
|
78195
|
+
}
|
|
78196
|
+
}
|
|
78197
|
+
|
|
77750
78198
|
class MediaPicker {
|
|
77751
78199
|
constructor(builder) {
|
|
77752
78200
|
this.builder = builder;
|
|
@@ -93438,21 +93886,21 @@ ON A LIGHT BACKGROUND: primary 'text-black', body 'text-gray-600', muted 'text-g
|
|
|
93438
93886
|
|
|
93439
93887
|
ON A DARK SURFACE (a div with a dark inline background, a photo overlay): primary 'text-white', body 'text-gray-200', muted 'text-gray-300'. NEVER 'text-gray-600' or 'text-gray-700' there — they are near-black and vanish. Check every text colour against the background it actually sits on, including small labels and eyebrow text.
|
|
93440
93888
|
|
|
93441
|
-
|
|
93889
|
+
A HIGHER number is DARKER: 'text-gray-200' and 'text-gray-300' are light, 'text-gray-600' and 'text-gray-700' are dark.
|
|
93442
93890
|
|
|
93443
93891
|
| Class | Color |
|
|
93444
93892
|
|-------|-------|
|
|
93445
93893
|
| '.text-black' | #000 |
|
|
93446
93894
|
| '.text-gray-700' | #374151 |
|
|
93447
|
-
| '.text-gray-600' | #
|
|
93448
|
-
| '.text-gray-500' | #
|
|
93449
|
-
| '.text-gray-400' | #
|
|
93450
|
-
| '.text-gray-300' | #
|
|
93451
|
-
| '.text-gray-200' | #
|
|
93895
|
+
| '.text-gray-600' | #4b5563 |
|
|
93896
|
+
| '.text-gray-500' | #6b7280 |
|
|
93897
|
+
| '.text-gray-400' | #9ca3af |
|
|
93898
|
+
| '.text-gray-300' | #d1d5db |
|
|
93899
|
+
| '.text-gray-200' | #e5e7eb |
|
|
93452
93900
|
|
|
93453
93901
|
### Background Colors
|
|
93454
93902
|
|
|
93455
|
-
'.bg-white' #ffffff · '.bg-gray-50' #
|
|
93903
|
+
'.bg-white' #ffffff · '.bg-gray-50' #f9fafb · '.bg-gray-100' #f3f4f6 · '.bg-black' #000000
|
|
93456
93904
|
|
|
93457
93905
|
Editorial style: stick to black, white and grays; use color sparingly for accents.
|
|
93458
93906
|
|
|
@@ -95536,6 +95984,8 @@ class ContentBuilder {
|
|
|
95536
95984
|
this.toolbarKeys = new ToolbarKeys(this); // Keyboard access to the tool strips
|
|
95537
95985
|
|
|
95538
95986
|
this._rowTool = new RowTool(this);
|
|
95987
|
+
this.blockSelect = new BlockSelect(this); // Drag from the side margin to select blocks
|
|
95988
|
+
|
|
95539
95989
|
this.livePreview = new LivePreview(this);
|
|
95540
95990
|
this.mediaPicker = new MediaPicker(this);
|
|
95541
95991
|
|
|
@@ -95627,11 +96077,15 @@ class ContentBuilder {
|
|
|
95627
96077
|
<div class="is-modal-bar">
|
|
95628
96078
|
<button class="is-modal-close" title="${util.out('Close')}" tabindex="-1" aria-label="${util.out('Close')}">✕</button>
|
|
95629
96079
|
</div>
|
|
95630
|
-
<div class="
|
|
95631
|
-
<div class="cb-tabs
|
|
95632
|
-
|
|
95633
|
-
|
|
96080
|
+
<div class="snippet-cats-bar">
|
|
96081
|
+
<div class="cb-tabs-scroller snippet-cats">
|
|
96082
|
+
<div class="cb-tabs cb-tabs-scroll" role="tablist" aria-label="${util.out('Snippets')}"></div>
|
|
96083
|
+
<button type="button" class="cb-tabs-arrow cb-tabs-arrow--prev" aria-hidden="true" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 18l-6-6 6-6"/></svg></button>
|
|
96084
|
+
<button type="button" class="cb-tabs-arrow cb-tabs-arrow--next" aria-hidden="true" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg></button>
|
|
96085
|
+
</div>
|
|
96086
|
+
<button type="button" class="snippet-cats-all" aria-haspopup="dialog" aria-expanded="false" hidden>${util.out('All Categories')}<svg aria-hidden="true"><use xlink:href="#icon-chevron-down"></use></svg></button>
|
|
95634
96087
|
</div>
|
|
96088
|
+
<div class="snippet-cats-menu" role="dialog" hidden></div>
|
|
95635
96089
|
<ul class="snippet-grid"></ul>
|
|
95636
96090
|
</div>
|
|
95637
96091
|
</div>
|
|
@@ -96324,7 +96778,9 @@ class ContentBuilder {
|
|
|
96324
96778
|
let inputFocused = document.activeElement.tagName.toLowerCase() === 'input';
|
|
96325
96779
|
|
|
96326
96780
|
// let insideEditable = this.doc.activeElement && this.doc.activeElement.closest('[contenteditable]');
|
|
96327
|
-
|
|
96781
|
+
// contenteditable="false" (a plugin sealed off, eg. a video in an overlay) is not editable
|
|
96782
|
+
const editableHost = target.closest('[contenteditable]');
|
|
96783
|
+
let insideEditable = editableHost && editableHost.getAttribute('contenteditable') !== 'false';
|
|
96328
96784
|
|
|
96329
96785
|
// if(!document.querySelector('.is-modal.active')) { // Additional (to prevent lost focus)
|
|
96330
96786
|
let openedModal = document.querySelector('.is-modal.active:not(.is-modal-content)');
|
|
@@ -98404,6 +98860,7 @@ class ContentBuilder {
|
|
|
98404
98860
|
const linkStyle = document.head.querySelector('#_snippet_style');
|
|
98405
98861
|
if (linkStyle) linkStyle.remove();
|
|
98406
98862
|
if (this.eb) this.eb.destroy();
|
|
98863
|
+
if (this.blockSelect) this.blockSelect.destroy();
|
|
98407
98864
|
if (this.codeElement) this.codeElement.destroy();
|
|
98408
98865
|
if (this.letak) {
|
|
98409
98866
|
this.letak.destroy();
|