@openleaf-editor/plugins-insert 0.1.0-beta.2 → 0.1.0-beta.4
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/README.md +43 -1
- package/dist/glyphs.d.ts +8 -0
- package/dist/glyphs.d.ts.map +1 -1
- package/dist/glyphs.js +8 -0
- package/dist/glyphs.js.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +172 -21
- package/dist/grid.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/openleaf-insert.css +60 -3
- package/dist/prompts.d.ts +9 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +86 -19
- package/dist/prompts.js.map +1 -1
- package/dist/resize.d.ts +23 -0
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +574 -26
- package/dist/resize.js.map +1 -1
- package/dist/styles.d.ts +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +60 -3
- package/dist/styles.js.map +1 -1
- package/package.json +16 -5
package/dist/prompts.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { insertAudio, insertDetails, insertHtml, insertIframe, insertNamedAnchor, insertVideo, setHeadingId, isNodeActive } from '@openleaf-editor/core';
|
|
1
|
+
import { embedSrcFor, insertAudio, insertDetails, insertHtml, insertIframe, insertNamedAnchor, insertVideo, selectedMedia, setHeadingId, updateMedia, isNodeActive } from '@openleaf-editor/core';
|
|
2
|
+
import { promptForMedia } from '@openleaf-editor/ui';
|
|
2
3
|
import { listedSnippets } from './snippets.js';
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* `host` is the editor to mount inside. Skin tokens are scoped to
|
|
6
|
+
* `.ol-editor[data-ol-skin]`, so a dialog appended to `document.body` never
|
|
7
|
+
* sees them; `showModal()` promotes to the top layer either way, so nesting is
|
|
8
|
+
* free.
|
|
9
|
+
*/
|
|
10
|
+
function ask(doc, title, fields, host) {
|
|
4
11
|
const dialog = doc.createElement('dialog');
|
|
5
12
|
dialog.className = 'ol-dialog';
|
|
6
13
|
const form = doc.createElement('form');
|
|
@@ -33,7 +40,7 @@ function ask(doc, title, fields) {
|
|
|
33
40
|
actions.append(cancel, ok);
|
|
34
41
|
form.appendChild(actions);
|
|
35
42
|
dialog.appendChild(form);
|
|
36
|
-
doc.body.appendChild(dialog);
|
|
43
|
+
(host && host.ownerDocument === doc ? host : doc.body).appendChild(dialog);
|
|
37
44
|
return new Promise((resolve) => {
|
|
38
45
|
const finish = (value) => {
|
|
39
46
|
dialog.close();
|
|
@@ -47,6 +54,9 @@ function ask(doc, title, fields) {
|
|
|
47
54
|
});
|
|
48
55
|
form.addEventListener('submit', (event) => {
|
|
49
56
|
event.preventDefault();
|
|
57
|
+
// Nested inside the editor this sits inside the host page's own <form>,
|
|
58
|
+
// and `submit` bubbles: inserting a video must not read as a page save.
|
|
59
|
+
event.stopPropagation();
|
|
50
60
|
const values = {};
|
|
51
61
|
for (const [name, input] of inputs)
|
|
52
62
|
values[name] = input.value.trim();
|
|
@@ -56,29 +66,86 @@ function ask(doc, title, fields) {
|
|
|
56
66
|
inputs.values().next().value?.focus();
|
|
57
67
|
});
|
|
58
68
|
}
|
|
69
|
+
/** Extensions that mean audio rather than video. */
|
|
70
|
+
const AUDIO_FILES = /\.(mp3|wav|ogg|oga|m4a|aac|flac|opus)(\?|#|$)/i;
|
|
71
|
+
/**
|
|
72
|
+
* Which node type an address wants to be.
|
|
73
|
+
*
|
|
74
|
+
* The alternatives are consulted too: a source-only player has no `src` to
|
|
75
|
+
* classify, and a set of `.ogg` sources is audio however little the empty main
|
|
76
|
+
* address says.
|
|
77
|
+
*/
|
|
78
|
+
function mediaKindFor(src, sources) {
|
|
79
|
+
if (src !== '' && embedSrcFor(src) !== null)
|
|
80
|
+
return 'iframe';
|
|
81
|
+
const addresses = [src, ...sources.map((source) => source.src)].filter((one) => one !== '');
|
|
82
|
+
if (addresses.length > 0 && addresses.every((one) => AUDIO_FILES.test(one)))
|
|
83
|
+
return 'audio';
|
|
84
|
+
return 'video';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Insert a player, or edit the one that is selected.
|
|
88
|
+
*
|
|
89
|
+
* The same toolbar button does both, because "insert" and "edit" are the same
|
|
90
|
+
* dialog with the fields already filled in, and a separate control for editing
|
|
91
|
+
* is one the author has to discover. `selectedMedia` returning null is what
|
|
92
|
+
* distinguishes them -- and it insists on a real node selection, so a caret that
|
|
93
|
+
* merely sits near a player still inserts a new one.
|
|
94
|
+
*/
|
|
59
95
|
export async function promptInsertMedia(view, host) {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
96
|
+
const current = selectedMedia(view.state);
|
|
97
|
+
const result = await promptForMedia(host.ownerDocument, {
|
|
98
|
+
host,
|
|
99
|
+
...(current
|
|
100
|
+
? {
|
|
101
|
+
existing: {
|
|
102
|
+
kind: current.kind,
|
|
103
|
+
src: current.src ?? '',
|
|
104
|
+
title: current.title,
|
|
105
|
+
poster: current.poster,
|
|
106
|
+
width: current.width,
|
|
107
|
+
height: current.height,
|
|
108
|
+
sources: current.sources.map((source) => ({ src: source.src, type: source.type ?? null })),
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
: {}),
|
|
112
|
+
});
|
|
113
|
+
if (!result) {
|
|
114
|
+
view.focus();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const attrs = {
|
|
118
|
+
src: result.src === '' ? null : result.src,
|
|
119
|
+
title: result.title,
|
|
120
|
+
poster: result.poster,
|
|
121
|
+
width: result.width,
|
|
122
|
+
height: result.height,
|
|
123
|
+
sources: result.sources.map((source) => ({ src: source.src, type: source.type })),
|
|
124
|
+
};
|
|
125
|
+
if (current) {
|
|
126
|
+
// Editing keeps the node type it already had. Retyping the address of a
|
|
127
|
+
// selected video into a YouTube link should change the address, not silently
|
|
128
|
+
// replace the node with an iframe and drop the sources beside it.
|
|
129
|
+
updateMedia(attrs)(view.state, view.dispatch, view);
|
|
130
|
+
view.focus();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const kind = mediaKindFor(result.src, result.sources);
|
|
134
|
+
if (kind === 'iframe') {
|
|
135
|
+
// The converted address, not what the author typed: `insertIframe` runs the
|
|
136
|
+
// value past the same allowlist, which refuses a watch page.
|
|
137
|
+
insertIframe({ ...attrs, src: embedSrcFor(result.src) })(view.state, view.dispatch, view);
|
|
65
138
|
view.focus();
|
|
66
139
|
return;
|
|
67
140
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const kind = /youtube|vimeo|dailymotion|spotify|soundcloud|twitch|google\.com\/maps/i.test(src)
|
|
71
|
-
? insertIframe
|
|
72
|
-
: /\.(mp3|wav|ogg|m4a)(\?|$)/i.test(src)
|
|
73
|
-
? insertAudio
|
|
74
|
-
: insertVideo;
|
|
75
|
-
kind({ src, title })(view.state, view.dispatch, view);
|
|
141
|
+
const insert = kind === 'audio' ? insertAudio : insertVideo;
|
|
142
|
+
insert(attrs)(view.state, view.dispatch, view);
|
|
76
143
|
view.focus();
|
|
77
144
|
}
|
|
78
145
|
export async function promptInsertDetails(view, host) {
|
|
79
146
|
const values = await ask(host.ownerDocument, 'Collapsible section', [
|
|
80
147
|
{ name: 'summary', label: 'Summary', value: 'Details' },
|
|
81
|
-
]);
|
|
148
|
+
], host);
|
|
82
149
|
if (!values) {
|
|
83
150
|
view.focus();
|
|
84
151
|
return;
|
|
@@ -87,7 +154,7 @@ export async function promptInsertDetails(view, host) {
|
|
|
87
154
|
view.focus();
|
|
88
155
|
}
|
|
89
156
|
export async function promptInsertAnchor(view, host) {
|
|
90
|
-
const values = await ask(host.ownerDocument, 'Named anchor', [{ name: 'id', label: 'Name' }]);
|
|
157
|
+
const values = await ask(host.ownerDocument, 'Named anchor', [{ name: 'id', label: 'Name' }], host);
|
|
91
158
|
if (!values?.['id']) {
|
|
92
159
|
view.focus();
|
|
93
160
|
return;
|
|
@@ -108,7 +175,7 @@ export async function promptInsertSnippet(view, host) {
|
|
|
108
175
|
}
|
|
109
176
|
const values = await ask(host.ownerDocument, 'Insert snippet', [
|
|
110
177
|
{ name: 'id', label: `Snippet id (${available.map((s) => s.id).join(', ')})` },
|
|
111
|
-
]);
|
|
178
|
+
], host);
|
|
112
179
|
const found = available.find((s) => s.id === values?.['id'] || s.title === values?.['id']);
|
|
113
180
|
if (!found) {
|
|
114
181
|
view.focus();
|
package/dist/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACjM,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C;;;;;GAKG;AACH,SAAS,GAAG,CAAC,GAAa,EAAE,KAAa,EAAE,MAA8D,EAAE,IAAkB;IAC3H,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC1C,MAAM,CAAC,SAAS,GAAG,WAAW,CAAA;IAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IACtC,IAAI,CAAC,MAAM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C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAC1F,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,OAAM;IACR,CAAC;IACD,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACvD,IAAI,CAAC,KAAK,EAAE,CAAA;AACd,CAAC"}
|
package/dist/resize.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
1
|
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
/**
|
|
3
|
+
* The node types this plugin gives a resize handle.
|
|
4
|
+
*
|
|
5
|
+
* Not `audio`: its spec declares no `width`/`height`, because an audio player
|
|
6
|
+
* has no intrinsic box -- only the height of whatever controls the browser
|
|
7
|
+
* draws. A handle there would write dimensions the schema drops on the next
|
|
8
|
+
* parse, which is a control that appears to work and does not.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RESIZABLE_MEDIA: readonly ["image", "video"];
|
|
11
|
+
export type ResizableKind = (typeof RESIZABLE_MEDIA)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Drag-resize handles for the media that has a box to drag.
|
|
14
|
+
*
|
|
15
|
+
* One plugin for both kinds rather than one per kind: a `nodeViews` prop is a
|
|
16
|
+
* map keyed by node name, so two plugins each claiming `image` would not
|
|
17
|
+
* compose -- the later registration would simply win, and which one that is
|
|
18
|
+
* depends on install order.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mediaResizePlugin(): Plugin;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use `mediaResizePlugin`, which also handles video. Kept because
|
|
23
|
+
* this name is in the published API of 0.1.0-beta.2.
|
|
24
|
+
*/
|
|
2
25
|
export declare function imageResizePlugin(): Plugin;
|
|
3
26
|
//# sourceMappingURL=resize.d.ts.map
|
package/dist/resize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../src/resize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../src/resize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AA4B1C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,6BAA8B,CAAA;AAE1D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AA0kB5D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA+B1C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|