@webx-ui/core 0.23.0 → 0.24.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/components/RichText/RichText.d.ts +6 -4
- package/dist/components/RichText/tools.d.ts +7 -35
- package/dist/components/RichText/types.d.ts +40 -6
- package/dist/index.js +4499 -4462
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RichTextProps, RichTextTool } from './types';
|
|
1
|
+
import { RichTextLabels, RichTextModelValue, RichTextProps, RichTextTool } from './types';
|
|
2
2
|
type __VLS_Props = RichTextProps;
|
|
3
3
|
type __VLS_PublicProps = {
|
|
4
|
-
modelValue?:
|
|
4
|
+
modelValue?: RichTextModelValue;
|
|
5
5
|
} & __VLS_Props;
|
|
6
6
|
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
7
7
|
editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
|
|
@@ -9,13 +9,13 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
9
9
|
clear: () => boolean | undefined;
|
|
10
10
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
11
|
change: (html: string) => any;
|
|
12
|
-
"update:modelValue": (value:
|
|
12
|
+
"update:modelValue": (value: RichTextModelValue) => any;
|
|
13
13
|
blur: () => any;
|
|
14
14
|
focus: () => any;
|
|
15
15
|
uploadError: (error: unknown, file: File) => any;
|
|
16
16
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
onChange?: ((html: string) => any) | undefined;
|
|
18
|
-
"onUpdate:modelValue"?: ((value:
|
|
18
|
+
"onUpdate:modelValue"?: ((value: RichTextModelValue) => any) | undefined;
|
|
19
19
|
onBlur?: (() => any) | undefined;
|
|
20
20
|
onFocus?: (() => any) | undefined;
|
|
21
21
|
onUploadError?: ((error: unknown, file: File) => any) | undefined;
|
|
@@ -29,9 +29,11 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
29
29
|
id: string;
|
|
30
30
|
readonly: boolean;
|
|
31
31
|
minHeight: string;
|
|
32
|
+
localized: boolean;
|
|
32
33
|
tools: RichTextTool[];
|
|
33
34
|
pickImage: import('./types').RichTextImagePicker;
|
|
34
35
|
accept: string[];
|
|
36
|
+
labels: RichTextLabels;
|
|
35
37
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
36
38
|
fileInput: HTMLInputElement;
|
|
37
39
|
}, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichTextTool } from './types';
|
|
1
|
+
import { RichTextTableTool, RichTextTool } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Kept out of the component because `withDefaults` cannot reference a binding
|
|
4
4
|
* declared inside `<script setup>` — it is hoisted out of `setup()`.
|
|
@@ -12,37 +12,9 @@ export interface ToolMeta {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const TOOL_META: Record<Exclude<RichTextTool, 'divider'>, ToolMeta>;
|
|
14
14
|
/** Shown as a second row while the caret sits inside a table. */
|
|
15
|
-
export declare const TABLE_TOOLS:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
readonly label: "Row above";
|
|
22
|
-
readonly icon: "rowBefore";
|
|
23
|
-
}, {
|
|
24
|
-
readonly key: "addColumnAfter";
|
|
25
|
-
readonly label: "Column after";
|
|
26
|
-
readonly icon: "columnAfter";
|
|
27
|
-
}, {
|
|
28
|
-
readonly key: "addColumnBefore";
|
|
29
|
-
readonly label: "Column before";
|
|
30
|
-
readonly icon: "columnBefore";
|
|
31
|
-
}, {
|
|
32
|
-
readonly key: "deleteRow";
|
|
33
|
-
readonly label: "Delete row";
|
|
34
|
-
readonly icon: "deleteRow";
|
|
35
|
-
}, {
|
|
36
|
-
readonly key: "deleteColumn";
|
|
37
|
-
readonly label: "Delete column";
|
|
38
|
-
readonly icon: "deleteColumn";
|
|
39
|
-
}, {
|
|
40
|
-
readonly key: "mergeOrSplit";
|
|
41
|
-
readonly label: "Merge or split cells";
|
|
42
|
-
readonly icon: "mergeCells";
|
|
43
|
-
}, {
|
|
44
|
-
readonly key: "deleteTable";
|
|
45
|
-
readonly label: "Delete table";
|
|
46
|
-
readonly icon: "deleteTable";
|
|
47
|
-
}];
|
|
48
|
-
export type TableToolKey = (typeof TABLE_TOOLS)[number]['key'];
|
|
15
|
+
export declare const TABLE_TOOLS: {
|
|
16
|
+
key: RichTextTableTool;
|
|
17
|
+
label: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
}[];
|
|
20
|
+
export type TableToolKey = RichTextTableTool;
|
|
@@ -1,16 +1,48 @@
|
|
|
1
1
|
import { ControlSize, ControlStatus } from '../../composables/useFormField';
|
|
2
|
+
import { LocalizedFieldProps, LocalizedValue } from '../../composables/useLocalized';
|
|
2
3
|
export type RichTextTool = 'bold' | 'italic' | 'strike' | 'code' | 'h2' | 'h3' | 'h4' | 'bulletList' | 'orderedList' | 'blockquote' | 'hr' | 'link' | 'table' | 'image' | 'youtube' | 'undo' | 'redo'
|
|
3
4
|
/** A vertical rule between groups. */
|
|
4
5
|
| 'divider';
|
|
5
|
-
|
|
6
|
+
/** The keys of the second toolbar, the one that appears inside a table. */
|
|
7
|
+
export type RichTextTableTool = 'addRowAfter' | 'addRowBefore' | 'addColumnAfter' | 'addColumnBefore' | 'deleteRow' | 'deleteColumn' | 'mergeOrSplit' | 'deleteTable';
|
|
8
|
+
/**
|
|
9
|
+
* Everything this editor says out loud: a tooltip on every button, the two lines of the link
|
|
10
|
+
* bar, and the word shown while a file is going up.
|
|
11
|
+
*/
|
|
12
|
+
export type RichTextLabelKey = Exclude<RichTextTool, 'divider'> | RichTextTableTool
|
|
13
|
+
/** The accessible name of the toolbar itself. */
|
|
14
|
+
| 'toolbar' | 'linkAddress' | 'youtubeAddress' | 'apply' | 'cancel' | 'uploading';
|
|
15
|
+
/**
|
|
16
|
+
* What the editor calls its own buttons. It knows nothing about the panel it is opened in, so
|
|
17
|
+
* whoever opens it translates it; a key left out stays English.
|
|
18
|
+
*/
|
|
19
|
+
export type RichTextLabels = Partial<Record<RichTextLabelKey, string>>;
|
|
20
|
+
/**
|
|
21
|
+
* A picture going into the document: where it is right now, and what it is filed under.
|
|
22
|
+
*
|
|
23
|
+
* `path` is the library's own key, written into the document as `data-wx-path` and kept there.
|
|
24
|
+
* The address is not the picture — a bucket that moves, a signed link that expires, an image
|
|
25
|
+
* edited in place all change the URL and none of them change the key — so whoever stores the
|
|
26
|
+
* document can work the address out again from the key rather than serving last month's.
|
|
27
|
+
* Without a `path` the picture is simply an address, which is what an external one is.
|
|
28
|
+
*/
|
|
29
|
+
export interface RichTextImage {
|
|
6
30
|
url: string;
|
|
31
|
+
path?: string;
|
|
7
32
|
alt?: string;
|
|
8
33
|
}
|
|
9
|
-
/**
|
|
10
|
-
export type
|
|
11
|
-
/**
|
|
12
|
-
export type
|
|
13
|
-
|
|
34
|
+
/** What an upload answers with. */
|
|
35
|
+
export type RichTextUploadResult = RichTextImage;
|
|
36
|
+
/** Uploads one file and resolves with where it ended up. */
|
|
37
|
+
export type RichTextUpload = (file: File) => Promise<RichTextImage>;
|
|
38
|
+
/**
|
|
39
|
+
* Opens a media library and resolves with what was chosen, or `null` if cancelled. A bare
|
|
40
|
+
* string is an address and nothing else — fine for a picker with no library behind it.
|
|
41
|
+
*/
|
|
42
|
+
export type RichTextImagePicker = () => Promise<RichTextImage | string | null>;
|
|
43
|
+
/** One language's HTML, or every language's when the field is localized. */
|
|
44
|
+
export type RichTextModelValue = string | LocalizedValue;
|
|
45
|
+
export interface RichTextProps extends LocalizedFieldProps {
|
|
14
46
|
placeholder?: string;
|
|
15
47
|
disabled?: boolean;
|
|
16
48
|
readonly?: boolean;
|
|
@@ -32,6 +64,8 @@ export interface RichTextProps {
|
|
|
32
64
|
pickImage?: RichTextImagePicker;
|
|
33
65
|
/** MIME types accepted for upload. */
|
|
34
66
|
accept?: string[];
|
|
67
|
+
/** What the buttons and the link bar are called, for a panel that is not in English. */
|
|
68
|
+
labels?: RichTextLabels;
|
|
35
69
|
}
|
|
36
70
|
export interface RichTextEmits {
|
|
37
71
|
change: [html: string];
|