@openleaf-editor/plugins-insert 0.1.0-beta.3 → 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/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +44 -22
- package/dist/grid.js.map +1 -1
- package/dist/openleaf-insert.css +1 -1
- package/dist/styles.d.ts +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +1 -1
- package/package.json +5 -5
package/dist/grid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../src/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../src/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AA+B3F,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACrD,GACA,cAAc,CAoPhB"}
|
package/dist/grid.js
CHANGED
|
@@ -2,6 +2,29 @@ import { iconElement } from '@openleaf-editor/ui';
|
|
|
2
2
|
import { insertText } from '@openleaf-editor/core';
|
|
3
3
|
import { GLYPH_COLUMNS } from './glyphs.js';
|
|
4
4
|
const SUPPORTS_POPOVER = typeof HTMLElement !== 'undefined' && 'popover' in HTMLElement.prototype;
|
|
5
|
+
/**
|
|
6
|
+
* True when focus is moving into one of `roots`, including across shadow trees.
|
|
7
|
+
*
|
|
8
|
+
* `document.activeElement` is the shadow host from outside the tree, so a
|
|
9
|
+
* deferred check against it closes the panel the moment a glyph is focused.
|
|
10
|
+
* `relatedTarget` is the node that actually received focus; walking its
|
|
11
|
+
* composed ancestors covers a retargeted event the same way.
|
|
12
|
+
*/
|
|
13
|
+
function relatedInside(event, ...roots) {
|
|
14
|
+
let node = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
15
|
+
while (node) {
|
|
16
|
+
const current = node;
|
|
17
|
+
if (roots.some((root) => current === root || root.contains(current)))
|
|
18
|
+
return true;
|
|
19
|
+
if (current.parentNode) {
|
|
20
|
+
node = current.parentNode;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const tree = current.getRootNode();
|
|
24
|
+
node = tree instanceof ShadowRoot ? tree.host : null;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
5
28
|
export function buildGlyphPicker(ctx, options) {
|
|
6
29
|
const { view, host } = ctx;
|
|
7
30
|
const doc = host.ownerDocument;
|
|
@@ -52,10 +75,6 @@ export function buildGlyphPicker(ctx, options) {
|
|
|
52
75
|
row?.appendChild(button);
|
|
53
76
|
});
|
|
54
77
|
wrap.appendChild(trigger);
|
|
55
|
-
if (!SUPPORTS_POPOVER)
|
|
56
|
-
wrap.appendChild(grid);
|
|
57
|
-
else
|
|
58
|
-
doc.body.appendChild(grid);
|
|
59
78
|
const isOpen = () => SUPPORTS_POPOVER ? grid.matches(':popover-open') : !grid.hidden;
|
|
60
79
|
const close = (options = {}) => {
|
|
61
80
|
trigger.setAttribute('aria-expanded', 'false');
|
|
@@ -102,6 +121,14 @@ export function buildGlyphPicker(ctx, options) {
|
|
|
102
121
|
button.focus();
|
|
103
122
|
};
|
|
104
123
|
const open = () => {
|
|
124
|
+
if (!grid.isConnected) {
|
|
125
|
+
// On the host, not document.body. A body-mounted popover leaves a
|
|
126
|
+
// shadow-root editor, so document.activeElement is the host and a 0ms
|
|
127
|
+
// focusout timeout closes the panel as it opens. Same reason the colour
|
|
128
|
+
// picker and table grid append here -- and so skin tokens scoped to
|
|
129
|
+
// `.ol-editor` actually reach the panel.
|
|
130
|
+
host.appendChild(grid);
|
|
131
|
+
}
|
|
105
132
|
trigger.setAttribute('aria-expanded', 'true');
|
|
106
133
|
if (!SUPPORTS_POPOVER)
|
|
107
134
|
grid.hidden = false;
|
|
@@ -139,13 +166,12 @@ export function buildGlyphPicker(ctx, options) {
|
|
|
139
166
|
/*
|
|
140
167
|
* Tab is handled, and that reverses the note below about leaving it alone.
|
|
141
168
|
*
|
|
142
|
-
* Leaving it to the engine is correct in Chromium:
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* the arrow-key model was added to prevent.
|
|
169
|
+
* Leaving it to the engine is correct in Chromium: Tab walks off the
|
|
170
|
+
* grid's single tab stop and the focusout handler closes the panel.
|
|
171
|
+
* Firefox does not move focus at all -- measured, not inferred: after
|
|
172
|
+
* Tab, focus is still the cell and the popover is still open. That is a
|
|
173
|
+
* keyboard trap (WCAG 2.1.2 No Keyboard Trap), and Escape being the only
|
|
174
|
+
* way out is exactly the failure the arrow-key model was added to prevent.
|
|
149
175
|
*
|
|
150
176
|
* So the widget decides instead of the engine, the same way it decides for
|
|
151
177
|
* Escape: close, return focus to the trigger, and do NOT preventDefault, so
|
|
@@ -196,15 +222,12 @@ export function buildGlyphPicker(ctx, options) {
|
|
|
196
222
|
// once closed the panel while focus sat on the first glyph, which left one of
|
|
197
223
|
// forty characters reachable from the keyboard; moving focus first and letting
|
|
198
224
|
// the default action run is the part that makes it safe.
|
|
199
|
-
grid.addEventListener('focusout', () => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return;
|
|
206
|
-
close();
|
|
207
|
-
}, 0);
|
|
225
|
+
grid.addEventListener('focusout', (event) => {
|
|
226
|
+
if (!isOpen())
|
|
227
|
+
return;
|
|
228
|
+
if (relatedInside(event, grid, trigger))
|
|
229
|
+
return;
|
|
230
|
+
close();
|
|
208
231
|
});
|
|
209
232
|
/*
|
|
210
233
|
* Four behaviours the colour picker records as necessary. The first three
|
|
@@ -238,8 +261,7 @@ export function buildGlyphPicker(ctx, options) {
|
|
|
238
261
|
doc.removeEventListener('pointerdown', onPointerDown, true);
|
|
239
262
|
doc.defaultView?.removeEventListener('scroll', onViewportChange, true);
|
|
240
263
|
doc.defaultView?.removeEventListener('resize', onViewportChange);
|
|
241
|
-
|
|
242
|
-
grid.remove();
|
|
264
|
+
grid.remove();
|
|
243
265
|
},
|
|
244
266
|
};
|
|
245
267
|
}
|
package/dist/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../src/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4C,MAAM,qBAAqB,CAAA;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,gBAAgB,GACpB,OAAO,WAAW,KAAK,WAAW,IAAI,SAAS,IAAI,WAAW,CAAC,SAAS,CAAA;AAE1E,MAAM,UAAU,gBAAgB,CAC9B,GAAmB,EACnB,OAIC;IAED,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAA;IAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAErC,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC3C,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAA;IACvB,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC5B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,KAAK,CA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E,KAAK,EAAE,CAAA;IACvB,CAAC,CAAA;IACD,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;IACxD,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAA;IACnE,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IAE7D,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,CAAC,MAAmB,EAAE,EAAE,CAAC,SAAS;QAC1C,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,EAAE,CAAA;YACP,GAAG,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;YAC3D,GAAG,CAAC,WAAW,EAAE,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAA;YACtE,GAAG,CAAC,WAAW,EAAE,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;YAChE,IAAI,CAAC,MAAM,EAAE,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/openleaf-insert.css
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* emoji panel floating in the middle of the page on load, following the scroll.
|
|
22
22
|
*
|
|
23
23
|
* The attribute selector on the second rule matters: on a browser without
|
|
24
|
-
* popover support the grid carries no such attribute and lives
|
|
24
|
+
* popover support the grid carries no such attribute and lives on the host,
|
|
25
25
|
* where a bare :not(:popover-open) would match forever and hide it for good.
|
|
26
26
|
*/
|
|
27
27
|
.ol-insert-grid[hidden] { display: none; }
|
package/dist/styles.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const INSERT_CSS = "\n.ol-insert-grid {\n box-sizing: border-box;\n display: grid;\n gap: 2px;\n padding: 8px;\n max-height: 16rem;\n overflow: auto;\n border: 1px solid var(--openleaf-color-border, #d1d9e0);\n border-radius: var(--openleaf-radius, 6px);\n background: var(--openleaf-color-surface, #fff);\n color: var(--openleaf-color-text, #1f2328);\n font: 16px/1.2 var(--openleaf-font, system-ui, sans-serif);\n z-index: var(--openleaf-z-popover, 40);\n}\n/*\n * Both hidden states are restated here, because the rules that implement them\n * belong to the user agent while the display:grid above belongs to this sheet --\n * and an author declaration beats a UA one whatever its specificity. Without\n * these the grid is permanently displayed, and since the popover attribute also\n * carries UA position:fixed, inset:0 and margin:auto, what an author saw was an\n * emoji panel floating in the middle of the page on load, following the scroll.\n *\n * The attribute selector on the second rule matters: on a browser without\n * popover support the grid carries no such attribute and lives
|
|
1
|
+
export declare const INSERT_CSS = "\n.ol-insert-grid {\n box-sizing: border-box;\n display: grid;\n gap: 2px;\n padding: 8px;\n max-height: 16rem;\n overflow: auto;\n border: 1px solid var(--openleaf-color-border, #d1d9e0);\n border-radius: var(--openleaf-radius, 6px);\n background: var(--openleaf-color-surface, #fff);\n color: var(--openleaf-color-text, #1f2328);\n font: 16px/1.2 var(--openleaf-font, system-ui, sans-serif);\n z-index: var(--openleaf-z-popover, 40);\n}\n/*\n * Both hidden states are restated here, because the rules that implement them\n * belong to the user agent while the display:grid above belongs to this sheet --\n * and an author declaration beats a UA one whatever its specificity. Without\n * these the grid is permanently displayed, and since the popover attribute also\n * carries UA position:fixed, inset:0 and margin:auto, what an author saw was an\n * emoji panel floating in the middle of the page on load, following the scroll.\n *\n * The attribute selector on the second rule matters: on a browser without\n * popover support the grid carries no such attribute and lives on the host,\n * where a bare :not(:popover-open) would match forever and hide it for good.\n */\n.ol-insert-grid[hidden] { display: none; }\n.ol-insert-grid[popover]:not(:popover-open) { display: none; }\n/*\n * Must match GLYPH_COLUMNS in glyphs.ts: the keyboard model steps by this\n * width, and a CSS-only column count would let arrows land in a different\n * cell than the one the reader announced.\n */\n.ol-insert-row {\n display: grid;\n grid-template-columns: repeat(8, 2rem);\n gap: 2px;\n}\n.ol-insert-grid button {\n box-sizing: border-box;\n width: 2rem; height: 2rem; margin: 0; padding: 0;\n border: 1px solid transparent; border-radius: 4px;\n background: transparent; color: inherit; font: inherit; cursor: pointer;\n}\n.ol-insert-grid button:hover, .ol-insert-grid button:focus-visible {\n border-color: var(--openleaf-color-accent, #0550ae);\n outline: none;\n}\n.ol-img-resize { position: relative; display: inline-block; max-width: 100%; }\n.ol-img-resize :is(img, video) { display: block; max-width: 100%; height: auto; }\n/* The video is a preview, not a player: without this the engine's native media\n chrome eats the click and the node can never be selected -- in Firefox for the\n whole element, so the player could be inserted and never edited again. Stored\n HTML is serialized from the node, so the real page is unaffected. */\n.ol-img-resize video { pointer-events: none; }\n/* ...until the author asks for one. The node view puts this class on a single\n selected video and takes it off when the selection moves on, so at most one\n player is live at a time. Specificity, not !important: one class more than the\n rule above, and after it. */\n.ol-img-resize.ol-media-live video { pointer-events: auto; }\n\n/* The activation gesture: our button, not the engine's -- Firefox routes the\n whole of a <video controls> into its native chrome, so a listener on the\n element never hears the pointerdown. Present only while the node is selected,\n so the first click on a video is still the one that selects it. */\n.ol-media-play {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n margin: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 44px; height: 44px; padding: 0;\n border: 2px solid var(--openleaf-color-surface, #fff);\n border-radius: 50%;\n background: var(--openleaf-color-accent, #0550ae);\n color: var(--openleaf-color-surface, #fff);\n cursor: pointer;\n}\n/* The same trap as the insert grid above: display:flex here is an author\n declaration and the UA's display:none for [hidden] is not, so without this\n the button would sit on every video, selected or not. */\n.ol-media-play[hidden] { display: none; }\n.ol-media-play:focus-visible {\n outline: 2px solid var(--openleaf-color-accent, #0550ae);\n outline-offset: 3px;\n}\n/* A border triangle: no font can be relied on for a play glyph. */\n.ol-media-play::before {\n content: \"\";\n width: 0; height: 0;\n margin-left: 4px;\n border-left: 13px solid currentColor;\n border-top: 8px solid transparent;\n border-bottom: 8px solid transparent;\n}\n\n.ol-img-handle {\n position: absolute; right: 0; bottom: 0;\n width: 12px; height: 12px; margin: 0; padding: 0;\n border: 1px solid var(--openleaf-color-accent, #0550ae);\n background: var(--openleaf-color-surface, #fff);\n cursor: nwse-resize;\n}\n@media print {\n .ol-pagebreak, hr.ol-pagebreak { break-after: page; page-break-after: always; border: 0; }\n}\n";
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
package/dist/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,+/IA6GtB,CAAA"}
|
package/dist/styles.js
CHANGED
|
@@ -22,7 +22,7 @@ export const INSERT_CSS = `
|
|
|
22
22
|
* emoji panel floating in the middle of the page on load, following the scroll.
|
|
23
23
|
*
|
|
24
24
|
* The attribute selector on the second rule matters: on a browser without
|
|
25
|
-
* popover support the grid carries no such attribute and lives
|
|
25
|
+
* popover support the grid carries no such attribute and lives on the host,
|
|
26
26
|
* where a bare :not(:popover-open) would match forever and hide it for good.
|
|
27
27
|
*/
|
|
28
28
|
.ol-insert-grid[hidden] { display: none; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openleaf-editor/plugins-insert",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
4
4
|
"description": "Opt-in insert tools for OpenLeaf: media embeds, collapsible sections, anchors, character map, emoji, snippets, page breaks, and image resize handles. The matching schema nodes live in @openleaf-editor/core so stored documents round-trip whether or not this package is loaded.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"prosemirror-state": "^1.4.3",
|
|
39
|
-
"@openleaf-editor/core": "^0.1.0-beta.
|
|
40
|
-
"@openleaf-editor/ui": "^0.1.0-beta.
|
|
39
|
+
"@openleaf-editor/core": "^0.1.0-beta.4",
|
|
40
|
+
"@openleaf-editor/ui": "^0.1.0-beta.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"prosemirror-model": "^1.24.1",
|
|
44
44
|
"prosemirror-state": "^1.4.3",
|
|
45
45
|
"prosemirror-view": "^1.37.0",
|
|
46
|
-
"@openleaf-editor/core": "0.1.0-beta.
|
|
47
|
-
"@openleaf-editor/ui": "0.1.0-beta.
|
|
46
|
+
"@openleaf-editor/core": "0.1.0-beta.4",
|
|
47
|
+
"@openleaf-editor/ui": "0.1.0-beta.4"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc -p tsconfig.json && node scripts/emit-css.mjs"
|