@cgi-learning-hub/ui 1.14.0-dev.1785338327 → 1.14.0-dev.1785404668
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/tiptap/index.cjs.js +14 -5
- package/dist/tiptap/index.es.js +14 -5
- package/dist/ui.css +1 -13
- package/package.json +1 -1
package/dist/tiptap/index.cjs.js
CHANGED
|
@@ -4373,6 +4373,7 @@ var Button = (0, react.forwardRef)(({ className, children, tooltip, showTooltip
|
|
|
4373
4373
|
const shortcuts = (0, react.useMemo)(() => parseShortcutKeys({ shortcutKeys }), [shortcutKeys]);
|
|
4374
4374
|
if (!tooltip || !showTooltip) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_ToggleButton.default, {
|
|
4375
4375
|
size: "small",
|
|
4376
|
+
color: "primary",
|
|
4376
4377
|
ref,
|
|
4377
4378
|
sx: {
|
|
4378
4379
|
border: "none",
|
|
@@ -4390,6 +4391,7 @@ var Button = (0, react.forwardRef)(({ className, children, tooltip, showTooltip
|
|
|
4390
4391
|
}] } },
|
|
4391
4392
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_ToggleButton.default, {
|
|
4392
4393
|
size: "small",
|
|
4394
|
+
color: "primary",
|
|
4393
4395
|
ref,
|
|
4394
4396
|
sx: {
|
|
4395
4397
|
border: "none",
|
|
@@ -5147,7 +5149,7 @@ var HeadingMenu = (0, react.forwardRef)(({ editor: providedEditor, levels = [
|
|
|
5147
5149
|
id: "heading-button",
|
|
5148
5150
|
value: "heading",
|
|
5149
5151
|
type: "button",
|
|
5150
|
-
selected: isActive,
|
|
5152
|
+
selected: isActive || open,
|
|
5151
5153
|
role: "button",
|
|
5152
5154
|
tabIndex: -1,
|
|
5153
5155
|
disabled: !canToggle,
|
|
@@ -5412,10 +5414,10 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, openLink, isActive }) => {
|
|
|
5412
5414
|
autoComplete: "off",
|
|
5413
5415
|
autoCorrect: "off",
|
|
5414
5416
|
autoCapitalize: "off",
|
|
5415
|
-
className: "tiptap-link-input",
|
|
5416
5417
|
sx: {
|
|
5417
5418
|
padding: ".25rem .625rem",
|
|
5418
|
-
fontSize: "0.875rem"
|
|
5419
|
+
fontSize: "0.875rem",
|
|
5420
|
+
minWidth: "12rem"
|
|
5419
5421
|
}
|
|
5420
5422
|
}),
|
|
5421
5423
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIconButton, {
|
|
@@ -5459,6 +5461,7 @@ var LinkPopover = (0, react.forwardRef)(({ editor: providedEditor, hideWhenUnava
|
|
|
5459
5461
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5460
5462
|
const [anchorEl, setAnchorEl] = (0, react.useState)(null);
|
|
5461
5463
|
const internalRef = (0, react.useRef)(null);
|
|
5464
|
+
const justSubmittedRef = (0, react.useRef)(false);
|
|
5462
5465
|
const { isVisible, canSet, isActive, url, setUrl, setLink, removeLink, openLink, label, Icon } = useLinkPopover({
|
|
5463
5466
|
editor,
|
|
5464
5467
|
hideWhenUnavailable,
|
|
@@ -5474,8 +5477,12 @@ var LinkPopover = (0, react.forwardRef)(({ editor: providedEditor, hideWhenUnava
|
|
|
5474
5477
|
onOpenChange?.(false);
|
|
5475
5478
|
}, [onOpenChange]);
|
|
5476
5479
|
const handleSetLink = (0, react.useCallback)(() => {
|
|
5480
|
+
justSubmittedRef.current = true;
|
|
5477
5481
|
setLink();
|
|
5478
5482
|
setAnchorEl(null);
|
|
5483
|
+
queueMicrotask(() => {
|
|
5484
|
+
justSubmittedRef.current = false;
|
|
5485
|
+
});
|
|
5479
5486
|
}, [setLink]);
|
|
5480
5487
|
const handleClick = (0, react.useCallback)((event) => {
|
|
5481
5488
|
onClick?.(event, !isActive);
|
|
@@ -5483,14 +5490,14 @@ var LinkPopover = (0, react.forwardRef)(({ editor: providedEditor, hideWhenUnava
|
|
|
5483
5490
|
setAnchorEl(event.currentTarget);
|
|
5484
5491
|
}, [onClick, anchorEl]);
|
|
5485
5492
|
(0, react.useEffect)(() => {
|
|
5486
|
-
if (autoOpenOnLinkActive && isActive) setAnchorEl(internalRef.current);
|
|
5493
|
+
if (autoOpenOnLinkActive && isActive && !justSubmittedRef.current) setAnchorEl(internalRef.current);
|
|
5487
5494
|
}, [autoOpenOnLinkActive, isActive]);
|
|
5488
5495
|
if (!isVisible) return null;
|
|
5489
5496
|
const open = Boolean(anchorEl);
|
|
5490
5497
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkButton, {
|
|
5491
5498
|
value: "link",
|
|
5492
5499
|
disabled: !canSet,
|
|
5493
|
-
selected: isActive,
|
|
5500
|
+
selected: isActive || open,
|
|
5494
5501
|
"data-disabled": !canSet,
|
|
5495
5502
|
"aria-label": label,
|
|
5496
5503
|
tooltip: label,
|
|
@@ -6618,6 +6625,8 @@ var useToolbarNavigation = (toolbarRef) => {
|
|
|
6618
6625
|
if (!items.length) return;
|
|
6619
6626
|
const toolbar = toolbarRef.current;
|
|
6620
6627
|
if (!toolbar) return;
|
|
6628
|
+
const activeEl = toolbar.ownerDocument.activeElement;
|
|
6629
|
+
if (activeEl && !toolbar.contains(activeEl)) return;
|
|
6621
6630
|
const initialContainerTabIndex = initialContainerTabIndexRef.current;
|
|
6622
6631
|
const currentIndex = selectedIndex ?? -1;
|
|
6623
6632
|
if (initialContainerTabIndex != null) {
|
package/dist/tiptap/index.es.js
CHANGED
|
@@ -4360,6 +4360,7 @@ var Button = forwardRef(({ className, children, tooltip, showTooltip = true, sho
|
|
|
4360
4360
|
const shortcuts = useMemo(() => parseShortcutKeys({ shortcutKeys }), [shortcutKeys]);
|
|
4361
4361
|
if (!tooltip || !showTooltip) return /* @__PURE__ */ jsx(ToggleButton, {
|
|
4362
4362
|
size: "small",
|
|
4363
|
+
color: "primary",
|
|
4363
4364
|
ref,
|
|
4364
4365
|
sx: {
|
|
4365
4366
|
border: "none",
|
|
@@ -4377,6 +4378,7 @@ var Button = forwardRef(({ className, children, tooltip, showTooltip = true, sho
|
|
|
4377
4378
|
}] } },
|
|
4378
4379
|
children: /* @__PURE__ */ jsx(ToggleButton, {
|
|
4379
4380
|
size: "small",
|
|
4381
|
+
color: "primary",
|
|
4380
4382
|
ref,
|
|
4381
4383
|
sx: {
|
|
4382
4384
|
border: "none",
|
|
@@ -5134,7 +5136,7 @@ var HeadingMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
|
5134
5136
|
id: "heading-button",
|
|
5135
5137
|
value: "heading",
|
|
5136
5138
|
type: "button",
|
|
5137
|
-
selected: isActive,
|
|
5139
|
+
selected: isActive || open,
|
|
5138
5140
|
role: "button",
|
|
5139
5141
|
tabIndex: -1,
|
|
5140
5142
|
disabled: !canToggle,
|
|
@@ -5399,10 +5401,10 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, openLink, isActive }) => {
|
|
|
5399
5401
|
autoComplete: "off",
|
|
5400
5402
|
autoCorrect: "off",
|
|
5401
5403
|
autoCapitalize: "off",
|
|
5402
|
-
className: "tiptap-link-input",
|
|
5403
5404
|
sx: {
|
|
5404
5405
|
padding: ".25rem .625rem",
|
|
5405
|
-
fontSize: "0.875rem"
|
|
5406
|
+
fontSize: "0.875rem",
|
|
5407
|
+
minWidth: "12rem"
|
|
5406
5408
|
}
|
|
5407
5409
|
}),
|
|
5408
5410
|
/* @__PURE__ */ jsx(StyledIconButton, {
|
|
@@ -5446,6 +5448,7 @@ var LinkPopover = forwardRef(({ editor: providedEditor, hideWhenUnavailable = fa
|
|
|
5446
5448
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5447
5449
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
5448
5450
|
const internalRef = useRef(null);
|
|
5451
|
+
const justSubmittedRef = useRef(false);
|
|
5449
5452
|
const { isVisible, canSet, isActive, url, setUrl, setLink, removeLink, openLink, label, Icon } = useLinkPopover({
|
|
5450
5453
|
editor,
|
|
5451
5454
|
hideWhenUnavailable,
|
|
@@ -5461,8 +5464,12 @@ var LinkPopover = forwardRef(({ editor: providedEditor, hideWhenUnavailable = fa
|
|
|
5461
5464
|
onOpenChange?.(false);
|
|
5462
5465
|
}, [onOpenChange]);
|
|
5463
5466
|
const handleSetLink = useCallback(() => {
|
|
5467
|
+
justSubmittedRef.current = true;
|
|
5464
5468
|
setLink();
|
|
5465
5469
|
setAnchorEl(null);
|
|
5470
|
+
queueMicrotask(() => {
|
|
5471
|
+
justSubmittedRef.current = false;
|
|
5472
|
+
});
|
|
5466
5473
|
}, [setLink]);
|
|
5467
5474
|
const handleClick = useCallback((event) => {
|
|
5468
5475
|
onClick?.(event, !isActive);
|
|
@@ -5470,14 +5477,14 @@ var LinkPopover = forwardRef(({ editor: providedEditor, hideWhenUnavailable = fa
|
|
|
5470
5477
|
setAnchorEl(event.currentTarget);
|
|
5471
5478
|
}, [onClick, anchorEl]);
|
|
5472
5479
|
useEffect(() => {
|
|
5473
|
-
if (autoOpenOnLinkActive && isActive) setAnchorEl(internalRef.current);
|
|
5480
|
+
if (autoOpenOnLinkActive && isActive && !justSubmittedRef.current) setAnchorEl(internalRef.current);
|
|
5474
5481
|
}, [autoOpenOnLinkActive, isActive]);
|
|
5475
5482
|
if (!isVisible) return null;
|
|
5476
5483
|
const open = Boolean(anchorEl);
|
|
5477
5484
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(LinkButton, {
|
|
5478
5485
|
value: "link",
|
|
5479
5486
|
disabled: !canSet,
|
|
5480
|
-
selected: isActive,
|
|
5487
|
+
selected: isActive || open,
|
|
5481
5488
|
"data-disabled": !canSet,
|
|
5482
5489
|
"aria-label": label,
|
|
5483
5490
|
tooltip: label,
|
|
@@ -6605,6 +6612,8 @@ var useToolbarNavigation = (toolbarRef) => {
|
|
|
6605
6612
|
if (!items.length) return;
|
|
6606
6613
|
const toolbar = toolbarRef.current;
|
|
6607
6614
|
if (!toolbar) return;
|
|
6615
|
+
const activeEl = toolbar.ownerDocument.activeElement;
|
|
6616
|
+
if (activeEl && !toolbar.contains(activeEl)) return;
|
|
6608
6617
|
const initialContainerTabIndex = initialContainerTabIndexRef.current;
|
|
6609
6618
|
const currentIndex = selectedIndex ?? -1;
|
|
6610
6619
|
if (initialContainerTabIndex != null) {
|
package/dist/ui.css
CHANGED
|
@@ -11,19 +11,7 @@
|
|
|
11
11
|
--toastify-text-color-light: var(--theme-palette-text-primary);
|
|
12
12
|
--toastify-text-color-dark: var(--theme-palette-common-white);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
font-size: 0.875rem;
|
|
16
|
-
border: none;
|
|
17
|
-
/* Clamp the input */
|
|
18
|
-
min-width: 12rem;
|
|
19
|
-
padding-right: 0;
|
|
20
|
-
text-overflow: ellipsis;
|
|
21
|
-
white-space: nowrap;
|
|
22
|
-
}
|
|
23
|
-
.tiptap-link-input:focus {
|
|
24
|
-
text-overflow: clip;
|
|
25
|
-
overflow: visible;
|
|
26
|
-
}:root {
|
|
14
|
+
:root {
|
|
27
15
|
--tt-toolbar-height: 2.75rem;
|
|
28
16
|
--tt-safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
|
29
17
|
--tt-toolbar-bg-color: var(--theme-palette-common-white);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "1.14.0-dev.
|
|
3
|
+
"version": "1.14.0-dev.1785404668",
|
|
4
4
|
"description": "React component library for Hub's design system, built on Material UI with custom and extended components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cgi-learning-hub",
|