@cgi-learning-hub/ui 1.14.0-dev.1785252242 → 1.14.0-dev.1785338327
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/index.d.ts +7 -0
- package/dist/index.es.js +1 -1
- package/dist/{src-G-BmjM2S.js → src-B3iFugc4.js} +140 -2
- package/dist/tiptap/index.cjs.js +106 -159
- package/dist/tiptap/index.d.ts +1 -0
- package/dist/tiptap/index.es.js +105 -161
- package/dist/ui.css +2 -110
- package/package.json +1 -1
package/dist/tiptap/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as InputBase, Lt as Tooltip, M as Divider, Pt as ToggleButton, Qt as DeleteRounded_default, Rt as Typography, U as IconButton, d as Badge, gn as clsx, ht as Stack, nt as MenuItem, st as Popover, t as src_exports, tt as Menu, un as SvgIcon_default } from "../src-B3iFugc4.js";
|
|
2
2
|
import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { createSvgIcon } from "@mui/material/utils";
|
|
@@ -4270,7 +4270,7 @@ function toggleBlockquote(editor) {
|
|
|
4270
4270
|
/**
|
|
4271
4271
|
* Determines if the blockquote button should be shown
|
|
4272
4272
|
*/
|
|
4273
|
-
function shouldShowButton$
|
|
4273
|
+
function shouldShowButton$5(props) {
|
|
4274
4274
|
const { editor, hideWhenUnavailable } = props;
|
|
4275
4275
|
if (!editor) return false;
|
|
4276
4276
|
if (!hideWhenUnavailable) return true;
|
|
@@ -4324,7 +4324,7 @@ function useBlockquote(config) {
|
|
|
4324
4324
|
useEffect(() => {
|
|
4325
4325
|
if (!editor) return;
|
|
4326
4326
|
const handleSelectionUpdate = () => {
|
|
4327
|
-
setIsVisible(shouldShowButton$
|
|
4327
|
+
setIsVisible(shouldShowButton$5({
|
|
4328
4328
|
editor,
|
|
4329
4329
|
hideWhenUnavailable
|
|
4330
4330
|
}));
|
|
@@ -4345,7 +4345,7 @@ function useBlockquote(config) {
|
|
|
4345
4345
|
return success;
|
|
4346
4346
|
}, [editor, onToggled]),
|
|
4347
4347
|
canToggle,
|
|
4348
|
-
label: "
|
|
4348
|
+
label: "Citation en bloc",
|
|
4349
4349
|
shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
|
|
4350
4350
|
Icon: TextSnippetIcon
|
|
4351
4351
|
};
|
|
@@ -4420,7 +4420,7 @@ var BlockquoteButton = forwardRef(({ editor: providedEditor, text, hideWhenUnava
|
|
|
4420
4420
|
disabled: !canToggle,
|
|
4421
4421
|
"data-disabled": !canToggle,
|
|
4422
4422
|
"aria-label": label,
|
|
4423
|
-
tooltip:
|
|
4423
|
+
tooltip: label,
|
|
4424
4424
|
onClick: handleClick,
|
|
4425
4425
|
...buttonProps,
|
|
4426
4426
|
ref,
|
|
@@ -4537,7 +4537,7 @@ function toggleCodeBlock(editor) {
|
|
|
4537
4537
|
/**
|
|
4538
4538
|
* Determines if the code block button should be shown
|
|
4539
4539
|
*/
|
|
4540
|
-
function shouldShowButton$
|
|
4540
|
+
function shouldShowButton$4(props) {
|
|
4541
4541
|
const { editor, hideWhenUnavailable } = props;
|
|
4542
4542
|
if (!editor) return false;
|
|
4543
4543
|
if (!hideWhenUnavailable) return true;
|
|
@@ -4598,7 +4598,7 @@ function useCodeBlock(config) {
|
|
|
4598
4598
|
useEffect(() => {
|
|
4599
4599
|
if (!editor) return;
|
|
4600
4600
|
const handleSelectionUpdate = () => {
|
|
4601
|
-
setIsVisible(shouldShowButton$
|
|
4601
|
+
setIsVisible(shouldShowButton$4({
|
|
4602
4602
|
editor,
|
|
4603
4603
|
hideWhenUnavailable
|
|
4604
4604
|
}));
|
|
@@ -4619,7 +4619,7 @@ function useCodeBlock(config) {
|
|
|
4619
4619
|
return success;
|
|
4620
4620
|
}, [editor, onToggled]),
|
|
4621
4621
|
canToggle: canToggleState,
|
|
4622
|
-
label: "
|
|
4622
|
+
label: "Bloc de code",
|
|
4623
4623
|
shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
|
|
4624
4624
|
Icon: IntegrationInstructionIcon
|
|
4625
4625
|
};
|
|
@@ -4656,7 +4656,7 @@ var CodeBlockButton = forwardRef(({ editor: providedEditor, text, hideWhenUnavai
|
|
|
4656
4656
|
"data-disabled": !canToggle,
|
|
4657
4657
|
tabIndex: -1,
|
|
4658
4658
|
"aria-label": label,
|
|
4659
|
-
tooltip:
|
|
4659
|
+
tooltip: label,
|
|
4660
4660
|
onClick: handleClick,
|
|
4661
4661
|
...buttonProps,
|
|
4662
4662
|
ref,
|
|
@@ -4733,7 +4733,7 @@ var HeadingThreeIcon = createSvgIcon(/* @__PURE__ */ jsxs("g", { children: [
|
|
|
4733
4733
|
})
|
|
4734
4734
|
] }), "HeadingThree");
|
|
4735
4735
|
//#endregion
|
|
4736
|
-
//#region src/tiptap/components/ui/heading-
|
|
4736
|
+
//#region src/tiptap/components/ui/heading-menu-item/use-heading.ts
|
|
4737
4737
|
var headingIcons = {
|
|
4738
4738
|
1: HeadingOneIcon,
|
|
4739
4739
|
2: createSvgIcon(/* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("path", {
|
|
@@ -4833,9 +4833,9 @@ function toggleHeading(editor, level) {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
}
|
|
4835
4835
|
/**
|
|
4836
|
-
* Determines if the heading
|
|
4836
|
+
* Determines if the heading menu item should be shown
|
|
4837
4837
|
*/
|
|
4838
|
-
function
|
|
4838
|
+
function shouldShowItem(props) {
|
|
4839
4839
|
const { editor, level, hideWhenUnavailable } = props;
|
|
4840
4840
|
if (!editor) return false;
|
|
4841
4841
|
if (!hideWhenUnavailable) return true;
|
|
@@ -4853,7 +4853,7 @@ function shouldShowButton$4(props) {
|
|
|
4853
4853
|
* @example
|
|
4854
4854
|
* ```tsx
|
|
4855
4855
|
* // Simple usage
|
|
4856
|
-
* function
|
|
4856
|
+
* function MySimpleHeadingItem() {
|
|
4857
4857
|
* const { isVisible, isActive, handleToggle, Icon } = useHeading({ level: 1 })
|
|
4858
4858
|
*
|
|
4859
4859
|
* if (!isVisible) return null
|
|
@@ -4870,7 +4870,7 @@ function shouldShowButton$4(props) {
|
|
|
4870
4870
|
* }
|
|
4871
4871
|
*
|
|
4872
4872
|
* // Advanced usage with configuration
|
|
4873
|
-
* function
|
|
4873
|
+
* function MyAdvancedHeadingItem() {
|
|
4874
4874
|
* const { isVisible, isActive, handleToggle, label, Icon } = useHeading({
|
|
4875
4875
|
* level: 2,
|
|
4876
4876
|
* editor: myEditor,
|
|
@@ -4902,7 +4902,7 @@ function useHeading(config) {
|
|
|
4902
4902
|
useEffect(() => {
|
|
4903
4903
|
if (!editor) return;
|
|
4904
4904
|
const handleSelectionUpdate = () => {
|
|
4905
|
-
setIsVisible(
|
|
4905
|
+
setIsVisible(shouldShowItem({
|
|
4906
4906
|
editor,
|
|
4907
4907
|
level,
|
|
4908
4908
|
hideWhenUnavailable
|
|
@@ -4932,22 +4932,22 @@ function useHeading(config) {
|
|
|
4932
4932
|
onToggled
|
|
4933
4933
|
]),
|
|
4934
4934
|
canToggle: canToggleState,
|
|
4935
|
-
label: `
|
|
4935
|
+
label: `Titre ${level}`,
|
|
4936
4936
|
shortcutKeys: HEADING_SHORTCUT_KEYS[level],
|
|
4937
4937
|
Icon: headingIcons[level]
|
|
4938
4938
|
};
|
|
4939
4939
|
}
|
|
4940
4940
|
//#endregion
|
|
4941
|
-
//#region src/tiptap/components/ui/heading-
|
|
4941
|
+
//#region src/tiptap/components/ui/heading-menu-item/heading-menu-item.tsx
|
|
4942
4942
|
function HeadingShortcutBadge({ level, shortcutKeys = HEADING_SHORTCUT_KEYS[level] }) {
|
|
4943
4943
|
return /* @__PURE__ */ jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
|
|
4944
4944
|
}
|
|
4945
4945
|
/**
|
|
4946
|
-
*
|
|
4946
|
+
* Menu item component for toggling heading in a Tiptap editor.
|
|
4947
4947
|
*
|
|
4948
|
-
* For custom
|
|
4948
|
+
* For custom menu item implementations, use the `useHeading` hook instead.
|
|
4949
4949
|
*/
|
|
4950
|
-
var
|
|
4950
|
+
var HeadingMenuItem = forwardRef(({ editor: providedEditor, level, text, hideWhenUnavailable = false, onToggled, showShortcut = false, onClick, children, ...menuItemProps }, ref) => {
|
|
4951
4951
|
const { editor } = useTiptapEditor(providedEditor);
|
|
4952
4952
|
const { isVisible, canToggle, isActive, handleToggle, label, Icon, shortcutKeys } = useHeading({
|
|
4953
4953
|
editor,
|
|
@@ -4972,13 +4972,15 @@ var HeadingButton = forwardRef(({ editor: providedEditor, level, text, hideWhenU
|
|
|
4972
4972
|
tooltip: label,
|
|
4973
4973
|
selected: isActive,
|
|
4974
4974
|
onClick: handleClick,
|
|
4975
|
-
...
|
|
4975
|
+
...menuItemProps,
|
|
4976
4976
|
ref,
|
|
4977
4977
|
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4978
4978
|
/* @__PURE__ */ jsx(Icon, { fontSize: "small" }),
|
|
4979
|
-
text && /* @__PURE__ */ jsx(
|
|
4980
|
-
|
|
4981
|
-
|
|
4979
|
+
text && /* @__PURE__ */ jsx(Typography, {
|
|
4980
|
+
component: "span",
|
|
4981
|
+
variant: "body2",
|
|
4982
|
+
sx: { ml: 1 },
|
|
4983
|
+
children: label
|
|
4982
4984
|
}),
|
|
4983
4985
|
showShortcut && /* @__PURE__ */ jsx(HeadingShortcutBadge, {
|
|
4984
4986
|
level,
|
|
@@ -4987,7 +4989,7 @@ var HeadingButton = forwardRef(({ editor: providedEditor, level, text, hideWhenU
|
|
|
4987
4989
|
] })
|
|
4988
4990
|
});
|
|
4989
4991
|
});
|
|
4990
|
-
|
|
4992
|
+
HeadingMenuItem.displayName = "HeadingMenuItem";
|
|
4991
4993
|
//#endregion
|
|
4992
4994
|
//#region src/tiptap/components/icons/heading-icon.tsx
|
|
4993
4995
|
var HeadingIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
@@ -4995,7 +4997,7 @@ var HeadingIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
|
4995
4997
|
fill: "currentColor"
|
|
4996
4998
|
}), "Heading");
|
|
4997
4999
|
//#endregion
|
|
4998
|
-
//#region src/tiptap/components/ui/heading-
|
|
5000
|
+
//#region src/tiptap/components/ui/heading-menu/use-heading-menu.ts
|
|
4999
5001
|
/**
|
|
5000
5002
|
* Gets the currently active heading level from the available levels
|
|
5001
5003
|
*/
|
|
@@ -5011,35 +5013,35 @@ function getActiveHeadingLevel(editor, levels = [
|
|
|
5011
5013
|
return levels.find((level) => isHeadingActive(editor, level));
|
|
5012
5014
|
}
|
|
5013
5015
|
/**
|
|
5014
|
-
* Custom hook that provides heading
|
|
5016
|
+
* Custom hook that provides heading menu functionality for Tiptap editor
|
|
5015
5017
|
*
|
|
5016
5018
|
* @example
|
|
5017
5019
|
* ```tsx
|
|
5018
5020
|
* // Simple usage
|
|
5019
|
-
* function
|
|
5021
|
+
* function MyHeading() {
|
|
5020
5022
|
* const {
|
|
5021
5023
|
* isVisible,
|
|
5022
5024
|
* activeLevel,
|
|
5023
5025
|
* isAnyHeadingActive,
|
|
5024
5026
|
* canToggle,
|
|
5025
5027
|
* levels,
|
|
5026
|
-
* } =
|
|
5028
|
+
* } = useHeadingMenu()
|
|
5027
5029
|
*
|
|
5028
5030
|
* if (!isVisible) return null
|
|
5029
5031
|
*
|
|
5030
5032
|
* return (
|
|
5031
|
-
* <
|
|
5032
|
-
* //
|
|
5033
|
-
* </
|
|
5033
|
+
* <Menu>
|
|
5034
|
+
* // content
|
|
5035
|
+
* </Menu>
|
|
5034
5036
|
* )
|
|
5035
5037
|
* }
|
|
5036
5038
|
*
|
|
5037
5039
|
* // Advanced usage with configuration
|
|
5038
|
-
* function
|
|
5040
|
+
* function MyAdvancedHeading() {
|
|
5039
5041
|
* const {
|
|
5040
5042
|
* isVisible,
|
|
5041
5043
|
* activeLevel,
|
|
5042
|
-
* } =
|
|
5044
|
+
* } = useHeadingMenu({
|
|
5043
5045
|
* editor: myEditor,
|
|
5044
5046
|
* levels: [1, 2, 3],
|
|
5045
5047
|
* hideWhenUnavailable: true,
|
|
@@ -5049,7 +5051,7 @@ function getActiveHeadingLevel(editor, levels = [
|
|
|
5049
5051
|
* }
|
|
5050
5052
|
* ```
|
|
5051
5053
|
*/
|
|
5052
|
-
function
|
|
5054
|
+
function useHeadingMenu(config) {
|
|
5053
5055
|
const { editor: providedEditor, levels = [
|
|
5054
5056
|
1,
|
|
5055
5057
|
2,
|
|
@@ -5066,7 +5068,7 @@ function useHeadingDropdownMenu(config) {
|
|
|
5066
5068
|
useEffect(() => {
|
|
5067
5069
|
if (!editor) return;
|
|
5068
5070
|
const handleSelectionUpdate = () => {
|
|
5069
|
-
setIsVisible(
|
|
5071
|
+
setIsVisible(shouldShowItem({
|
|
5070
5072
|
editor,
|
|
5071
5073
|
hideWhenUnavailable,
|
|
5072
5074
|
level: levels
|
|
@@ -5088,18 +5090,18 @@ function useHeadingDropdownMenu(config) {
|
|
|
5088
5090
|
isActive,
|
|
5089
5091
|
canToggle: canToggleState,
|
|
5090
5092
|
levels,
|
|
5091
|
-
label: "
|
|
5093
|
+
label: "Titre",
|
|
5092
5094
|
Icon: activeLevel ? headingIcons[activeLevel] : HeadingIcon
|
|
5093
5095
|
};
|
|
5094
5096
|
}
|
|
5095
5097
|
//#endregion
|
|
5096
|
-
//#region src/tiptap/components/ui/heading-
|
|
5098
|
+
//#region src/tiptap/components/ui/heading-menu/heading-menu.tsx
|
|
5097
5099
|
/**
|
|
5098
|
-
*
|
|
5100
|
+
* Menu component for selecting heading levels in a Tiptap editor.
|
|
5099
5101
|
*
|
|
5100
|
-
* For custom
|
|
5102
|
+
* For custom menu implementations, use the `useHeadingMenu` hook instead.
|
|
5101
5103
|
*/
|
|
5102
|
-
var
|
|
5104
|
+
var HeadingMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
5103
5105
|
1,
|
|
5104
5106
|
2,
|
|
5105
5107
|
3,
|
|
@@ -5110,7 +5112,7 @@ var HeadingDropdownMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
|
5110
5112
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5111
5113
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
5112
5114
|
const open = Boolean(anchorEl);
|
|
5113
|
-
const { isVisible, isActive, canToggle, Icon } =
|
|
5115
|
+
const { isVisible, isActive, canToggle, Icon, label } = useHeadingMenu({
|
|
5114
5116
|
editor,
|
|
5115
5117
|
levels,
|
|
5116
5118
|
hideWhenUnavailable
|
|
@@ -5141,7 +5143,7 @@ var HeadingDropdownMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
|
5141
5143
|
"aria-controls": "heading-menu",
|
|
5142
5144
|
"aria-label": "Format text as heading",
|
|
5143
5145
|
"aria-expanded": open,
|
|
5144
|
-
tooltip:
|
|
5146
|
+
tooltip: label,
|
|
5145
5147
|
onClick: handleClick,
|
|
5146
5148
|
...buttonProps,
|
|
5147
5149
|
ref,
|
|
@@ -5155,7 +5157,7 @@ var HeadingDropdownMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
|
5155
5157
|
"aria-labelledby": "heading-button",
|
|
5156
5158
|
role: "listbox"
|
|
5157
5159
|
} },
|
|
5158
|
-
children: levels.map((level) => /* @__PURE__ */ jsx(
|
|
5160
|
+
children: levels.map((level) => /* @__PURE__ */ jsx(HeadingMenuItem, {
|
|
5159
5161
|
editor,
|
|
5160
5162
|
level,
|
|
5161
5163
|
text: `Heading ${level}`,
|
|
@@ -5163,7 +5165,7 @@ var HeadingDropdownMenu = forwardRef(({ editor: providedEditor, levels = [
|
|
|
5163
5165
|
}, `heading-${level}`))
|
|
5164
5166
|
})] });
|
|
5165
5167
|
});
|
|
5166
|
-
|
|
5168
|
+
HeadingMenu.displayName = "HeadingMenu";
|
|
5167
5169
|
//#endregion
|
|
5168
5170
|
//#region ../../node_modules/.pnpm/@mui+icons-material@9.1.1_@mui+material@9.1.1_@emotion+react@11.14.0_@types+react@19.2._9b347fe2e167545244369f75d4366d7f/node_modules/@mui/icons-material/KeyboardReturnRounded.mjs
|
|
5169
5171
|
var KeyboardReturnRounded_default = SvgIcon_default(/*#__PURE__*/ jsx("path", { d: "M19 8v3H5.83l2.88-2.88c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0L2.71 11.3c-.39.39-.39 1.02 0 1.41L7.3 17.3c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L5.83 13H20c.55 0 1-.45 1-1V8c0-.55-.45-1-1-1s-1 .45-1 1" }), "KeyboardReturnRounded");
|
|
@@ -5340,7 +5342,7 @@ function useLinkPopover(config) {
|
|
|
5340
5342
|
isVisible,
|
|
5341
5343
|
canSet,
|
|
5342
5344
|
isActive,
|
|
5343
|
-
label: "
|
|
5345
|
+
label: "Lien",
|
|
5344
5346
|
Icon: LinkRounded_default,
|
|
5345
5347
|
...useLinkHandler({
|
|
5346
5348
|
editor,
|
|
@@ -5349,77 +5351,6 @@ function useLinkPopover(config) {
|
|
|
5349
5351
|
};
|
|
5350
5352
|
}
|
|
5351
5353
|
//#endregion
|
|
5352
|
-
//#region ../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
|
|
5353
|
-
/**
|
|
5354
|
-
* Copyright 2022 Joe Bell. All rights reserved.
|
|
5355
|
-
*
|
|
5356
|
-
* This file is licensed to you under the Apache License, Version 2.0
|
|
5357
|
-
* (the "License"); you may not use this file except in compliance with the
|
|
5358
|
-
* License. You may obtain a copy of the License at
|
|
5359
|
-
*
|
|
5360
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5361
|
-
*
|
|
5362
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5363
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
5364
|
-
* WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the
|
|
5365
|
-
* License for the specific language governing permissions and limitations under
|
|
5366
|
-
* the License.
|
|
5367
|
-
*/ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
5368
|
-
var cx = clsx;
|
|
5369
|
-
var cva = (base, config) => (props) => {
|
|
5370
|
-
var _config_compoundVariants;
|
|
5371
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
5372
|
-
const { variants, defaultVariants } = config;
|
|
5373
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
5374
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
5375
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
5376
|
-
if (variantProp === null) return null;
|
|
5377
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
5378
|
-
return variants[variant][variantKey];
|
|
5379
|
-
});
|
|
5380
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
5381
|
-
let [key, value] = param;
|
|
5382
|
-
if (value === void 0) return acc;
|
|
5383
|
-
acc[key] = value;
|
|
5384
|
-
return acc;
|
|
5385
|
-
}, {});
|
|
5386
|
-
return cx(base, getVariantClassNames, config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
5387
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
5388
|
-
return Object.entries(compoundVariantOptions).every((param) => {
|
|
5389
|
-
let [key, value] = param;
|
|
5390
|
-
return Array.isArray(value) ? value.includes({
|
|
5391
|
-
...defaultVariants,
|
|
5392
|
-
...propsWithoutUndefined
|
|
5393
|
-
}[key]) : {
|
|
5394
|
-
...defaultVariants,
|
|
5395
|
-
...propsWithoutUndefined
|
|
5396
|
-
}[key] === value;
|
|
5397
|
-
}) ? [
|
|
5398
|
-
...acc,
|
|
5399
|
-
cvClass,
|
|
5400
|
-
cvClassName
|
|
5401
|
-
] : acc;
|
|
5402
|
-
}, []), props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
5403
|
-
};
|
|
5404
|
-
//#endregion
|
|
5405
|
-
//#region src/tiptap/components/ui-primitive/button-group/button-group.tsx
|
|
5406
|
-
var buttonGroupVariants = cva("tiptap-button-group", {
|
|
5407
|
-
variants: { orientation: {
|
|
5408
|
-
horizontal: "tiptap-button-group-horizontal",
|
|
5409
|
-
vertical: "tiptap-button-group-vertical"
|
|
5410
|
-
} },
|
|
5411
|
-
defaultVariants: { orientation: "horizontal" }
|
|
5412
|
-
});
|
|
5413
|
-
function ButtonGroup({ className, orientation, ...props }) {
|
|
5414
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5415
|
-
role: "group",
|
|
5416
|
-
"data-slot": "tiptap-button-group",
|
|
5417
|
-
"data-orientation": orientation,
|
|
5418
|
-
className: cn(buttonGroupVariants({ orientation }), className),
|
|
5419
|
-
...props
|
|
5420
|
-
});
|
|
5421
|
-
}
|
|
5422
|
-
//#endregion
|
|
5423
5354
|
//#region src/tiptap/components/ui/link-popover/link-popover.tsx
|
|
5424
5355
|
/**
|
|
5425
5356
|
* Link button component for triggering the link popover
|
|
@@ -5430,14 +5361,16 @@ var LinkButton = forwardRef(({ className, children, ...props }, ref) => {
|
|
|
5430
5361
|
className,
|
|
5431
5362
|
role: "button",
|
|
5432
5363
|
tabIndex: -1,
|
|
5433
|
-
"aria-label": "Link",
|
|
5434
|
-
tooltip: "Link",
|
|
5435
5364
|
ref,
|
|
5436
5365
|
...props,
|
|
5437
5366
|
children: children || /* @__PURE__ */ jsx(LinkRounded_default, { fontSize: "small" })
|
|
5438
5367
|
});
|
|
5439
5368
|
});
|
|
5440
5369
|
LinkButton.displayName = "LinkButton";
|
|
5370
|
+
var StyledIconButton = (0, src_exports.styled)(IconButton)(({ theme }) => ({
|
|
5371
|
+
borderRadius: theme.shape.borderRadius,
|
|
5372
|
+
"& .MuiTouchRipple-root .MuiTouchRipple-child": { borderRadius: theme.shape.borderRadius }
|
|
5373
|
+
}));
|
|
5441
5374
|
/**
|
|
5442
5375
|
* Main content component for the link popover
|
|
5443
5376
|
*/
|
|
@@ -5458,7 +5391,7 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, openLink, isActive }) => {
|
|
|
5458
5391
|
children: [
|
|
5459
5392
|
/* @__PURE__ */ jsx(InputBase, {
|
|
5460
5393
|
type: "url",
|
|
5461
|
-
placeholder: "
|
|
5394
|
+
placeholder: "Coller un lien...",
|
|
5462
5395
|
value: url,
|
|
5463
5396
|
onChange: (e) => setUrl(e.target.value),
|
|
5464
5397
|
onKeyDown: handleKeyDown,
|
|
@@ -5472,31 +5405,35 @@ var LinkMain = ({ url, setUrl, setLink, removeLink, openLink, isActive }) => {
|
|
|
5472
5405
|
fontSize: "0.875rem"
|
|
5473
5406
|
}
|
|
5474
5407
|
}),
|
|
5475
|
-
/* @__PURE__ */ jsx(
|
|
5408
|
+
/* @__PURE__ */ jsx(StyledIconButton, {
|
|
5409
|
+
size: "small",
|
|
5476
5410
|
type: "button",
|
|
5477
5411
|
onClick: setLink,
|
|
5478
|
-
title: "
|
|
5412
|
+
title: "Appliquer le lien",
|
|
5479
5413
|
disabled: !url && !isActive,
|
|
5480
5414
|
children: /* @__PURE__ */ jsx(KeyboardReturnRounded_default, { fontSize: "small" })
|
|
5481
|
-
})
|
|
5415
|
+
}),
|
|
5482
5416
|
/* @__PURE__ */ jsx(Divider, {
|
|
5483
5417
|
orientation: "vertical",
|
|
5484
5418
|
flexItem: true,
|
|
5485
5419
|
sx: { my: .5 }
|
|
5486
5420
|
}),
|
|
5487
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsx(StyledIconButton, {
|
|
5422
|
+
size: "small",
|
|
5488
5423
|
type: "button",
|
|
5489
5424
|
onClick: openLink,
|
|
5490
|
-
title: "
|
|
5425
|
+
title: "Ouvrir dans une nouvelle fenêtre",
|
|
5491
5426
|
disabled: !url && !isActive,
|
|
5492
5427
|
children: /* @__PURE__ */ jsx(OpenInNewRounded_default, { fontSize: "small" })
|
|
5493
|
-
})
|
|
5428
|
+
}),
|
|
5429
|
+
/* @__PURE__ */ jsx(StyledIconButton, {
|
|
5430
|
+
size: "small",
|
|
5494
5431
|
type: "button",
|
|
5495
5432
|
onClick: removeLink,
|
|
5496
|
-
title: "
|
|
5433
|
+
title: "Supprimer le lien",
|
|
5497
5434
|
disabled: !url && !isActive,
|
|
5498
5435
|
children: /* @__PURE__ */ jsx(DeleteRounded_default, { fontSize: "small" })
|
|
5499
|
-
})
|
|
5436
|
+
})
|
|
5500
5437
|
]
|
|
5501
5438
|
});
|
|
5502
5439
|
};
|
|
@@ -5543,6 +5480,7 @@ var LinkPopover = forwardRef(({ editor: providedEditor, hideWhenUnavailable = fa
|
|
|
5543
5480
|
selected: isActive,
|
|
5544
5481
|
"data-disabled": !canSet,
|
|
5545
5482
|
"aria-label": label,
|
|
5483
|
+
tooltip: label,
|
|
5546
5484
|
onClick: handleClick,
|
|
5547
5485
|
...buttonProps,
|
|
5548
5486
|
ref: setRefs,
|
|
@@ -5609,9 +5547,9 @@ var listIcons = {
|
|
|
5609
5547
|
] }), "ListTodo")
|
|
5610
5548
|
};
|
|
5611
5549
|
var listLabels = {
|
|
5612
|
-
bulletList: "
|
|
5613
|
-
orderedList: "
|
|
5614
|
-
taskList: "
|
|
5550
|
+
bulletList: "Liste à puces",
|
|
5551
|
+
orderedList: "Liste numérotée",
|
|
5552
|
+
taskList: "Liste de tâches"
|
|
5615
5553
|
};
|
|
5616
5554
|
var LIST_SHORTCUT_KEYS = {
|
|
5617
5555
|
bulletList: "mod+shift+8",
|
|
@@ -5699,7 +5637,7 @@ function toggleList(editor, type) {
|
|
|
5699
5637
|
const resolvedTo = state.doc.resolve(to);
|
|
5700
5638
|
chain = chain.setTextSelection(TextSelection.between(resolvedFrom, resolvedTo)).clearNodes();
|
|
5701
5639
|
}
|
|
5702
|
-
if (editor.isActive(type)) chain.liftListItem("listItem").lift("bulletList").lift("orderedList").
|
|
5640
|
+
if (editor.isActive(type)) chain.liftListItem("listItem").lift("bulletList").lift("orderedList").run();
|
|
5703
5641
|
else {
|
|
5704
5642
|
const toggle = {
|
|
5705
5643
|
bulletList: () => chain.toggleBulletList(),
|
|
@@ -5936,7 +5874,15 @@ function shouldShowButton$2(props) {
|
|
|
5936
5874
|
* Gets the formatted mark name
|
|
5937
5875
|
*/
|
|
5938
5876
|
function getFormattedMarkName(type) {
|
|
5939
|
-
|
|
5877
|
+
switch (type) {
|
|
5878
|
+
case "bold": return "Gras";
|
|
5879
|
+
case "italic": return "Italique";
|
|
5880
|
+
case "strike": return "Barré";
|
|
5881
|
+
case "code": return "Code";
|
|
5882
|
+
case "underline": return "Souligné";
|
|
5883
|
+
case "superscript": return "Exposant";
|
|
5884
|
+
case "subscript": return "Indice";
|
|
5885
|
+
}
|
|
5940
5886
|
}
|
|
5941
5887
|
/**
|
|
5942
5888
|
* Custom hook that provides mark functionality for Tiptap editor
|
|
@@ -6097,10 +6043,10 @@ var textAlignIcons = {
|
|
|
6097
6043
|
justify: FormatAlignJustifyRounded_default
|
|
6098
6044
|
};
|
|
6099
6045
|
var textAlignLabels = {
|
|
6100
|
-
left: "
|
|
6101
|
-
center: "
|
|
6102
|
-
right: "
|
|
6103
|
-
justify: "
|
|
6046
|
+
left: "Aligner à gauche",
|
|
6047
|
+
center: "Aligner au centre",
|
|
6048
|
+
right: "Aligner à droite",
|
|
6049
|
+
justify: "Justifier"
|
|
6104
6050
|
};
|
|
6105
6051
|
/**
|
|
6106
6052
|
* Checks if text alignment can be performed in the current editor state
|
|
@@ -6296,8 +6242,8 @@ var UNDO_REDO_SHORTCUT_KEYS = {
|
|
|
6296
6242
|
redo: "mod+shift+z"
|
|
6297
6243
|
};
|
|
6298
6244
|
var historyActionLabels = {
|
|
6299
|
-
undo: "
|
|
6300
|
-
redo: "
|
|
6245
|
+
undo: "Annuler",
|
|
6246
|
+
redo: "Rétablir"
|
|
6301
6247
|
};
|
|
6302
6248
|
var historyIcons = {
|
|
6303
6249
|
undo: UndoRounded_default,
|
|
@@ -6470,22 +6416,6 @@ var UndoRedoButton = forwardRef(({ editor: providedEditor, action, text, hideWhe
|
|
|
6470
6416
|
});
|
|
6471
6417
|
UndoRedoButton.displayName = "UndoRedoButton";
|
|
6472
6418
|
//#endregion
|
|
6473
|
-
//#region src/tiptap/components/ui-primitive/spacer/spacer.tsx
|
|
6474
|
-
function Spacer({ orientation = "horizontal", size, style = {}, ...props }) {
|
|
6475
|
-
const computedStyle = {
|
|
6476
|
-
...style,
|
|
6477
|
-
...orientation === "horizontal" && !size && { flex: 1 },
|
|
6478
|
-
...size && {
|
|
6479
|
-
width: orientation === "vertical" ? "1px" : size,
|
|
6480
|
-
height: orientation === "horizontal" ? "1px" : size
|
|
6481
|
-
}
|
|
6482
|
-
};
|
|
6483
|
-
return /* @__PURE__ */ jsx("div", {
|
|
6484
|
-
...props,
|
|
6485
|
-
style: computedStyle
|
|
6486
|
-
});
|
|
6487
|
-
}
|
|
6488
|
-
//#endregion
|
|
6489
6419
|
//#region src/tiptap/hooks/use-composed-ref.ts
|
|
6490
6420
|
var updateRef = (ref, value) => {
|
|
6491
6421
|
if (typeof ref === "function") ref(value);
|
|
@@ -6733,11 +6663,10 @@ ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
|
6733
6663
|
var FormattingControls = ({ editor }) => {
|
|
6734
6664
|
const hasSuperscriptSubscript = editor.extensionManager.extensions.map((e) => e.name).some((name) => name === "subscript" || name === "superscript");
|
|
6735
6665
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6736
|
-
/* @__PURE__ */ jsx(Spacer, {}),
|
|
6737
6666
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(UndoRedoButton, { action: "undo" }), /* @__PURE__ */ jsx(UndoRedoButton, { action: "redo" })] }),
|
|
6738
6667
|
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
6739
6668
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
6740
|
-
/* @__PURE__ */ jsx(
|
|
6669
|
+
/* @__PURE__ */ jsx(HeadingMenu, {
|
|
6741
6670
|
modal: false,
|
|
6742
6671
|
levels: [
|
|
6743
6672
|
1,
|
|
@@ -6760,19 +6689,34 @@ var FormattingControls = ({ editor }) => {
|
|
|
6760
6689
|
/* @__PURE__ */ jsx(MarkButton, { type: "underline" }),
|
|
6761
6690
|
/* @__PURE__ */ jsx(LinkPopover, {})
|
|
6762
6691
|
] }),
|
|
6692
|
+
hasSuperscriptSubscript ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToolbarSeparator, {}), /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(MarkButton, { type: "superscript" }), /* @__PURE__ */ jsx(MarkButton, { type: "subscript" })] })] }) : null,
|
|
6763
6693
|
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
6764
|
-
hasSuperscriptSubscript ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(MarkButton, { type: "superscript" }), /* @__PURE__ */ jsx(MarkButton, { type: "subscript" })] }), /* @__PURE__ */ jsx(ToolbarSeparator, {})] }) : null,
|
|
6765
6694
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
6766
6695
|
/* @__PURE__ */ jsx(TextAlignButton, { align: "left" }),
|
|
6767
6696
|
/* @__PURE__ */ jsx(TextAlignButton, { align: "center" }),
|
|
6768
6697
|
/* @__PURE__ */ jsx(TextAlignButton, { align: "right" }),
|
|
6769
6698
|
/* @__PURE__ */ jsx(TextAlignButton, { align: "justify" })
|
|
6770
|
-
] })
|
|
6771
|
-
/* @__PURE__ */ jsx(Spacer, {})
|
|
6699
|
+
] })
|
|
6772
6700
|
] });
|
|
6773
6701
|
};
|
|
6774
6702
|
FormattingControls.displayName = "FormattingControls";
|
|
6775
6703
|
//#endregion
|
|
6776
|
-
|
|
6704
|
+
//#region src/tiptap/components/ui-primitive/spacer/spacer.tsx
|
|
6705
|
+
function Spacer({ orientation = "horizontal", size, style = {}, ...props }) {
|
|
6706
|
+
const computedStyle = {
|
|
6707
|
+
...style,
|
|
6708
|
+
...orientation === "horizontal" && !size && { flex: 1 },
|
|
6709
|
+
...size && {
|
|
6710
|
+
width: orientation === "vertical" ? "1px" : size,
|
|
6711
|
+
height: orientation === "horizontal" ? "1px" : size
|
|
6712
|
+
}
|
|
6713
|
+
};
|
|
6714
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6715
|
+
...props,
|
|
6716
|
+
style: computedStyle
|
|
6717
|
+
});
|
|
6718
|
+
}
|
|
6719
|
+
//#endregion
|
|
6720
|
+
export { FormattingControls, Spacer, Toolbar, ToolbarGroup, ToolbarSeparator };
|
|
6777
6721
|
|
|
6778
6722
|
//# sourceMappingURL=index.es.js.map
|