@openleaf-editor/ui 0.1.0-beta.0 → 0.1.0-beta.2
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/content-css.d.ts +13 -0
- package/dist/content-css.d.ts.map +1 -0
- package/dist/content-css.js +57 -0
- package/dist/content-css.js.map +1 -0
- package/dist/dialog.d.ts +87 -2
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +358 -68
- package/dist/dialog.js.map +1 -1
- package/dist/floating.d.ts +25 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +82 -0
- package/dist/floating.js.map +1 -0
- package/dist/help.d.ts +9 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +73 -0
- package/dist/help.js.map +1 -0
- package/dist/i18n.d.ts +31 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +89 -0
- package/dist/i18n.js.map +1 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +17 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/items.d.ts +2 -0
- package/dist/items.d.ts.map +1 -1
- package/dist/items.js +81 -4
- package/dist/items.js.map +1 -1
- package/dist/menu.d.ts +56 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +360 -0
- package/dist/menu.js.map +1 -0
- package/dist/openleaf.css +216 -0
- package/dist/overflow.d.ts +17 -0
- package/dist/overflow.d.ts.map +1 -0
- package/dist/overflow.js +138 -0
- package/dist/overflow.js.map +1 -0
- package/dist/pickers.d.ts +43 -0
- package/dist/pickers.d.ts.map +1 -0
- package/dist/pickers.js +52 -0
- package/dist/pickers.js.map +1 -0
- package/dist/registry.d.ts +49 -8
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +14 -0
- package/dist/registry.js.map +1 -1
- package/dist/styles.d.ts +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +216 -0
- package/dist/styles.js.map +1 -1
- package/dist/toolbar.d.ts +20 -0
- package/dist/toolbar.d.ts.map +1 -1
- package/dist/toolbar.js +181 -21
- package/dist/toolbar.js.map +1 -1
- package/dist/upload.d.ts +95 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +104 -0
- package/dist/upload.js.map +1 -0
- package/package.json +2 -2
package/dist/dialog.js
CHANGED
|
@@ -6,8 +6,22 @@
|
|
|
6
6
|
* is a few hundred lines that would then owe real screen reader testing to be
|
|
7
7
|
* worth anything, and the native element is already tested by the browser
|
|
8
8
|
* vendors. Choosing it is the single biggest accessibility win available here.
|
|
9
|
+
*
|
|
10
|
+
* ## Why committing is asynchronous
|
|
11
|
+
*
|
|
12
|
+
* The image dialog uploads a file, and an upload is the one thing in this editor
|
|
13
|
+
* that can take five seconds and fail for a reason the author needs to read. So
|
|
14
|
+
* the form's commit step returns a promise: the dialog stays open while it runs,
|
|
15
|
+
* disables its buttons, says what it is doing in a polite live region, and on
|
|
16
|
+
* failure shows the message and keeps everything the author typed.
|
|
17
|
+
*
|
|
18
|
+
* The alternative -- close the dialog, upload in the background, report through a
|
|
19
|
+
* toast -- loses the alt text they wrote when the upload fails, and makes the
|
|
20
|
+
* retry a whole new dialog.
|
|
9
21
|
*/
|
|
10
22
|
import { ensureStyles } from './styles.js';
|
|
23
|
+
import { IMAGE_ACCEPT, dimension } from './upload.js';
|
|
24
|
+
import { filePickerFor, listedImageClasses, listedImages, listedLinks, } from './pickers.js';
|
|
11
25
|
const DIALOG_CSS = `
|
|
12
26
|
.ol-dialog {
|
|
13
27
|
box-sizing: border-box;
|
|
@@ -25,13 +39,15 @@ const DIALOG_CSS = `
|
|
|
25
39
|
.ol-dialog h2 { margin: 0; font-size: 1.1em; }
|
|
26
40
|
.ol-dialog label { display: grid; gap: 4px; font-weight: 500; }
|
|
27
41
|
.ol-dialog .ol-hint { font-weight: 400; font-size: .9em; opacity: .75; }
|
|
28
|
-
.ol-dialog input[type="text"], .ol-dialog input[type="url"]
|
|
42
|
+
.ol-dialog input[type="text"], .ol-dialog input[type="url"], .ol-dialog input[type="file"],
|
|
43
|
+
.ol-dialog input[type="color"], .ol-dialog input[type="number"], .ol-dialog select {
|
|
29
44
|
box-sizing: border-box; width: 100%; padding: 6px 8px;
|
|
30
45
|
border: 1px solid var(--openleaf-color-border, #d1d9e0);
|
|
31
46
|
border-radius: var(--openleaf-radius, 4px);
|
|
32
47
|
background: var(--openleaf-color-surface, #fff);
|
|
33
48
|
color: inherit; font: inherit;
|
|
34
49
|
}
|
|
50
|
+
.ol-dialog input[type="color"] { height: 2.25rem; padding: 2px; }
|
|
35
51
|
.ol-dialog .ol-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
|
|
36
52
|
.ol-dialog .ol-check input { margin: 0; }
|
|
37
53
|
.ol-dialog .ol-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
@@ -50,10 +66,12 @@ const DIALOG_CSS = `
|
|
|
50
66
|
.ol-dialog button:focus-visible {
|
|
51
67
|
outline: 2px solid var(--openleaf-color-focus, #0969da); outline-offset: 1px;
|
|
52
68
|
}
|
|
69
|
+
.ol-dialog button[aria-disabled="true"] { opacity: .55; cursor: default; }
|
|
53
70
|
.ol-dialog .ol-error { color: #cf222e; font-size: .9em; min-height: 1.2em; }
|
|
71
|
+
.ol-dialog .ol-progress { font-size: .9em; opacity: .8; min-height: 1.2em; }
|
|
54
72
|
`;
|
|
55
73
|
let dialogStylesReady = false;
|
|
56
|
-
function ensureDialogStyles(doc) {
|
|
74
|
+
export function ensureDialogStyles(doc) {
|
|
57
75
|
ensureStyles(doc);
|
|
58
76
|
if (dialogStylesReady)
|
|
59
77
|
return;
|
|
@@ -75,14 +93,15 @@ function ensureDialogStyles(doc) {
|
|
|
75
93
|
dialogStylesReady = true;
|
|
76
94
|
}
|
|
77
95
|
/**
|
|
78
|
-
* Build and show a modal form, resolving to
|
|
96
|
+
* Build and show a modal form, resolving to whatever `commit` produced or null
|
|
97
|
+
* on cancel.
|
|
79
98
|
*
|
|
80
99
|
* Focus is returned to whatever held it before opening. `<dialog>` does this
|
|
81
100
|
* itself in current browsers, but it is done explicitly because "where did my
|
|
82
101
|
* cursor go" is the most common complaint about editor dialogs and relying on
|
|
83
102
|
* an implementation detail for it is not good enough.
|
|
84
103
|
*/
|
|
85
|
-
function showForm(doc, title, fields, options = {},
|
|
104
|
+
function showForm(doc, title, fields, options = {}, commit = () => ({ error: 'This form has nothing to do.' })) {
|
|
86
105
|
ensureDialogStyles(doc);
|
|
87
106
|
const previouslyFocused = doc.activeElement;
|
|
88
107
|
const dialog = doc.createElement('dialog');
|
|
@@ -95,6 +114,12 @@ function showForm(doc, title, fields, options = {}, validate) {
|
|
|
95
114
|
heading.id = headingId;
|
|
96
115
|
dialog.setAttribute('aria-labelledby', headingId);
|
|
97
116
|
form.appendChild(heading);
|
|
117
|
+
if (options.note) {
|
|
118
|
+
const note = doc.createElement('div');
|
|
119
|
+
note.className = 'ol-hint';
|
|
120
|
+
note.textContent = options.note;
|
|
121
|
+
form.appendChild(note);
|
|
122
|
+
}
|
|
98
123
|
const inputs = new Map();
|
|
99
124
|
for (const field of fields) {
|
|
100
125
|
const label = doc.createElement('label');
|
|
@@ -107,16 +132,75 @@ function showForm(doc, title, fields, options = {}, validate) {
|
|
|
107
132
|
hint.textContent = field.hint;
|
|
108
133
|
label.appendChild(hint);
|
|
109
134
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
135
|
+
let control;
|
|
136
|
+
if (field.options) {
|
|
137
|
+
const select = doc.createElement('select');
|
|
138
|
+
select.name = field.name;
|
|
139
|
+
for (const option of field.options) {
|
|
140
|
+
const item = doc.createElement('option');
|
|
141
|
+
item.value = option.value;
|
|
142
|
+
item.textContent = option.label;
|
|
143
|
+
if (option.value === (field.value ?? ''))
|
|
144
|
+
item.selected = true;
|
|
145
|
+
select.appendChild(item);
|
|
146
|
+
}
|
|
147
|
+
control = select;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const input = doc.createElement('input');
|
|
151
|
+
input.type = field.type ?? 'text';
|
|
152
|
+
input.name = field.name;
|
|
153
|
+
if (field.type === 'file') {
|
|
154
|
+
if (field.accept)
|
|
155
|
+
input.accept = field.accept;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
input.value = field.value ?? '';
|
|
159
|
+
}
|
|
160
|
+
control = input;
|
|
161
|
+
}
|
|
162
|
+
// `required` is deliberately not set on the element. The browser's own
|
|
163
|
+
// validation bubble cannot be read by a screen reader in every engine and
|
|
164
|
+
// cannot express "one of these two fields"; the commit step reports into a
|
|
165
|
+
// live region instead.
|
|
166
|
+
label.appendChild(control);
|
|
167
|
+
inputs.set(field.name, control);
|
|
118
168
|
form.appendChild(label);
|
|
119
169
|
}
|
|
170
|
+
// Wired after the loop, so a chooser can fill a field declared after it.
|
|
171
|
+
for (const field of fields) {
|
|
172
|
+
if (!field.fills)
|
|
173
|
+
continue;
|
|
174
|
+
const source = inputs.get(field.name);
|
|
175
|
+
const target = inputs.get(field.fills);
|
|
176
|
+
if (!source || !target)
|
|
177
|
+
continue;
|
|
178
|
+
source.addEventListener('change', () => {
|
|
179
|
+
if (source.value !== '')
|
|
180
|
+
target.value = source.value;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (options.browse) {
|
|
184
|
+
const browse = doc.createElement('button');
|
|
185
|
+
browse.type = 'button';
|
|
186
|
+
browse.textContent = options.browse.label;
|
|
187
|
+
browse.addEventListener('click', () => {
|
|
188
|
+
void options.browse?.fill().then((filled) => {
|
|
189
|
+
if (!filled)
|
|
190
|
+
return;
|
|
191
|
+
for (const [name, value] of Object.entries(filled)) {
|
|
192
|
+
const control = inputs.get(name);
|
|
193
|
+
if (control && control instanceof HTMLInputElement && control.type !== 'file') {
|
|
194
|
+
control.value = value;
|
|
195
|
+
}
|
|
196
|
+
else if (control) {
|
|
197
|
+
control.value = value;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
form.appendChild(browse);
|
|
203
|
+
}
|
|
120
204
|
let checkbox = null;
|
|
121
205
|
if (options.extraCheckbox) {
|
|
122
206
|
const wrap = doc.createElement('label');
|
|
@@ -137,10 +221,16 @@ function showForm(doc, title, fields, options = {}, validate) {
|
|
|
137
221
|
form.appendChild(hint);
|
|
138
222
|
}
|
|
139
223
|
}
|
|
224
|
+
// Progress and failure are separate regions with different urgency. An upload
|
|
225
|
+
// starting is polite news; an upload failing is something the author must act
|
|
226
|
+
// on, and role="alert" is what makes it interrupt.
|
|
227
|
+
const progress = doc.createElement('div');
|
|
228
|
+
progress.className = 'ol-progress';
|
|
229
|
+
progress.setAttribute('role', 'status');
|
|
230
|
+
progress.setAttribute('aria-live', 'polite');
|
|
231
|
+
form.appendChild(progress);
|
|
140
232
|
const error = doc.createElement('div');
|
|
141
233
|
error.className = 'ol-error';
|
|
142
|
-
// Announced when it changes, so a validation failure is not silent for a
|
|
143
|
-
// screen reader user who cannot see the red text appear.
|
|
144
234
|
error.setAttribute('role', 'alert');
|
|
145
235
|
form.appendChild(error);
|
|
146
236
|
const actions = doc.createElement('div');
|
|
@@ -157,49 +247,128 @@ function showForm(doc, title, fields, options = {}, validate) {
|
|
|
157
247
|
dialog.appendChild(form);
|
|
158
248
|
doc.body.appendChild(dialog);
|
|
159
249
|
return new Promise((resolve) => {
|
|
250
|
+
let busy = false;
|
|
160
251
|
const finish = (result) => {
|
|
161
252
|
dialog.close();
|
|
162
253
|
dialog.remove();
|
|
163
254
|
previouslyFocused?.focus?.();
|
|
164
255
|
resolve(result);
|
|
165
256
|
};
|
|
166
|
-
|
|
167
|
-
|
|
257
|
+
const setBusy = (value) => {
|
|
258
|
+
busy = value;
|
|
259
|
+
form.setAttribute('aria-busy', value ? 'true' : 'false');
|
|
260
|
+
for (const button of [ok, cancel]) {
|
|
261
|
+
// aria-disabled rather than the disabled attribute, for the same reason
|
|
262
|
+
// the toolbar uses it: a disabled button leaves the tab order, so a
|
|
263
|
+
// screen reader user loses track of where they are mid-upload.
|
|
264
|
+
button.setAttribute('aria-disabled', value ? 'true' : 'false');
|
|
265
|
+
}
|
|
266
|
+
ok.textContent = value ? (options.busyLabel ?? 'Working…') : 'Save';
|
|
267
|
+
progress.textContent = value ? (options.busyLabel ?? 'Working…') : '';
|
|
268
|
+
};
|
|
269
|
+
cancel.addEventListener('click', () => {
|
|
270
|
+
// Cancelling mid-upload abandons the result rather than the request: there
|
|
271
|
+
// is no portable way to cancel somebody else's fetch, and pretending
|
|
272
|
+
// otherwise would leave the author thinking nothing was sent.
|
|
273
|
+
if (!busy)
|
|
274
|
+
finish(null);
|
|
275
|
+
});
|
|
168
276
|
dialog.addEventListener('cancel', (event) => {
|
|
169
277
|
event.preventDefault();
|
|
170
|
-
|
|
278
|
+
if (!busy)
|
|
279
|
+
finish(null);
|
|
171
280
|
});
|
|
172
281
|
form.addEventListener('submit', (event) => {
|
|
173
282
|
event.preventDefault();
|
|
283
|
+
if (busy)
|
|
284
|
+
return;
|
|
174
285
|
const values = {};
|
|
175
|
-
|
|
176
|
-
|
|
286
|
+
const files = {};
|
|
287
|
+
for (const [name, input] of inputs) {
|
|
288
|
+
if (input instanceof HTMLInputElement && input.type === 'file')
|
|
289
|
+
files[name] = input.files?.[0];
|
|
290
|
+
else
|
|
291
|
+
values[name] = input.value.trim();
|
|
292
|
+
}
|
|
177
293
|
if (checkbox)
|
|
178
294
|
values[checkbox.name] = checkbox.checked ? 'on' : '';
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
295
|
+
error.textContent = '';
|
|
296
|
+
let outcome;
|
|
297
|
+
try {
|
|
298
|
+
outcome = commit(values, files);
|
|
299
|
+
}
|
|
300
|
+
catch (thrown) {
|
|
301
|
+
error.textContent = messageFrom(thrown);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (!(outcome instanceof Promise)) {
|
|
305
|
+
if ('error' in outcome) {
|
|
306
|
+
error.textContent = outcome.error;
|
|
307
|
+
focusFirst();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
finish(outcome.value);
|
|
185
311
|
return;
|
|
186
312
|
}
|
|
187
|
-
|
|
313
|
+
setBusy(true);
|
|
314
|
+
void outcome
|
|
315
|
+
.then((settled) => {
|
|
316
|
+
setBusy(false);
|
|
317
|
+
if ('error' in settled) {
|
|
318
|
+
error.textContent = settled.error;
|
|
319
|
+
focusFirst();
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
finish(settled.value);
|
|
323
|
+
})
|
|
324
|
+
.catch((thrown) => {
|
|
325
|
+
setBusy(false);
|
|
326
|
+
error.textContent = messageFrom(thrown);
|
|
327
|
+
});
|
|
188
328
|
});
|
|
329
|
+
const focusFirst = () => {
|
|
330
|
+
const first = fields[0] ? inputs.get(fields[0].name) : undefined;
|
|
331
|
+
first?.focus();
|
|
332
|
+
};
|
|
189
333
|
dialog.showModal();
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
334
|
+
focusFirst();
|
|
335
|
+
const first = fields[0] ? inputs.get(fields[0].name) : undefined;
|
|
336
|
+
if (first instanceof HTMLInputElement && first.type !== 'file')
|
|
337
|
+
first.select();
|
|
193
338
|
});
|
|
194
339
|
}
|
|
340
|
+
/** A failure message worth showing an author, from whatever was thrown. */
|
|
341
|
+
function messageFrom(thrown) {
|
|
342
|
+
const message = thrown instanceof Error ? thrown.message : String(thrown);
|
|
343
|
+
return message === '' ? 'Something went wrong.' : message;
|
|
344
|
+
}
|
|
195
345
|
function hash(value) {
|
|
196
346
|
let out = 0;
|
|
197
347
|
for (let i = 0; i < value.length; i += 1)
|
|
198
348
|
out = (out * 31 + value.charCodeAt(i)) | 0;
|
|
199
349
|
return out;
|
|
200
350
|
}
|
|
201
|
-
|
|
202
|
-
|
|
351
|
+
/**
|
|
352
|
+
* A generic modal form, used by table property dialogs and anything else that
|
|
353
|
+
* is a handful of labelled fields rather than a specialised prompt.
|
|
354
|
+
*/
|
|
355
|
+
export function promptFields(doc, title, fields, options, commit) {
|
|
356
|
+
return showForm(doc, title, fields, options, commit);
|
|
357
|
+
}
|
|
358
|
+
export async function promptForLink(doc, existing, host) {
|
|
359
|
+
const listed = listedLinks();
|
|
360
|
+
const picker = host ? filePickerFor(host) : null;
|
|
361
|
+
const fields = [
|
|
362
|
+
...(listed.length > 0
|
|
363
|
+
? [
|
|
364
|
+
{
|
|
365
|
+
name: 'listed',
|
|
366
|
+
label: 'Choose a page',
|
|
367
|
+
options: [{ value: '', label: 'Type an address instead' }, ...listed.map((item) => ({ value: item.value, label: item.title }))],
|
|
368
|
+
fills: 'href',
|
|
369
|
+
},
|
|
370
|
+
]
|
|
371
|
+
: []),
|
|
203
372
|
{
|
|
204
373
|
name: 'href',
|
|
205
374
|
label: 'Address',
|
|
@@ -208,7 +377,15 @@ export async function promptForLink(doc, existing) {
|
|
|
208
377
|
required: true,
|
|
209
378
|
hint: 'For example https://example.org, /about, or mailto:someone@example.org',
|
|
210
379
|
},
|
|
211
|
-
|
|
380
|
+
{
|
|
381
|
+
name: 'title',
|
|
382
|
+
label: 'Title',
|
|
383
|
+
type: 'text',
|
|
384
|
+
value: existing?.title ?? '',
|
|
385
|
+
hint: 'Shown as a tooltip. Optional.',
|
|
386
|
+
},
|
|
387
|
+
];
|
|
388
|
+
return showForm(doc, existing?.href ? 'Edit link' : 'Insert link', fields, {
|
|
212
389
|
extraCheckbox: {
|
|
213
390
|
name: 'newWindow',
|
|
214
391
|
label: 'Open in a new window',
|
|
@@ -216,51 +393,164 @@ export async function promptForLink(doc, existing) {
|
|
|
216
393
|
hint: 'Opening in a new window without warning can disorient people using ' +
|
|
217
394
|
'screen readers or magnification. Leave this off unless you have a reason.',
|
|
218
395
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
396
|
+
...(picker && host
|
|
397
|
+
? {
|
|
398
|
+
browse: {
|
|
399
|
+
label: 'Browse files',
|
|
400
|
+
fill: async () => {
|
|
401
|
+
const picked = await picker({ kind: 'file', host });
|
|
402
|
+
if (!picked)
|
|
403
|
+
return null;
|
|
404
|
+
return { href: picked.url, title: picked.title ?? '' };
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
}
|
|
408
|
+
: {}),
|
|
409
|
+
}, (values) => {
|
|
410
|
+
// The address field alone: choosing from the list writes into it, so there
|
|
411
|
+
// is no second place a destination can hide.
|
|
412
|
+
const href = values['href'] || '';
|
|
413
|
+
if (!href)
|
|
414
|
+
return { error: 'Enter an address for the link.' };
|
|
415
|
+
const newWindow = values['newWindow'] === 'on';
|
|
416
|
+
return {
|
|
417
|
+
value: {
|
|
418
|
+
href,
|
|
419
|
+
title: values['title'] || null,
|
|
420
|
+
target: newWindow ? '_blank' : null,
|
|
421
|
+
rel: newWindow ? 'noopener noreferrer' : null,
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
});
|
|
230
425
|
}
|
|
231
|
-
export async function promptForImage(doc) {
|
|
232
|
-
const
|
|
233
|
-
|
|
426
|
+
export async function promptForImage(doc, options = {}) {
|
|
427
|
+
const { file, upload, host, existing } = options;
|
|
428
|
+
const listed = listedImages();
|
|
429
|
+
const classes = listedImageClasses();
|
|
430
|
+
const picker = host ? filePickerFor(host) : null;
|
|
431
|
+
const describe = {
|
|
432
|
+
name: 'alt',
|
|
433
|
+
label: 'Alternative text',
|
|
434
|
+
type: 'text',
|
|
435
|
+
value: existing?.alt ?? '',
|
|
436
|
+
hint: 'Describe what the image shows, for people who cannot see it.',
|
|
437
|
+
};
|
|
438
|
+
const extras = [
|
|
439
|
+
{
|
|
440
|
+
name: 'title',
|
|
441
|
+
label: 'Title',
|
|
442
|
+
type: 'text',
|
|
443
|
+
value: existing?.title ?? '',
|
|
444
|
+
hint: 'Shown as a tooltip. Optional.',
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: 'align',
|
|
448
|
+
label: 'Alignment',
|
|
449
|
+
options: [
|
|
450
|
+
{ value: '', label: 'None' },
|
|
451
|
+
{ value: 'left', label: 'Float left' },
|
|
452
|
+
{ value: 'center', label: 'Centre' },
|
|
453
|
+
{ value: 'right', label: 'Float right' },
|
|
454
|
+
],
|
|
455
|
+
value: existing?.align ?? '',
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: 'className',
|
|
459
|
+
label: 'CSS classes',
|
|
460
|
+
type: 'text',
|
|
461
|
+
value: existing?.className ?? '',
|
|
462
|
+
hint: classes.length > 0 ? `Suggested: ${classes.join(', ')}` : 'Optional class names, separated by spaces.',
|
|
463
|
+
},
|
|
234
464
|
{
|
|
235
|
-
name: '
|
|
236
|
-
label: '
|
|
465
|
+
name: 'caption',
|
|
466
|
+
label: 'Caption',
|
|
237
467
|
type: 'text',
|
|
238
|
-
|
|
468
|
+
value: existing?.caption ?? '',
|
|
469
|
+
hint: 'Wraps the image in a figure. Leave blank for no caption.',
|
|
239
470
|
},
|
|
240
|
-
]
|
|
471
|
+
];
|
|
472
|
+
const fields = file
|
|
473
|
+
? [describe, ...extras]
|
|
474
|
+
: [
|
|
475
|
+
...(listed.length > 0
|
|
476
|
+
? [
|
|
477
|
+
{
|
|
478
|
+
name: 'listed',
|
|
479
|
+
label: 'Choose an image',
|
|
480
|
+
options: [{ value: '', label: 'Type an address instead' }, ...listed.map((item) => ({ value: item.value, label: item.title }))],
|
|
481
|
+
fills: 'src',
|
|
482
|
+
},
|
|
483
|
+
]
|
|
484
|
+
: []),
|
|
485
|
+
...(upload
|
|
486
|
+
? [
|
|
487
|
+
{
|
|
488
|
+
name: 'file',
|
|
489
|
+
label: 'Choose a file',
|
|
490
|
+
type: 'file',
|
|
491
|
+
accept: IMAGE_ACCEPT,
|
|
492
|
+
hint: 'PNG, JPEG, GIF, WebP or AVIF.',
|
|
493
|
+
},
|
|
494
|
+
]
|
|
495
|
+
: []),
|
|
496
|
+
{
|
|
497
|
+
name: 'src',
|
|
498
|
+
label: upload ? 'Or paste an image address' : 'Image address',
|
|
499
|
+
type: 'text',
|
|
500
|
+
value: existing?.src ?? '',
|
|
501
|
+
required: !upload,
|
|
502
|
+
},
|
|
503
|
+
describe,
|
|
504
|
+
...extras,
|
|
505
|
+
];
|
|
506
|
+
const finish = (src, alt, width, height, values) => ({
|
|
507
|
+
src,
|
|
508
|
+
alt,
|
|
509
|
+
title: values['title'] || null,
|
|
510
|
+
width,
|
|
511
|
+
height,
|
|
512
|
+
className: values['className'] || null,
|
|
513
|
+
align: values['align'] === 'left' || values['align'] === 'right' || values['align'] === 'center'
|
|
514
|
+
? values['align']
|
|
515
|
+
: null,
|
|
516
|
+
caption: values['caption'] ? values['caption'] : null,
|
|
517
|
+
});
|
|
518
|
+
return showForm(doc, file ? 'Describe this image' : 'Insert image', fields, {
|
|
241
519
|
extraCheckbox: {
|
|
242
520
|
name: 'decorative',
|
|
243
521
|
label: 'This image is decorative and needs no description',
|
|
244
522
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
523
|
+
...(file ? { note: `Ready to upload: ${file.name}` } : {}),
|
|
524
|
+
busyLabel: 'Uploading…',
|
|
525
|
+
...(picker && host
|
|
526
|
+
? {
|
|
527
|
+
browse: {
|
|
528
|
+
label: 'Browse files',
|
|
529
|
+
fill: async () => {
|
|
530
|
+
const picked = await picker({ kind: 'image', host });
|
|
531
|
+
if (!picked)
|
|
532
|
+
return null;
|
|
533
|
+
return { src: picked.url, alt: picked.alt ?? '', title: picked.title ?? '' };
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
}
|
|
537
|
+
: {}),
|
|
538
|
+
}, (values, files) => {
|
|
539
|
+
const chosen = file ?? files['file'];
|
|
540
|
+
const src = values['src'] || '';
|
|
541
|
+
if (!chosen && !src) {
|
|
542
|
+
return { error: upload ? 'Choose a file or enter an image address.' : 'Enter an image address.' };
|
|
254
543
|
}
|
|
255
|
-
|
|
544
|
+
if (!values['alt'] && values['decorative'] !== 'on') {
|
|
545
|
+
return { error: 'Add alternative text, or tick the decorative box.' };
|
|
546
|
+
}
|
|
547
|
+
const alt = values['decorative'] === 'on' ? '' : (values['alt'] ?? '');
|
|
548
|
+
if (!chosen || !upload) {
|
|
549
|
+
return { value: finish(src, alt, null, null, values) };
|
|
550
|
+
}
|
|
551
|
+
return upload(chosen).then((result) => ({
|
|
552
|
+
value: finish(result.src, alt, dimension(result.width), dimension(result.height), values),
|
|
553
|
+
}));
|
|
256
554
|
});
|
|
257
|
-
if (!values)
|
|
258
|
-
return null;
|
|
259
|
-
return {
|
|
260
|
-
src: values['src'] ?? '',
|
|
261
|
-
// Explicitly empty for decorative images: alt="" tells a screen reader to
|
|
262
|
-
// skip it, whereas a missing alt makes it read the filename.
|
|
263
|
-
alt: values['decorative'] === 'on' ? '' : (values['alt'] ?? ''),
|
|
264
|
-
};
|
|
265
555
|
}
|
|
266
556
|
//# sourceMappingURL=dialog.js.map
|
package/dist/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../src/dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuB1C,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ClB,CAAA;AAED,IAAI,iBAAiB,GAAG,KAAK,CAAA;AAE7B,SAAS,kBAAkB,CAAC,GAAa;IACvC,YAAY,CAAC,GAAG,CAAC,CAAA;IACjB,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M,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;SAC1F,CAAC,CAAC,CAAA;IACL,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Floating toolbars: one for a non-empty selection, one for an empty block
|
|
3
|
+
* that is waiting to be filled.
|
|
4
|
+
*
|
|
5
|
+
* They reuse the same `Toolbar` class as the main bar so the keyboard model,
|
|
6
|
+
* live region and item registry stay in one place. Positioning is the only
|
|
7
|
+
* extra job, and it is deliberately pointer-driven: a keyboard user already
|
|
8
|
+
* has Alt+F10 for the main toolbar, and a second bar that jumps around under
|
|
9
|
+
* arrow keys is a focus trap waiting to happen.
|
|
10
|
+
*/
|
|
11
|
+
import type { EditorState } from 'prosemirror-state';
|
|
12
|
+
import type { EditorView } from 'prosemirror-view';
|
|
13
|
+
export declare const DEFAULT_SELECTION_LAYOUT = "bold italic underline | link";
|
|
14
|
+
export declare const DEFAULT_INSERT_LAYOUT = "link image horizontalRule";
|
|
15
|
+
export declare class FloatingToolbars {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(host: HTMLElement, doc: Document, options: {
|
|
18
|
+
selectionLayout?: string | null;
|
|
19
|
+
insertLayout?: string | null;
|
|
20
|
+
});
|
|
21
|
+
mount(view: EditorView): void;
|
|
22
|
+
update(state: EditorState): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=floating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../src/floating.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,eAAO,MAAM,wBAAwB,iCAAiC,CAAA;AACtE,eAAO,MAAM,qBAAqB,8BAA8B,CAAA;AAEhE,qBAAa,gBAAgB;;gBAQzB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;IAsB5E,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAM7B,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAMhC,OAAO,IAAI,IAAI;CA8BhB"}
|