@joryio/web-sdk 1.4.0-beta.7 → 1.4.0-beta.8
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 +4 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/editor-gate.d.ts +2 -0
- package/dist/core/editor-gate.d.ts.map +1 -1
- package/dist/core/page-edits.d.ts +13 -0
- package/dist/core/page-edits.d.ts.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/editor/editor-strings.d.ts +11 -0
- package/dist/editor/editor-strings.d.ts.map +1 -1
- package/dist/editor/editor-ui.d.ts +4 -1
- package/dist/editor/editor-ui.d.ts.map +1 -1
- package/dist/editor/liquid-field.d.ts +1 -0
- package/dist/editor/liquid-field.d.ts.map +1 -1
- package/dist/editor/visual-editor.d.ts +25 -2
- package/dist/editor/visual-editor.d.ts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/joryio-cards-ui.min.js +1 -1
- package/dist/joryio-editor.min.js +2 -2
- package/dist/joryio-editor.min.js.map +1 -1
- package/dist/joryio-sw.js +1 -1
- package/dist/joryio.cjs.js +68 -8
- package/dist/joryio.min.js +2 -2
- package/dist/joryio.min.js.map +1 -1
- package/dist/joryio.mjs +68 -8
- package/dist/joryio.umd.js +68 -8
- package/package.json +1 -1
- package/src/core/config.ts +1 -1
- package/src/core/editor-gate.ts +21 -0
- package/src/core/page-edits.ts +70 -3
- package/src/core/sdk.ts +4 -1
- package/src/editor/editor-strings.ts +11 -0
- package/src/editor/editor-ui.ts +15 -1
- package/src/editor/liquid-field.ts +17 -2
- package/src/editor/visual-editor.ts +350 -75
|
@@ -35,6 +35,8 @@ export interface LiquidField {
|
|
|
35
35
|
insert(tag: string): void;
|
|
36
36
|
/** Close a pill's fallback popover; true when one was open. */
|
|
37
37
|
closePop(): boolean;
|
|
38
|
+
/** Open the fallback popover of the (first) pill of this variable path; false when there is none. */
|
|
39
|
+
openPill(path: string): boolean;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/** The words of a pill's fallback popover: `title` has `{name}`, the field's label. */
|
|
@@ -154,7 +156,7 @@ export function liquidField(opts: {
|
|
|
154
156
|
const input = h('input', { dir: 'auto', 'data-j': 'fallback', 'aria-label': title, maxlength: '200' });
|
|
155
157
|
input.value = varFallback(v.src) || '';
|
|
156
158
|
const err = h('div', { class: 'err', 'data-j': 'fallback-error', role: 'alert' });
|
|
157
|
-
const done = h('button', { class: 'vc', type: 'button', 'data-j': 'fallback-done' }, words.done);
|
|
159
|
+
const done = h('button', { class: 'vc ui', type: 'button', 'data-j': 'fallback-done' }, words.done);
|
|
158
160
|
const p = h('div', { class: 'pk fbp', role: 'dialog', 'aria-label': title, 'data-j': 'fallback-pop' }, h('label', { class: 'lbl' }, title), input, err, h('div', { class: 'help2' }, words.help), done);
|
|
159
161
|
const finish = () => {
|
|
160
162
|
closePop();
|
|
@@ -183,6 +185,11 @@ export function liquidField(opts: {
|
|
|
183
185
|
}
|
|
184
186
|
});
|
|
185
187
|
done.addEventListener('click', finish);
|
|
188
|
+
// Focus leaving the popover (Tab away, a click elsewhere) closes it.
|
|
189
|
+
p.addEventListener('focusout', (e) => {
|
|
190
|
+
const to = e.relatedTarget as Node | null;
|
|
191
|
+
if (pop === p && (!to || !p.contains(to))) closePop();
|
|
192
|
+
});
|
|
186
193
|
pop = p;
|
|
187
194
|
el.appendChild(p);
|
|
188
195
|
input.focus();
|
|
@@ -297,5 +304,13 @@ export function liquidField(opts: {
|
|
|
297
304
|
emit();
|
|
298
305
|
};
|
|
299
306
|
|
|
300
|
-
|
|
307
|
+
const openPill = (path: string): boolean => {
|
|
308
|
+
if (!box || box.tagName !== 'DIV') return false;
|
|
309
|
+
const target = Array.from(box.querySelectorAll(`[${PILL_ATTR}]`)).filter((n) => n.getAttribute('data-path') === path)[0] as HTMLElement | undefined;
|
|
310
|
+
if (!target) return false;
|
|
311
|
+
openPop(target);
|
|
312
|
+
return true;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
return { el, set, insert, closePop, openPill };
|
|
301
316
|
}
|