@kystverket/styrbord 2.8.0 → 2.9.0
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/src/components/kystverket/RichTextArea/richTextArea.editor.d.ts +4 -0
- package/dist/src/components/kystverket/RichTextArea/richTextArea.editorFactory.d.ts +5 -1
- package/dist/src/components/kystverket/RichTextArea/richTextArea.stories.d.ts +2 -0
- package/dist/src/components/kystverket/RichTextArea/richTextArea.types.d.ts +1 -0
- package/dist/src/components/shared/CharacterCounter/CharacterCounter.d.ts +9 -0
- package/dist/style.css +1 -1
- package/dist/style.js +2380 -2257
- package/dist/style.umd.cjs +12 -9
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { InlineImageConfig } from '@milkdown/components/image-inline';
|
|
2
|
+
import type { Node as ProseNode } from '@milkdown/prose/model';
|
|
3
|
+
import { Plugin } from '@milkdown/prose/state';
|
|
2
4
|
import type { EditorView } from '@milkdown/prose/view';
|
|
3
5
|
import type { ImageInsertHandler, UploadImageFn } from './richTextArea.types';
|
|
4
6
|
export declare const normalizeMarkdownBreakTags: (value: string) => string;
|
|
@@ -19,3 +21,5 @@ export declare const createRichTextAreaInlineImageConfig: (uploadImage: UploadIm
|
|
|
19
21
|
confirmButton: string | undefined;
|
|
20
22
|
uploadPlaceholderText: string;
|
|
21
23
|
};
|
|
24
|
+
export type MeasureValueLength = (doc: ProseNode) => number;
|
|
25
|
+
export declare const createRichTextAreaMaxLengthPlugin: (getMaxLength: () => number | undefined, isExternalUpdate: () => boolean, measure: MeasureValueLength) => Plugin<any>;
|
|
@@ -16,6 +16,10 @@ type CreateRichTextAreaEditorParams = {
|
|
|
16
16
|
onMarkdownUpdated: (ctx: Ctx, markdown: string) => void;
|
|
17
17
|
/** Fires synchronously on every doc-changing transaction, unlike onMarkdownUpdated which is debounced by @milkdown/plugin-listener. */
|
|
18
18
|
onEmptyChange: (isEmpty: boolean) => void;
|
|
19
|
+
toValue: (markdown: string) => string;
|
|
20
|
+
onValueLengthChange: (length: number) => void;
|
|
21
|
+
getMaxLength: () => number | undefined;
|
|
22
|
+
isExternalUpdate: () => boolean;
|
|
19
23
|
};
|
|
20
|
-
export declare const createRichTextAreaEditor: ({ root, disabled, editorMarkdown, describedBy, canReachToolbar, canUploadImage, dispatchImageFromFile, updateInlineImageConfig, updateToolbarState, onMarkdownUpdated, onEmptyChange, }: CreateRichTextAreaEditorParams) => Editor;
|
|
24
|
+
export declare const createRichTextAreaEditor: ({ root, disabled, editorMarkdown, describedBy, canReachToolbar, canUploadImage, dispatchImageFromFile, updateInlineImageConfig, updateToolbarState, onMarkdownUpdated, onEmptyChange, toValue, onValueLengthChange, getMaxLength, isExternalUpdate, }: CreateRichTextAreaEditorParams) => Editor;
|
|
21
25
|
export {};
|
|
@@ -15,6 +15,7 @@ declare const meta: {
|
|
|
15
15
|
optional?: boolean | string | undefined;
|
|
16
16
|
required?: boolean | string | undefined;
|
|
17
17
|
error?: string | undefined;
|
|
18
|
+
maxLength?: number | undefined;
|
|
18
19
|
bottomToolbar?: React.ReactNode;
|
|
19
20
|
showToolbar?: boolean | undefined;
|
|
20
21
|
onImageUpload?: import("./richTextArea.types").OnImageUploadFn | undefined;
|
|
@@ -28,6 +29,7 @@ export declare const Default: Story;
|
|
|
28
29
|
export declare const Disabled: Story;
|
|
29
30
|
export declare const WithCodeFormatting: Story;
|
|
30
31
|
export declare const WithError: Story;
|
|
32
|
+
export declare const WithMaxLength: Story;
|
|
31
33
|
export declare const WithBottomToolbar: Story;
|
|
32
34
|
/**
|
|
33
35
|
* Demonstrates stable image references in markdown.
|
|
@@ -13,6 +13,7 @@ export type RichTextAreaProps = {
|
|
|
13
13
|
optional?: boolean | string;
|
|
14
14
|
required?: boolean | string;
|
|
15
15
|
error?: string;
|
|
16
|
+
maxLength?: number;
|
|
16
17
|
/** Used for the bottomToolbar */
|
|
17
18
|
bottomToolbar?: ReactNode;
|
|
18
19
|
/** Optional upload handler that returns a display src and optional stable image ref. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement, RefObject } from 'react';
|
|
2
|
+
type CharacterCounterProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
count: number;
|
|
5
|
+
maxLength: number;
|
|
6
|
+
focusScopeRef: RefObject<HTMLElement | null>;
|
|
7
|
+
};
|
|
8
|
+
export declare const CharacterCounter: ({ id, count, maxLength, focusScopeRef }: CharacterCounterProps) => ReactElement;
|
|
9
|
+
export {};
|