@edifice.io/react 2.6.10-develop-pedago.20261022131512 → 2.6.10-develop.20261023111140

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.
Files changed (39) hide show
  1. package/dist/editor.js +0 -2
  2. package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +91 -110
  3. package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +96 -123
  4. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +8 -5
  5. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +8 -5
  6. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +2 -3
  7. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +4 -6
  8. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +2 -0
  9. package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +8 -0
  10. package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +3 -6
  11. package/dist/modules/editor/components/Toolbar/LinkToolbar.js +7 -29
  12. package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +2 -3
  13. package/dist/modules/editor/components/Toolbar/TableToolbar.js +45 -65
  14. package/dist/modules/editor/hooks/index.d.ts +0 -1
  15. package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
  16. package/dist/modules/editor/hooks/useCommentEditor.js +4 -12
  17. package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
  18. package/dist/modules/editor/hooks/useLinkToolbar.js +1 -2
  19. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
  20. package/dist/modules/editor/hooks/useTipTapEditor.js +24 -81
  21. package/dist/modules/modals/ResourceModal/ResourceModal.js +3 -3
  22. package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +9 -13
  23. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
  24. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
  25. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +0 -2
  26. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +0 -2
  27. package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +0 -4
  28. package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -2
  29. package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +0 -3
  30. package/package.json +43 -35
  31. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +0 -29
  32. package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +0 -22
  33. package/dist/modules/editor/hooks/useEditorState.d.ts +0 -20
  34. package/dist/modules/editor/hooks/useEditorState.js +0 -16
  35. package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm@3.32.0/node_modules/@tiptap/extension-floating-menu/dist/index.js +0 -159
  36. package/dist/node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js +0 -341
  37. package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +0 -549
  38. package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +0 -489
  39. package/dist/node_modules/.pnpm/prosemirror-transform@1.12.3/node_modules/prosemirror-transform/dist/index.js +0 -659
@@ -1,18 +1,15 @@
1
- import { HyperlinkAttributes } from '@edifice.io/tiptap-extensions/hyperlink';
2
- import { LinkerAttributes } from '@edifice.io/tiptap-extensions/linker';
3
1
  import { Editor } from '@tiptap/react';
4
- type LinkAttrs = LinkerAttributes | HyperlinkAttributes;
5
2
  interface LinkToolbarProps {
6
3
  /**
7
4
  * editor instance
8
5
  */
9
6
  editor: Editor | null;
10
7
  /** Handle Edit event */
11
- onEdit: (attrs: LinkAttrs | undefined) => void;
8
+ onEdit: (attrs: any) => void;
12
9
  /** Handle Open event */
13
- onOpen: (attrs: LinkAttrs | undefined) => void;
10
+ onOpen: (attrs: any) => void;
14
11
  /** Handle Unlink event */
15
- onUnlink: (attrs: LinkAttrs | undefined) => void;
12
+ onUnlink: (attrs: any) => void;
16
13
  }
17
14
  declare const LinkToolbar: ({ editor, onEdit, onOpen, onUnlink, }: LinkToolbarProps) => import("react/jsx-runtime").JSX.Element;
18
15
  export default LinkToolbar;
@@ -1,20 +1,13 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect, useCallback } from "react";
3
- import { BubbleMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
2
+ import { useState, useMemo, useEffect } from "react";
3
+ import { FloatingMenu } from "@tiptap/react";
4
4
  import { useTranslation } from "react-i18next";
5
- import { useEditorState } from "../../hooks/useEditorState.js";
6
5
  import SvgIconEdit from "../../../icons/components/IconEdit.js";
7
6
  import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
8
7
  import SvgIconUnlink from "../../../icons/components/IconUnlink.js";
9
- import { FLOATING_MENU_Z_INDEX, getFloatingMenuOptions } from "./FloatingMenuOptions.js";
8
+ import { tippyOptions } from "./LinkToolbar.TippyOptions.js";
10
9
  import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
11
- const floatingOptions = getFloatingMenuOptions({
12
- placement: "bottom",
13
- offset: {
14
- mainAxis: 10,
15
- crossAxis: 0
16
- }
17
- }), LinkToolbar = ({
10
+ const LinkToolbar = ({
18
11
  editor,
19
12
  onEdit,
20
13
  onOpen,
@@ -22,7 +15,7 @@ const floatingOptions = getFloatingMenuOptions({
22
15
  }) => {
23
16
  const {
24
17
  t
25
- } = useTranslation(), editorState = useEditorState(editor), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
18
+ } = useTranslation(), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
26
19
  type: "icon",
27
20
  name: "edit",
28
21
  props: {
@@ -59,24 +52,9 @@ const floatingOptions = getFloatingMenuOptions({
59
52
  position: "bottom"
60
53
  }
61
54
  }], [onEdit, onOpen, onUnlink, t, linkAttrs]);
62
- useEffect(() => {
55
+ return useEffect(() => {
63
56
  editor != null && editor.isActive("linker") ? setLinkAttrs(editor.getAttributes("linker")) : editor != null && editor.isActive("hyperlink") ? setLinkAttrs(editor.getAttributes("hyperlink")) : setLinkAttrs(void 0);
64
- }, [editor, editorState]);
65
- const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, [editor]);
66
- return /* @__PURE__ */ jsx(Fragment, { children: editor && // BubbleMenu, not FloatingMenu: `shouldShow` below overrides visibility
67
- // either way, this only changes the default position reference.
68
- /* @__PURE__ */ jsx(
69
- BubbleMenu,
70
- {
71
- editor,
72
- options: floatingOptions,
73
- shouldShow: handleShouldShow,
74
- style: {
75
- zIndex: FLOATING_MENU_Z_INDEX
76
- },
77
- children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems })
78
- }
79
- ) });
57
+ }, [editor == null ? void 0 : editor.state]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems }) }) });
80
58
  };
81
59
  export {
82
60
  LinkToolbar as default
@@ -1,7 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState, useCallback, useEffect } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
- import { useEditorState } from "../../hooks/useEditorState.js";
5
4
  import Tooltip from "../../../../components/Tooltip/Tooltip.js";
6
5
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
7
6
  import ColorPickerItem from "../../../../components/ColorPicker/ColorPickerItem.js";
@@ -13,7 +12,7 @@ const TableToolbarCellColor = ({
13
12
  }) => {
14
13
  const {
15
14
  t
16
- } = useTranslation(), [color, setColor] = useState("transparent"), editorState = useEditorState(editor), applyColor = useCallback((value) => {
15
+ } = useTranslation(), [color, setColor] = useState("transparent"), applyColor = useCallback((value) => {
17
16
  editor == null || editor.chain().focus().setCellAttribute(
18
17
  "backgroundColor",
19
18
  // reset color is transparent here => remove bkg color
@@ -22,7 +21,7 @@ const TableToolbarCellColor = ({
22
21
  }, [editor, setColor]);
23
22
  useEffect(() => {
24
23
  setColor((editor == null ? void 0 : editor.getAttributes("tableCell").backgroundColor) ?? "transparent");
25
- }, [editor, editorState]);
24
+ }, [editor, editor == null ? void 0 : editor.state]);
26
25
  const palettes = [{
27
26
  ...DefaultPalette,
28
27
  label: t("tiptap.table.toolbar.cell.color"),
@@ -1,12 +1,9 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect, useCallback } from "react";
3
- import { findParentNodeClosestToPos } from "@tiptap/react";
4
- import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
2
+ import { useState, useMemo, useEffect } from "react";
3
+ import { findParentNodeClosestToPos, FloatingMenu } from "@tiptap/react";
5
4
  import { useTranslation } from "react-i18next";
6
5
  import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
7
6
  import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
8
- import { useEditorState } from "../../hooks/useEditorState.js";
9
- import { getFloatingMenuOptions, FLOATING_MENU_Z_INDEX } from "./FloatingMenuOptions.js";
10
7
  import { TableToolbarAddMenu } from "./TableToolbar.AddMenu.js";
11
8
  import { TableToolbarCellColor } from "./TableToolbar.CellColor.js";
12
9
  import { TableToolbarDelMenu } from "./TableToolbar.DelMenu.js";
@@ -16,7 +13,7 @@ const TableToolbar = ({
16
13
  }) => {
17
14
  const {
18
15
  t
19
- } = useTranslation(), [isSpan, setSpan] = useState(void 0), editorState = useEditorState(editor), floatingOptions = useMemo(() => {
16
+ } = useTranslation(), [isSpan, setSpan] = useState(void 0), tippyOptions = useMemo(() => {
20
17
  function adjustRect(rect) {
21
18
  let yOffset = 0;
22
19
  if (window.visualViewport) {
@@ -26,15 +23,11 @@ const TableToolbar = ({
26
23
  return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
27
24
  }
28
25
  return {
29
- ...getFloatingMenuOptions({
30
- placement: "bottom",
31
- offset: {
32
- mainAxis: 0,
33
- crossAxis: 0
34
- }
35
- }),
36
- // Dead in v3: FloatingMenu has no reference-rect override (unlike
37
- // BubbleMenu's getReferencedVirtualElement), so this never runs.
26
+ placement: "bottom",
27
+ offset: [0, 0],
28
+ zIndex: 999,
29
+ // popperOptions: {modifiers: [ /*see popper v2 modifiers*/ ]},
30
+ // Try to get the bounding rect of the table.
38
31
  getReferenceClientRect: () => {
39
32
  const parentDiv = editor != null && editor.isActive("table") ? findParentNodeClosestToPos(editor.state.selection.$anchor, (node) => node.type.name === "table") : null;
40
33
  if (parentDiv) {
@@ -46,63 +39,50 @@ const TableToolbar = ({
46
39
  }
47
40
  };
48
41
  }, [editor]);
49
- useEffect(() => {
42
+ return useEffect(() => {
50
43
  const cellAttr = editor == null ? void 0 : editor.getAttributes("tableCell"), headAttr = editor == null ? void 0 : editor.getAttributes("tableHeader");
51
44
  if (typeof cellAttr < "u" || typeof headAttr < "u") {
52
45
  const newSpan = (cellAttr == null ? void 0 : cellAttr.colspan) > 1 || (cellAttr == null ? void 0 : cellAttr.rowspan) > 1 || (headAttr == null ? void 0 : headAttr.colspan) > 1 || (headAttr == null ? void 0 : headAttr.rowspan) > 1;
53
46
  newSpan !== isSpan && setSpan(newSpan);
54
47
  } else
55
48
  isSpan && setSpan(void 0);
56
- }, [editor, editorState, isSpan]);
57
- const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, [editor]);
58
- return /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(
59
- FloatingMenu,
60
- {
61
- editor,
62
- options: floatingOptions,
63
- shouldShow: handleShouldShow,
64
- style: {
65
- zIndex: FLOATING_MENU_Z_INDEX
66
- },
67
- children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
68
- type: "dropdown",
69
- name: "bkg-col",
70
- // isEnable:
71
- // typeof editor?.getAttributes("tableCell") !== "undefined",
72
- props: {
73
- children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
74
- }
75
- }, {
76
- type: "icon",
77
- name: "mergeorsplit",
78
- // isEnable: typeof isSpan !== "undefined",
79
- props: {
80
- icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
81
- "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
82
- onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
83
- },
84
- tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
85
- }, {
86
- type: "divider",
87
- name: "add-d0"
88
- }, {
89
- type: "dropdown",
90
- name: "add",
91
- props: {
92
- children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
93
- }
94
- }, {
95
- type: "divider",
96
- name: "add-d1"
97
- }, {
98
- type: "dropdown",
99
- name: "del",
100
- props: {
101
- children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
102
- }
103
- }] })
49
+ }, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
50
+ type: "dropdown",
51
+ name: "bkg-col",
52
+ // isEnable:
53
+ // typeof editor?.getAttributes("tableCell") !== "undefined",
54
+ props: {
55
+ children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
56
+ }
57
+ }, {
58
+ type: "icon",
59
+ name: "mergeorsplit",
60
+ // isEnable: typeof isSpan !== "undefined",
61
+ props: {
62
+ icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
63
+ "aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
64
+ onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
65
+ },
66
+ tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
67
+ }, {
68
+ type: "divider",
69
+ name: "add-d0"
70
+ }, {
71
+ type: "dropdown",
72
+ name: "add",
73
+ props: {
74
+ children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
75
+ }
76
+ }, {
77
+ type: "divider",
78
+ name: "add-d1"
79
+ }, {
80
+ type: "dropdown",
81
+ name: "del",
82
+ props: {
83
+ children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
104
84
  }
105
- ) });
85
+ }] }) }) });
106
86
  };
107
87
  export {
108
88
  TableToolbar as default
@@ -1,7 +1,6 @@
1
1
  export * from './useActionOptions';
2
2
  export * from './useCommentEditor';
3
3
  export * from './useEditorContext';
4
- export * from './useEditorState';
5
4
  export * from './useImageModal';
6
5
  export * from './useImageSelection';
7
6
  export * from './useLinkToolbar';
@@ -6,7 +6,7 @@ import { Content, HTMLContent } from '@tiptap/react';
6
6
  * @param content default rich content
7
7
  */
8
8
  export declare const useCommentEditor: (editable: boolean, content: Content, maxLength?: number) => {
9
- editor: import('@tiptap/core').Editor;
9
+ editor: import('@tiptap/core').Editor | null;
10
10
  commentLength: number;
11
11
  getComment: () => HTMLContent;
12
12
  resetComment: () => void;
@@ -1,22 +1,14 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
3
- import { CharacterCount } from "@tiptap/extensions";
3
+ import CharacterCount from "@tiptap/extension-character-count";
4
4
  import { useEditor } from "@tiptap/react";
5
5
  import StarterKit from "@tiptap/starter-kit";
6
6
  const useCommentEditor = (editable, content, maxLength = 800) => {
7
7
  const [commentLength, setCommentLength] = useState(0), editor = useEditor({
8
8
  editable,
9
- extensions: [
10
- // v3's StarterKit bundles its own 'link' mark, which would compete with
11
- // Hyperlink below for the same <a> tags. Disabled.
12
- StarterKit.configure({
13
- link: !1
14
- }),
15
- Hyperlink,
16
- CharacterCount.configure({
17
- limit: maxLength
18
- })
19
- ],
9
+ extensions: [StarterKit, Hyperlink, CharacterCount.configure({
10
+ limit: maxLength
11
+ })],
20
12
  content
21
13
  });
22
14
  return useEffect(() => {
@@ -12,7 +12,7 @@ import { MediaLibraryRef } from '../../multimedia';
12
12
  * }
13
13
  */
14
14
  export declare const useLinkToolbar: (editor: Editor | null, mediaLibraryRef: RefObject<MediaLibraryRef>) => {
15
- onEdit: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
16
- onOpen: (attrs: LinkerAttributes | HyperlinkAttributes | undefined) => void;
15
+ onEdit: (attrs: LinkerAttributes | HyperlinkAttributes) => void;
16
+ onOpen: (attrs: LinkerAttributes) => void;
17
17
  onUnlink: () => void;
18
18
  };
@@ -2,7 +2,6 @@ import { useCallback } from "react";
2
2
  const useLinkToolbar = (editor, mediaLibraryRef) => ({
3
3
  onEdit: useCallback((attrs) => {
4
4
  var _a, _b;
5
- if (!attrs) return;
6
5
  editor != null && editor.isActive("hyperlink") && editor.commands.extendMarkRange("hyperlink");
7
6
  const attrsLinker = attrs;
8
7
  if (attrsLinker["data-id"] || attrsLinker["data-app-prefix"])
@@ -26,7 +25,7 @@ const useLinkToolbar = (editor, mediaLibraryRef) => ({
26
25
  }
27
26
  }, [editor, mediaLibraryRef]),
28
27
  onOpen: (attrs) => {
29
- window.open((attrs == null ? void 0 : attrs.href) || "about:blank", "_blank");
28
+ window.open(attrs.href || "about:blank", "_blank");
30
29
  },
31
30
  onUnlink: () => {
32
31
  var _a, _b, _c, _d;
@@ -1,4 +1,4 @@
1
- import { Content, Editor, Extensions, FocusPosition } from '@tiptap/react';
1
+ import { Content, Extensions, FocusPosition } from '@tiptap/react';
2
2
  import { WorkspaceVisibility } from '@edifice.io/client';
3
3
  /**
4
4
  * Hook that creates a tiptap editor instance.
@@ -13,8 +13,8 @@ import { WorkspaceVisibility } from '@edifice.io/client';
13
13
  * @returns the editor instance and the editable state
14
14
  */
15
15
  export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
16
- editor: Editor;
16
+ editor: any;
17
17
  }) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
18
- editor: Editor;
18
+ editor: import('@tiptap/core').Editor | null;
19
19
  editable: boolean;
20
20
  };
@@ -9,14 +9,18 @@ import { SpeechSynthesis } from "@edifice.io/tiptap-extensions/speech-synthesis"
9
9
  import { TableCell } from "@edifice.io/tiptap-extensions/table-cell";
10
10
  import { Mathematics } from "@tiptap/extension-mathematics";
11
11
  import Color from "@tiptap/extension-color";
12
+ import Focus from "@tiptap/extension-focus";
12
13
  import FontFamily from "@tiptap/extension-font-family";
13
- import { TextStyleKit } from "@tiptap/extension-text-style";
14
- import { Focus, Placeholder } from "@tiptap/extensions";
14
+ import Placeholder from "@tiptap/extension-placeholder";
15
15
  import Subscript from "@tiptap/extension-subscript";
16
16
  import Superscript from "@tiptap/extension-superscript";
17
- import { TableRow, TableHeader, Table } from "@tiptap/extension-table";
17
+ import Table from "@tiptap/extension-table";
18
+ import TableHeader from "@tiptap/extension-table-header";
19
+ import TableRow from "@tiptap/extension-table-row";
18
20
  import TextAlign from "@tiptap/extension-text-align";
21
+ import TextStyle from "@tiptap/extension-text-style";
19
22
  import Typography from "@tiptap/extension-typography";
23
+ import Underline from "@tiptap/extension-underline";
20
24
  import { useEditor } from "@tiptap/react";
21
25
  import StarterKit from "@tiptap/starter-kit";
22
26
  import { useTranslation } from "react-i18next";
@@ -46,81 +50,22 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
46
50
  // TipTap editor must be instantiated in editable mode for table columns to be resizable.
47
51
  // It will then be set in the correct editable mode, by a useEffect below.
48
52
  editable: !0,
49
- extensions: [
50
- // v3's StarterKit bundles its own heading/link nodes, which would compete with
51
- // CustomHeading/Hyperlink below for the same HTML tags. Disabled.
52
- // `underline` stays enabled (default) - same as the explicit Underline
53
- // extension it replaces, no custom one added below.
54
- StarterKit.configure({
55
- heading: !1,
56
- link: !1
57
- }),
58
- Focus.configure({
59
- className: "has-focus",
60
- mode: "all"
61
- }),
62
- Placeholder.configure({
63
- placeholder: t(placeholder || "tiptap.placeholder")
64
- }),
65
- CustomHighlight.configure({
66
- multicolor: !0
67
- }),
68
- // v3's TextStyleKit bundles its own color/fontFamily/fontSize, which would
69
- // duplicate the Color/FontFamily/FontSize added below. Disabled.
70
- // backgroundColor/lineHeight are also disabled: they're new in v3 (v2
71
- // stripped these inline styles), and lineHeight would otherwise collide
72
- // with our own @edifice.io/tiptap-extensions/line-height by name for
73
- // any caller that adds it via this hook's `extensions` param.
74
- TextStyleKit.configure({
75
- color: !1,
76
- fontFamily: !1,
77
- fontSize: !1,
78
- backgroundColor: !1,
79
- lineHeight: !1
80
- }),
81
- Color,
82
- Subscript,
83
- Superscript,
84
- Table.configure({
85
- resizable: !0
86
- }),
87
- TableRow,
88
- TableHeader,
89
- TableCell,
90
- TextAlign.configure({
91
- types: ["heading", "paragraph", "video", "audio", "iframe"]
92
- }),
93
- // The published package names this node 'customHeading' (to avoid
94
- // colliding with v3 StarterKit's now-bundled 'heading', disabled
95
- // above). Pinned back to 'heading' to match what's already stored for
96
- // existing content, and what edifice-tiptap-transformer's own Heading
97
- // model does server-side - without this, loading any stored content
98
- // with a heading throws "Unknown node type: heading" and the editor
99
- // falls back to an empty document.
100
- CustomHeading.extend({
101
- name: "heading"
102
- }).configure({
103
- levels: [1, 2]
104
- }),
105
- Typography,
106
- FontSize,
107
- SpeechRecognition,
108
- SpeechSynthesis.configure({
109
- lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
110
- }),
111
- Hyperlink,
112
- FontFamily,
113
- Mathematics,
114
- Alert,
115
- IframeNodeView(MediaRenderer),
116
- VideoNodeView(MediaRenderer),
117
- AudioNodeView(AudioRenderer),
118
- LinkerNodeView(LinkerRenderer),
119
- ImageNodeView(MediaRenderer, uploadFile),
120
- AttachmentNodeView(AttachmentRenderer),
121
- InformationPaneNodeView(InformationPaneRenderer),
122
- ...extensions || []
123
- ],
53
+ extensions: [StarterKit, Focus.configure({
54
+ className: "has-focus",
55
+ mode: "all"
56
+ }), Placeholder.configure({
57
+ placeholder: t(placeholder || "tiptap.placeholder")
58
+ }), CustomHighlight.configure({
59
+ multicolor: !0
60
+ }), Underline, TextStyle, Color, Subscript, Superscript, Table.configure({
61
+ resizable: !0
62
+ }), TableRow, TableHeader, TableCell, TextAlign.configure({
63
+ types: ["heading", "paragraph", "video", "audio", "iframe"]
64
+ }), CustomHeading.configure({
65
+ levels: [1, 2]
66
+ }), Typography, FontSize, SpeechRecognition, SpeechSynthesis.configure({
67
+ lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
68
+ }), Hyperlink, FontFamily, Mathematics, Alert, IframeNodeView(MediaRenderer), VideoNodeView(MediaRenderer), AudioNodeView(AudioRenderer), LinkerNodeView(LinkerRenderer), ImageNodeView(MediaRenderer, uploadFile), AttachmentNodeView(AttachmentRenderer), InformationPaneNodeView(InformationPaneRenderer), ...extensions || []],
124
69
  content,
125
70
  // If the onContentChange callback is provided, we call it on every content change.
126
71
  ...onContentChange ? {
@@ -130,9 +75,7 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
130
75
  return useEffect(() => {
131
76
  editor == null || editor.setEditable(editable, !1);
132
77
  }, [editor, editable]), useEffect(() => {
133
- editor == null || editor.commands.setContent(content, {
134
- emitUpdate: !1
135
- });
78
+ editor == null || editor.commands.setContent(content);
136
79
  }, [content]), useEffect(() => {
137
80
  focus && (editor == null || editor.commands.focus(focus));
138
81
  }, [editor, focus, editable]), {
@@ -143,9 +143,9 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
143
143
  maxLength: textareaMaxLength
144
144
  }), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength, showCounter: !0 })
145
145
  ] }),
146
- application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs(FormControl, { id: "allowReplies", className: "d-flex gap-8 mt-16 mb-8", children: [
147
- /* @__PURE__ */ jsx(FormControl.Input, { type: "checkbox", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies"), className: "form-check-input mt-0", size: "sm" }),
148
- /* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.resource.editModal.comments.allowReplies") })
146
+ application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs("div", { className: "form-check d-flex align-items-center gap-8 mt-16 mb-8", children: [
147
+ /* @__PURE__ */ jsx("input", { id: "allowReplies", type: "checkbox", className: "form-check-input mt-0", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies") }),
148
+ /* @__PURE__ */ jsx("label", { htmlFor: "allowReplies", className: "form-check-label mb-0", children: t("explorer.resource.editModal.comments.allowReplies") })
149
149
  ] })
150
150
  ] })
151
151
  ] }),
@@ -4,8 +4,7 @@ import SvgIconCopy from "../../../icons/components/IconCopy.js";
4
4
  import { useSlug } from "../hooks/useSlug.js";
5
5
  import Heading from "../../../../components/Heading/Heading.js";
6
6
  import Alert from "../../../../components/Alert/Alert.js";
7
- import FormControl from "../../../../components/Form/FormControl.js";
8
- import Input from "../../../../components/Input/Input.js";
7
+ import Switch from "../../../../components/Switch/Switch.js";
9
8
  import Button from "../../../../components/Button/Button.js";
10
9
  const BlogPublic = ({
11
10
  appCode,
@@ -34,18 +33,15 @@ const BlogPublic = ({
34
33
  appCode
35
34
  ] }),
36
35
  /* @__PURE__ */ jsx(Alert, { type: "info", children: t("explorer.resource.editModal.access.alert") }),
37
- /* @__PURE__ */ jsxs(FormControl, { id: "flexSwitchCheckDefault", className: "form-switch d-flex gap-8 mt-16 mb-8", children: [
38
- /* @__PURE__ */ jsx(FormControl.Input, { type: "checkbox", role: "switch", defaultChecked: isUpdating ? resource.public : !1, ...register("enablePublic", {
39
- disabled: !resourceName,
40
- onChange: (event) => {
41
- const checked = event.target.checked;
42
- onPublicChange(checked);
43
- }
44
- }), className: "form-check-input mt-0", size: "md" }),
45
- /* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label") })
46
- ] }),
36
+ /* @__PURE__ */ jsx(Switch, { id: "flexSwitchCheckDefault", role: "switch", className: "mt-16 mb-8", label: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label"), defaultChecked: isUpdating ? resource.public : !1, ...register("enablePublic", {
37
+ disabled: !resourceName,
38
+ onChange: (event) => {
39
+ const checked = event.target.checked;
40
+ onPublicChange(checked);
41
+ }
42
+ }) }),
47
43
  isPublic && /* @__PURE__ */ jsxs(Fragment, { children: [
48
- /* @__PURE__ */ jsx(FormControl, { id: "formSlug", children: /* @__PURE__ */ jsx(Input, { type: "text", hidden: !0, defaultValue: isUpdating ? slug : "", ...register("formSlug"), size: "sm" }) }, slug),
44
+ /* @__PURE__ */ jsx("input", { type: "hidden", defaultValue: isUpdating ? slug : "", ...register("formSlug") }, slug),
49
45
  /* @__PURE__ */ jsxs("div", { className: "d-flex flex-wrap align-items-center gap-4", children: [
50
46
  /* @__PURE__ */ jsxs("p", { className: "text-break", children: [
51
47
  window.location.origin,
@@ -1,4 +1,3 @@
1
- import { ReactNode } from 'react';
2
1
  import { App, ILinkedResource } from '@edifice.io/client';
3
2
  /**
4
3
  * Definition of an internal link.
@@ -33,11 +32,6 @@ export interface InternalLinkerProps {
33
32
  applicationList?: ApplicationOption[];
34
33
  /** Whether to show the application selector */
35
34
  showApplicationSelector?: boolean;
36
- /**
37
- * Rendered on the search row, where the application selector sits, for
38
- * consumers that hide that selector but still need a filter of their own.
39
- */
40
- searchFilter?: ReactNode;
41
35
  /** Disable application selecetor */
42
36
  disableApplicationSelector?: boolean;
43
37
  /** Optional callback to filter resources after loading. Applied in addition to search filters. */
@@ -55,5 +49,5 @@ export interface InternalLinkerProps {
55
49
  /** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
56
50
  loadMoreLabel?: string;
57
51
  }
58
- export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, searchFilter, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
59
53
  export default InternalLinker;
@@ -23,7 +23,6 @@ const InternalLinker = ({
23
23
  resourceList,
24
24
  applicationList,
25
25
  showApplicationSelector = !0,
26
- searchFilter,
27
26
  disableApplicationSelector = !1,
28
27
  resourceFilter,
29
28
  onSearch,
@@ -132,7 +131,6 @@ const InternalLinker = ({
132
131
  ] }), variant: "ghost", size: "md", disabled: disableApplicationSelector }),
133
132
  /* @__PURE__ */ jsx(Dropdown.Menu, { children: options == null ? void 0 : options.map((option) => /* @__PURE__ */ jsx(Dropdown.Item, { icon: option.icon, onClick: () => handleOptionClick(option), children: option.displayName }, option.application)) })
134
133
  ] }) }),
135
- !showApplicationSelector && searchFilter && /* @__PURE__ */ jsx("div", { className: "flex-shrink-1 px-8 py-12 border-end align-self-center", children: searchFilter }),
136
134
  /* @__PURE__ */ jsx("div", { className: "flex-grow-1 align-self-center", children: /* @__PURE__ */ jsx("form", { className: "gap-16 d-flex w-100 align-items-center px-16 py-8", onSubmit: handleSubmit, children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, placeholder: t("search"), size: "lg", className: "w-100", disabled: !selectedApplication, onChange: handleSearchChange }) }) })
137
135
  ] }),
138
136
  /* @__PURE__ */ jsxs("div", { className: "internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto", children: [
@@ -65,8 +65,6 @@ export interface MediaLibraryProps {
65
65
  visibility: WorkspaceVisibility;
66
66
  /** Allow selecting / uploading multiple files at once ? */
67
67
  multiple?: boolean;
68
- /** Restrict attachments to PDF files in Workspace and Upload. */
69
- pdfOnly?: boolean;
70
68
  /**
71
69
  * Called when the user validates the modal (Add button).
72
70
  * @param result depends on which InnerTab is visible
@@ -70,7 +70,6 @@ const orderedTabs = [
70
70
  appCode,
71
71
  visibility,
72
72
  multiple,
73
- pdfOnly,
74
73
  onSuccess,
75
74
  onCancel,
76
75
  onTabChange
@@ -225,7 +224,6 @@ const orderedTabs = [
225
224
  appCode,
226
225
  visibility,
227
226
  multiple,
228
- pdfOnly,
229
227
  type,
230
228
  setResultCounter,
231
229
  setResult,
@@ -7,8 +7,6 @@ export declare const MediaLibraryContext: import('react').Context<{
7
7
  visibility?: WorkspaceVisibility;
8
8
  /** Allow selecting / uploading multiple files at once ? */
9
9
  multiple?: boolean;
10
- /** Restrict attachments to PDF files in Workspace and Upload. */
11
- pdfOnly?: boolean;
12
10
  /** Type of resource to search for. */
13
11
  type: MediaLibraryType | null;
14
12
  /** Set the counter in the success button label. */
@@ -38,8 +36,6 @@ export declare function useMediaLibraryContext(): {
38
36
  visibility?: WorkspaceVisibility;
39
37
  /** Allow selecting / uploading multiple files at once ? */
40
38
  multiple?: boolean;
41
- /** Restrict attachments to PDF files in Workspace and Upload. */
42
- pdfOnly?: boolean;
43
39
  /** Type of resource to search for. */
44
40
  type: MediaLibraryType | null;
45
41
  /** Set the counter in the success button label. */