@valbuild/ui 0.13.3 → 0.13.4
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/valbuild-ui.cjs.js
CHANGED
|
@@ -49193,25 +49193,25 @@ function toLexicalNode(node) {
|
|
|
49193
49193
|
}
|
|
49194
49194
|
function toLexicalHeadingNode(heading) {
|
|
49195
49195
|
const node = LexicalRichText_1.$createHeadingNode(heading.tag);
|
|
49196
|
-
node.setFormat(heading.format);
|
|
49197
|
-
node.setIndent(heading.indent);
|
|
49198
|
-
node.setDirection(heading.direction);
|
|
49196
|
+
node.setFormat(heading.format || "");
|
|
49197
|
+
node.setIndent(heading.indent || 0);
|
|
49198
|
+
node.setDirection(heading.direction || "ltr");
|
|
49199
49199
|
node.append(...heading.children.map((child) => toLexicalNode(child)));
|
|
49200
49200
|
return node;
|
|
49201
49201
|
}
|
|
49202
49202
|
function toLexicalParagraphNode(paragraph) {
|
|
49203
49203
|
const node = Lexical_1.$createParagraphNode();
|
|
49204
|
-
node.setFormat(paragraph.format);
|
|
49205
|
-
node.setIndent(paragraph.indent);
|
|
49206
|
-
node.setDirection(paragraph.direction);
|
|
49204
|
+
node.setFormat(paragraph.format || "");
|
|
49205
|
+
node.setIndent(paragraph.indent || 0);
|
|
49206
|
+
node.setDirection(paragraph.direction || "ltr");
|
|
49207
49207
|
node.append(...paragraph.children.map((child) => toLexicalNode(child)));
|
|
49208
49208
|
return node;
|
|
49209
49209
|
}
|
|
49210
49210
|
function toLexicalListItemNode(listItem) {
|
|
49211
49211
|
const node = LexicalList_1.$createListItemNode();
|
|
49212
|
-
node.setFormat(listItem.format);
|
|
49213
|
-
node.setIndent(listItem.indent);
|
|
49214
|
-
node.setDirection(listItem.direction);
|
|
49212
|
+
node.setFormat(listItem.format || "");
|
|
49213
|
+
node.setIndent(listItem.indent || 0);
|
|
49214
|
+
node.setDirection(listItem.direction || "ltr");
|
|
49215
49215
|
node.setValue(listItem.value);
|
|
49216
49216
|
node.setChecked(listItem.checked);
|
|
49217
49217
|
node.append(...listItem.children.map((child) => toLexicalNode(child)));
|
|
@@ -49219,9 +49219,9 @@ function toLexicalListItemNode(listItem) {
|
|
|
49219
49219
|
}
|
|
49220
49220
|
function toLexicalListNode(list) {
|
|
49221
49221
|
const node = LexicalList_1.$createListNode(list.listType, list.start);
|
|
49222
|
-
node.setFormat(list.format);
|
|
49223
|
-
node.setIndent(list.indent);
|
|
49224
|
-
node.setDirection(list.direction);
|
|
49222
|
+
node.setFormat(list.format || "");
|
|
49223
|
+
node.setIndent(list.indent || 0);
|
|
49224
|
+
node.setDirection(list.direction || "ltr");
|
|
49225
49225
|
node.append(...list.children.map((child) => toLexicalNode(child)));
|
|
49226
49226
|
return node;
|
|
49227
49227
|
}
|
|
@@ -49230,8 +49230,8 @@ function toLexicalTextNode(text) {
|
|
|
49230
49230
|
node.setFormat(text.format);
|
|
49231
49231
|
text.indent && node.setIndent(text.indent);
|
|
49232
49232
|
text.direction && node.setDirection(text.direction);
|
|
49233
|
-
node.setStyle(text.style);
|
|
49234
|
-
node.setDetail(text.detail);
|
|
49233
|
+
node.setStyle(text.style || "");
|
|
49234
|
+
node.setDetail(text.detail || 0);
|
|
49235
49235
|
return node;
|
|
49236
49236
|
}
|
|
49237
49237
|
const RichTextEditor = ({
|
package/dist/valbuild-ui.esm.js
CHANGED
|
@@ -49191,25 +49191,25 @@ function toLexicalNode(node) {
|
|
|
49191
49191
|
}
|
|
49192
49192
|
function toLexicalHeadingNode(heading) {
|
|
49193
49193
|
const node = LexicalRichText_1.$createHeadingNode(heading.tag);
|
|
49194
|
-
node.setFormat(heading.format);
|
|
49195
|
-
node.setIndent(heading.indent);
|
|
49196
|
-
node.setDirection(heading.direction);
|
|
49194
|
+
node.setFormat(heading.format || "");
|
|
49195
|
+
node.setIndent(heading.indent || 0);
|
|
49196
|
+
node.setDirection(heading.direction || "ltr");
|
|
49197
49197
|
node.append(...heading.children.map((child) => toLexicalNode(child)));
|
|
49198
49198
|
return node;
|
|
49199
49199
|
}
|
|
49200
49200
|
function toLexicalParagraphNode(paragraph) {
|
|
49201
49201
|
const node = Lexical_1.$createParagraphNode();
|
|
49202
|
-
node.setFormat(paragraph.format);
|
|
49203
|
-
node.setIndent(paragraph.indent);
|
|
49204
|
-
node.setDirection(paragraph.direction);
|
|
49202
|
+
node.setFormat(paragraph.format || "");
|
|
49203
|
+
node.setIndent(paragraph.indent || 0);
|
|
49204
|
+
node.setDirection(paragraph.direction || "ltr");
|
|
49205
49205
|
node.append(...paragraph.children.map((child) => toLexicalNode(child)));
|
|
49206
49206
|
return node;
|
|
49207
49207
|
}
|
|
49208
49208
|
function toLexicalListItemNode(listItem) {
|
|
49209
49209
|
const node = LexicalList_1.$createListItemNode();
|
|
49210
|
-
node.setFormat(listItem.format);
|
|
49211
|
-
node.setIndent(listItem.indent);
|
|
49212
|
-
node.setDirection(listItem.direction);
|
|
49210
|
+
node.setFormat(listItem.format || "");
|
|
49211
|
+
node.setIndent(listItem.indent || 0);
|
|
49212
|
+
node.setDirection(listItem.direction || "ltr");
|
|
49213
49213
|
node.setValue(listItem.value);
|
|
49214
49214
|
node.setChecked(listItem.checked);
|
|
49215
49215
|
node.append(...listItem.children.map((child) => toLexicalNode(child)));
|
|
@@ -49217,9 +49217,9 @@ function toLexicalListItemNode(listItem) {
|
|
|
49217
49217
|
}
|
|
49218
49218
|
function toLexicalListNode(list) {
|
|
49219
49219
|
const node = LexicalList_1.$createListNode(list.listType, list.start);
|
|
49220
|
-
node.setFormat(list.format);
|
|
49221
|
-
node.setIndent(list.indent);
|
|
49222
|
-
node.setDirection(list.direction);
|
|
49220
|
+
node.setFormat(list.format || "");
|
|
49221
|
+
node.setIndent(list.indent || 0);
|
|
49222
|
+
node.setDirection(list.direction || "ltr");
|
|
49223
49223
|
node.append(...list.children.map((child) => toLexicalNode(child)));
|
|
49224
49224
|
return node;
|
|
49225
49225
|
}
|
|
@@ -49228,8 +49228,8 @@ function toLexicalTextNode(text) {
|
|
|
49228
49228
|
node.setFormat(text.format);
|
|
49229
49229
|
text.indent && node.setIndent(text.indent);
|
|
49230
49230
|
text.direction && node.setDirection(text.direction);
|
|
49231
|
-
node.setStyle(text.style);
|
|
49232
|
-
node.setDetail(text.detail);
|
|
49231
|
+
node.setStyle(text.style || "");
|
|
49232
|
+
node.setDetail(text.detail || 0);
|
|
49233
49233
|
return node;
|
|
49234
49234
|
}
|
|
49235
49235
|
const RichTextEditor = ({
|
package/package.json
CHANGED
|
@@ -65,27 +65,27 @@ function toLexicalNode(node: ValNode): LexicalNode {
|
|
|
65
65
|
|
|
66
66
|
function toLexicalHeadingNode(heading: ValHeadingNode): LexicalNode {
|
|
67
67
|
const node = $createHeadingNode(heading.tag);
|
|
68
|
-
node.setFormat(heading.format);
|
|
69
|
-
node.setIndent(heading.indent);
|
|
70
|
-
node.setDirection(heading.direction);
|
|
68
|
+
node.setFormat(heading.format || "");
|
|
69
|
+
node.setIndent(heading.indent || 0);
|
|
70
|
+
node.setDirection(heading.direction || "ltr");
|
|
71
71
|
node.append(...heading.children.map((child) => toLexicalNode(child)));
|
|
72
72
|
return node;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function toLexicalParagraphNode(paragraph: ValParagraphNode): LexicalNode {
|
|
76
76
|
const node = $createParagraphNode();
|
|
77
|
-
node.setFormat(paragraph.format);
|
|
78
|
-
node.setIndent(paragraph.indent);
|
|
79
|
-
node.setDirection(paragraph.direction);
|
|
77
|
+
node.setFormat(paragraph.format || "");
|
|
78
|
+
node.setIndent(paragraph.indent || 0);
|
|
79
|
+
node.setDirection(paragraph.direction || "ltr");
|
|
80
80
|
node.append(...paragraph.children.map((child) => toLexicalNode(child)));
|
|
81
81
|
return node;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function toLexicalListItemNode(listItem: ValListItemNode): LexicalNode {
|
|
85
85
|
const node = $createListItemNode();
|
|
86
|
-
node.setFormat(listItem.format);
|
|
87
|
-
node.setIndent(listItem.indent);
|
|
88
|
-
node.setDirection(listItem.direction);
|
|
86
|
+
node.setFormat(listItem.format || "");
|
|
87
|
+
node.setIndent(listItem.indent || 0);
|
|
88
|
+
node.setDirection(listItem.direction || "ltr");
|
|
89
89
|
node.setValue(listItem.value);
|
|
90
90
|
node.setChecked(listItem.checked);
|
|
91
91
|
node.append(...listItem.children.map((child) => toLexicalNode(child)));
|
|
@@ -94,9 +94,9 @@ function toLexicalListItemNode(listItem: ValListItemNode): LexicalNode {
|
|
|
94
94
|
|
|
95
95
|
function toLexicalListNode(list: ValListNode): LexicalNode {
|
|
96
96
|
const node = $createListNode(list.listType, list.start);
|
|
97
|
-
node.setFormat(list.format);
|
|
98
|
-
node.setIndent(list.indent);
|
|
99
|
-
node.setDirection(list.direction);
|
|
97
|
+
node.setFormat(list.format || "");
|
|
98
|
+
node.setIndent(list.indent || 0);
|
|
99
|
+
node.setDirection(list.direction || "ltr");
|
|
100
100
|
node.append(...list.children.map((child) => toLexicalNode(child)));
|
|
101
101
|
return node;
|
|
102
102
|
}
|
|
@@ -106,8 +106,8 @@ function toLexicalTextNode(text: ValTextNode): LexicalNode {
|
|
|
106
106
|
node.setFormat(text.format as any); // TODO: why is text.format numbers when we are trying it out?
|
|
107
107
|
text.indent && node.setIndent(text.indent);
|
|
108
108
|
text.direction && node.setDirection(text.direction);
|
|
109
|
-
node.setStyle(text.style);
|
|
110
|
-
node.setDetail(text.detail);
|
|
109
|
+
node.setStyle(text.style || "");
|
|
110
|
+
node.setDetail(text.detail || 0);
|
|
111
111
|
return node;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { RichText as RichTextType, SourcePath } from "@valbuild/core";
|
|
2
3
|
import { RichTextEditor } from "../exports";
|
|
3
4
|
import { FormContainer } from "./forms/FormContainer";
|
|
4
5
|
import { ImageForm } from "./forms/ImageForm";
|
|
@@ -72,34 +73,37 @@ export const RichText: Story = {
|
|
|
72
73
|
}}
|
|
73
74
|
>
|
|
74
75
|
<RichTextEditor
|
|
75
|
-
richtext={
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
76
|
+
richtext={
|
|
77
|
+
{
|
|
78
|
+
valPath: "/foo" as SourcePath,
|
|
79
|
+
children: [
|
|
80
|
+
{
|
|
81
|
+
children: [
|
|
82
|
+
{
|
|
83
|
+
detail: 0,
|
|
84
|
+
format: 0,
|
|
85
|
+
mode: "normal",
|
|
86
|
+
style: "",
|
|
87
|
+
text: "Heading 1",
|
|
88
|
+
type: "text",
|
|
89
|
+
version: 1,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
direction: "ltr",
|
|
93
|
+
format: "",
|
|
94
|
+
indent: 0,
|
|
95
|
+
type: "heading",
|
|
96
|
+
version: 1,
|
|
97
|
+
tag: "h1",
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
direction: "ltr",
|
|
101
|
+
format: "",
|
|
102
|
+
indent: 0,
|
|
103
|
+
type: "root",
|
|
104
|
+
version: 1,
|
|
105
|
+
} as RichTextType
|
|
106
|
+
}
|
|
103
107
|
/>
|
|
104
108
|
</FormContainer>
|
|
105
109
|
),
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
RichTextEditorProps,
|
|
4
4
|
} from "../components/RichTextEditor/RichTextEditor";
|
|
5
5
|
import { Meta, Story } from "@storybook/react";
|
|
6
|
+
import { RichText, SourcePath } from "@valbuild/core";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "RichTextEditor",
|
|
@@ -17,6 +18,7 @@ export const DropdownStory = Template.bind({});
|
|
|
17
18
|
|
|
18
19
|
DropdownStory.args = {
|
|
19
20
|
richtext: {
|
|
21
|
+
valPath: "/test" as SourcePath,
|
|
20
22
|
children: [
|
|
21
23
|
{
|
|
22
24
|
children: [
|
|
@@ -310,5 +312,5 @@ DropdownStory.args = {
|
|
|
310
312
|
indent: 0,
|
|
311
313
|
type: "root",
|
|
312
314
|
version: 1,
|
|
313
|
-
},
|
|
315
|
+
} as RichText,
|
|
314
316
|
};
|