diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 7d5f5e0e3..c4d29610b 100755 Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ diff --git a/frontend/package.json b/frontend/package.json index ad8422936..472f76af9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,17 +13,17 @@ "license": "MIT", "devDependencies": { "@biomejs/biome": "1.9.4", - "@happy-dom/global-registrator": "15.11.7", + "@happy-dom/global-registrator": "16.5.2", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "6.6.3", "@testing-library/react": "16.1.0", - "@types/bun": "1.1.14", - "@types/react": "19.0.1", + "@types/bun": "1.1.15", + "@types/react": "19.0.3", "@types/react-dom": "19.0.2", "@types/react-redux": "7.1.34", "@vitejs/plugin-react": "4.3.4", "typescript": "5.7.2", - "vite": "6.0.3", + "vite": "6.0.7", "vite-tsconfig-paths": "5.1.4" }, "dependencies": { @@ -31,42 +31,42 @@ "@grafana/faro-web-sdk": "1.12.2", "@grafana/faro-web-tracing": "1.12.2", "@hocuspocus/provider": "2.15.0", - "@navikt/aksel-icons": "7.8.0", - "@navikt/ds-css": "7.8.0", - "@navikt/ds-react": "7.8.0", + "@navikt/aksel-icons": "7.9.1", + "@navikt/ds-css": "7.9.1", + "@navikt/ds-react": "7.9.1", "@navikt/fnrvalidator": "2.1.5", "@reduxjs/toolkit": "2.5.0", "@slate-yjs/core": "1.0.2", "@slate-yjs/react": "1.1.0", "@styled-icons/fluentui-system-regular": "10.47.0", "@types/qs": "6.9.17", - "@udecode/plate": "40.3.4", - "@udecode/plate-alignment": "40.0.0", - "@udecode/plate-autoformat": "40.0.0", - "@udecode/plate-basic-marks": "40.0.0", - "@udecode/plate-break": "40.0.0", - "@udecode/plate-common": "40.3.1", - "@udecode/plate-core": "40.3.1", - "@udecode/plate-cursor": "40.0.0", - "@udecode/plate-docx": "40.2.7", - "@udecode/plate-font": "40.0.0", - "@udecode/plate-heading": "40.2.6", - "@udecode/plate-indent": "40.0.0", - "@udecode/plate-list": "40.0.0", - "@udecode/plate-resizable": "40.0.0", - "@udecode/plate-table": "40.0.0", - "@udecode/plate-yjs": "40.0.0", - "@udecode/slate-react": "40.3.1", + "@udecode/plate": "41.0.14", + "@udecode/plate-alignment": "41.0.0", + "@udecode/plate-autoformat": "41.0.0", + "@udecode/plate-basic-marks": "41.0.0", + "@udecode/plate-break": "41.0.0", + "@udecode/plate-common": "41.0.13", + "@udecode/plate-core": "41.0.13", + "@udecode/plate-cursor": "41.0.0", + "@udecode/plate-docx": "41.0.10", + "@udecode/plate-font": "41.0.12", + "@udecode/plate-heading": "41.0.0", + "@udecode/plate-indent": "41.0.0", + "@udecode/plate-list": "41.0.0", + "@udecode/plate-resizable": "41.0.0", + "@udecode/plate-table": "41.0.9", + "@udecode/plate-yjs": "41.0.0", + "@udecode/slate-react": "41.0.5", "qs": "6.13.1", "react": "19.0.0", "react-dom": "19.0.0", "react-redux": "9.2.0", - "react-router": "7.0.2", - "react-router-dom": "7.0.2", + "react-router": "7.1.1", + "react-router-dom": "7.1.1", "slate": "0.112.0", "slate-history": "0.110.3", "slate-react": "0.112.0", - "styled-components": "6.1.13", - "yjs": "13.6.20" + "styled-components": "6.1.14", + "yjs": "13.6.21" } } diff --git a/frontend/src/plate/components/fullmektig.tsx b/frontend/src/plate/components/fullmektig.tsx index 72fc7fee5..a2b8bbe07 100644 --- a/frontend/src/plate/components/fullmektig.tsx +++ b/frontend/src/plate/components/fullmektig.tsx @@ -6,7 +6,7 @@ import { isOfElementType } from '@app/plate/utils/queries'; import { ArrowUndoIcon } from '@navikt/aksel-icons'; import { Button, Loader } from '@navikt/ds-react'; import { findDescendant, replaceNodeChildren, withoutSavingHistory } from '@udecode/plate-common'; -import { PlateElement, type PlateElementProps, findNodePath } from '@udecode/plate-common/react'; +import { PlateElement, type PlateElementProps, findPath } from '@udecode/plate-common/react'; import { useEffect } from 'react'; import { setNodes, withoutNormalizing } from 'slate'; import { styled } from 'styled-components'; @@ -17,7 +17,7 @@ export const Fullmektig = (props: PlateElementProps) => { const { id, show } = element; const editor = useMyPlateEditorRef(); - const at = findNodePath(editor, element); + const at = findPath(editor, element); const valueEntry = findDescendant(editor, { at, diff --git a/frontend/src/plate/components/legacy-redigerbar-maltekst.tsx b/frontend/src/plate/components/legacy-redigerbar-maltekst.tsx index a2ad46952..3ded24c38 100644 --- a/frontend/src/plate/components/legacy-redigerbar-maltekst.tsx +++ b/frontend/src/plate/components/legacy-redigerbar-maltekst.tsx @@ -16,7 +16,7 @@ import { Button, Loader, Tooltip } from '@navikt/ds-react'; import { skipToken } from '@reduxjs/toolkit/query'; import { replaceNodeChildren } from '@udecode/plate-common'; import { PlateElement, type PlateElementProps } from '@udecode/plate-common/react'; -import { findNodePath } from '@udecode/slate-react'; +import { findPath } from '@udecode/slate-react'; import { useCallback, useContext, useEffect, useRef } from 'react'; const consistsOfOnlyEmptyVoid = (element: RedigerbarMaltekstElement) => { @@ -42,7 +42,7 @@ export const LegacyRedigerbarMaltekst = (props: PlateElementProps) => { return; } - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (path === undefined) { return; diff --git a/frontend/src/plate/components/maltekst/maltekst.tsx b/frontend/src/plate/components/maltekst/maltekst.tsx index 933095449..ef96b3a28 100644 --- a/frontend/src/plate/components/maltekst/maltekst.tsx +++ b/frontend/src/plate/components/maltekst/maltekst.tsx @@ -13,7 +13,7 @@ import { ArrowCirclepathIcon, PadlockUnlockedIcon } from '@navikt/aksel-icons'; import { Button, Tooltip } from '@navikt/ds-react'; import { isElement, replaceNodeChildren, unwrapNodes } from '@udecode/plate-common'; import { PlateElement, type PlateElementProps } from '@udecode/plate-common/react'; -import { findNodePath, isEditorReadOnly } from '@udecode/slate-react'; +import { findPath, isEditorReadOnly } from '@udecode/slate-react'; import { useContext, useMemo } from 'react'; export const Maltekst = (props: PlateElementProps) => { @@ -33,7 +33,7 @@ export const Maltekst = (props: PlateElementProps) => { return; } - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (path === undefined) { return; diff --git a/frontend/src/plate/components/maltekstseksjon/use-path.ts b/frontend/src/plate/components/maltekstseksjon/use-path.ts index f38e4b9fb..d2f9c7237 100644 --- a/frontend/src/plate/components/maltekstseksjon/use-path.ts +++ b/frontend/src/plate/components/maltekstseksjon/use-path.ts @@ -1,10 +1,10 @@ import type { MaltekstseksjonElement } from '@app/plate/types'; -import { type PlateEditor, findNodePath } from '@udecode/plate-common/react'; +import { type PlateEditor, findPath } from '@udecode/plate-common/react'; import { useEffect, useRef } from 'react'; import { Path } from 'slate'; export const usePath = (editor: PlateEditor, element: MaltekstseksjonElement) => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); const previous = useRef(path); useEffect(() => { diff --git a/frontend/src/plate/components/placeholder/placeholder.tsx b/frontend/src/plate/components/placeholder/placeholder.tsx index 3e8b55ff2..94c156f14 100644 --- a/frontend/src/plate/components/placeholder/placeholder.tsx +++ b/frontend/src/plate/components/placeholder/placeholder.tsx @@ -20,7 +20,7 @@ import { getEndPoint, getPreviousPath, setSelection } from '@udecode/plate-commo import { PlateElement, type PlateElementProps, - findNodePath, + findPath, focusEditor, isEditorFocused, useEditorReadOnly, @@ -51,7 +51,7 @@ const Placeholder = ({ canManage, ...props }: PlaceholderProps) => { const onClick = useCallback( (e: React.MouseEvent) => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (!hasNoVisibleText) { return; @@ -68,11 +68,11 @@ const Placeholder = ({ canManage, ...props }: PlaceholderProps) => { [containsEmptyChar, editor, element, hasNoVisibleText], ); - const isFocused = getIsFocused(editor, findNodePath(editor, element)); + const isFocused = getIsFocused(editor, findPath(editor, element)); // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: ¯\_(ツ)_/¯ useEffect(() => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (isDragging || path === undefined) { return; @@ -115,7 +115,7 @@ const Placeholder = ({ canManage, ...props }: PlaceholderProps) => { const deletePlaceholder = useCallback( (event: MouseEvent) => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (path === undefined) { return; @@ -145,7 +145,7 @@ const Placeholder = ({ canManage, ...props }: PlaceholderProps) => { ); const hideDeleteButton = useMemo(() => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); return ( !(canManage && hasNoVisibleText) || diff --git a/frontend/src/plate/components/redigerbar-maltekst.tsx b/frontend/src/plate/components/redigerbar-maltekst.tsx index 799292d6c..f9aed446f 100644 --- a/frontend/src/plate/components/redigerbar-maltekst.tsx +++ b/frontend/src/plate/components/redigerbar-maltekst.tsx @@ -10,7 +10,7 @@ import { ArrowCirclepathIcon } from '@navikt/aksel-icons'; import { Button, Tooltip } from '@navikt/ds-react'; import { replaceNodeChildren } from '@udecode/plate-common'; import { PlateElement, type PlateElementProps } from '@udecode/plate-common/react'; -import { findNodePath, isEditorReadOnly } from '@udecode/slate-react'; +import { findPath, isEditorReadOnly } from '@udecode/slate-react'; import { useContext } from 'react'; export const RedigerbarMaltekst = (props: PlateElementProps) => { @@ -25,7 +25,7 @@ export const RedigerbarMaltekst = (props: PlateElementProps { return () => clearTimeout(timeout); }, [regelverkContainerElement]); - const path = findNodePath(editor, element); + const path = findPath(editor, element); return ( = { +export const components = { [BaseParagraphPlugin.key]: Paragraph, // Headings diff --git a/frontend/src/plate/toolbar/table/helpers.ts b/frontend/src/plate/toolbar/table/helpers.ts index f22822ac4..d59812d43 100644 --- a/frontend/src/plate/toolbar/table/helpers.ts +++ b/frontend/src/plate/toolbar/table/helpers.ts @@ -2,11 +2,10 @@ import type { RichTextEditor, TableCellElement, TableRowElement } from '@app/pla import { isOfElementType, isOfElementTypeFn } from '@app/plate/utils/queries'; import { type TNode, type TNodeEntry, findNode, getParentNode, someNode } from '@udecode/plate-common'; import { BaseTableCellPlugin, BaseTableRowPlugin } from '@udecode/plate-table'; -import { findNodePath } from '@udecode/slate-react'; import { Path } from 'slate'; const findPath = (editor: RichTextEditor, node: TNode | undefined = undefined): Path | undefined => - node === undefined ? undefined : findNodePath(editor, node); + node === undefined ? undefined : findPath(editor, node); // Cell helpers export const getCurrentCell = (editor: RichTextEditor): TNodeEntry | undefined => diff --git a/frontend/src/plate/toolbar/table/merge-cells.ts b/frontend/src/plate/toolbar/table/merge-cells.ts index 691116277..93d522a33 100644 --- a/frontend/src/plate/toolbar/table/merge-cells.ts +++ b/frontend/src/plate/toolbar/table/merge-cells.ts @@ -10,12 +10,12 @@ import { withoutNormalizing, } from '@udecode/plate-common'; import { BaseTableCellPlugin, BaseTableRowPlugin } from '@udecode/plate-table'; -import { findNodePath } from '@udecode/slate-react'; +import { findPath } from '@udecode/slate-react'; export const mergeCells = ( editor: RichTextEditor, cellNode: TableCellElement, - cellPath = findNodePath(editor, cellNode), + cellPath = findPath(editor, cellNode), ) => { const rowEntry = getCurrentRow(editor, cellNode, cellPath); diff --git a/frontend/src/plate/toolbar/table/table.tsx b/frontend/src/plate/toolbar/table/table.tsx index aa45d202a..9ccd0e788 100644 --- a/frontend/src/plate/toolbar/table/table.tsx +++ b/frontend/src/plate/toolbar/table/table.tsx @@ -30,7 +30,7 @@ import { insertTableColumn, insertTableRow, } from '@udecode/plate-table'; -import { deleteColumn, deleteRow } from '@udecode/plate-table/react'; +import { deleteColumn, deleteRow } from '@udecode/plate-table'; export const TableButtons = () => { const editor = useMyPlateEditorRef(); diff --git a/frontend/src/plate/utils/queries.ts b/frontend/src/plate/utils/queries.ts index 8100ea5ee..ec101993f 100644 --- a/frontend/src/plate/utils/queries.ts +++ b/frontend/src/plate/utils/queries.ts @@ -28,7 +28,7 @@ import type { PlateEditor } from '@udecode/plate-core/react'; import { HEADING_KEYS } from '@udecode/plate-heading'; import { BaseBulletedListPlugin, BaseNumberedListPlugin } from '@udecode/plate-list'; import { BaseTablePlugin } from '@udecode/plate-table'; -import { findNodePath } from '@udecode/slate-react'; +import { findPath } from '@udecode/slate-react'; // Ensures a next-path even though original path is at end export const nextPath = (path: number[]) => { @@ -124,7 +124,7 @@ export const isPlaceholderActive = (editor: PlateEditor) => someNode(editor, { match: { type: SaksbehandlerPlaceholderPlugin.key } }); export const getIsInRegelverk = (editor: PlateEditor, element: TNode): boolean => { - const path = findNodePath(editor, element); + const path = findPath(editor, element); if (path === undefined) { return false;