@yurikilian/lex4 0.2.1 → 0.3.1
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/README.md +2 -3
- package/dist/components/DocumentView.d.ts.map +1 -1
- package/dist/components/HeaderFooterActions.d.ts.map +1 -1
- package/dist/components/HeaderFooterToggle.d.ts.map +1 -1
- package/dist/components/PageBody.d.ts.map +1 -1
- package/dist/components/PageFooter.d.ts.map +1 -1
- package/dist/components/PageHeader.d.ts.map +1 -1
- package/dist/components/PageView.d.ts.map +1 -1
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/context/document-provider.d.ts.map +1 -1
- package/dist/engine/overflow.d.ts +2 -0
- package/dist/engine/overflow.d.ts.map +1 -1
- package/dist/hooks/use-pagination.d.ts.map +1 -1
- package/dist/i18n/defaults.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/pt-BR.d.ts +3 -0
- package/dist/i18n/pt-BR.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +42 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lex4-editor.cjs +1025 -444
- package/dist/lex4-editor.cjs.map +1 -1
- package/dist/lex4-editor.js +1028 -447
- package/dist/lex4-editor.js.map +1 -1
- package/dist/lexical/plugins/font-plugin.d.ts +1 -1
- package/dist/lexical/plugins/history-capture-plugin.d.ts.map +1 -1
- package/dist/lexical/plugins/overflow-plugin.d.ts.map +1 -1
- package/dist/lexical/utils/mid-block-split.d.ts +34 -0
- package/dist/lexical/utils/mid-block-split.d.ts.map +1 -0
- package/dist/style.css +49 -28
- package/dist/utils/editor-state-utils.d.ts +10 -0
- package/dist/utils/editor-state-utils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { LexicalEditor } from 'lexical';
|
|
3
|
-
declare const SUPPORTED_FONTS: readonly ["Inter", "Times New Roman", "Arial", "
|
|
3
|
+
declare const SUPPORTED_FONTS: readonly ["Calibri", "Inter", "Times New Roman", "Arial", "Georgia", "Courier New"];
|
|
4
4
|
export type FontFamily = (typeof SUPPORTED_FONTS)[number];
|
|
5
5
|
export { SUPPORTED_FONTS };
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-capture-plugin.d.ts","sourceRoot":"","sources":["../../../src/lexical/plugins/history-capture-plugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"history-capture-plugin.d.ts","sourceRoot":"","sources":["../../../src/lexical/plugins/history-capture-plugin.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAA2B,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElF,UAAU,yBAAyB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAsLpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overflow-plugin.d.ts","sourceRoot":"","sources":["../../../src/lexical/plugins/overflow-plugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,qBAAqB,EAE3B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"overflow-plugin.d.ts","sourceRoot":"","sources":["../../../src/lexical/plugins/overflow-plugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,qBAAqB,EAE3B,MAAM,SAAS,CAAC;AAkBjB,UAAU,mBAAmB;IAC3B,gFAAgF;IAChF,UAAU,EAAE,CACV,eAAe,EAAE,qBAAqB,EACtC,KAAK,EAAE,OAAO,GAAG,SAAS,KACvB,IAAI,CAAC;CACX;AAKD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+PxD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SerializedLexicalNode } from 'lexical';
|
|
2
|
+
/**
|
|
3
|
+
* Result of finding a split point inside a block element.
|
|
4
|
+
*/
|
|
5
|
+
interface DomSplitPoint {
|
|
6
|
+
/** The DOM Text node containing the split offset */
|
|
7
|
+
textNode: Text;
|
|
8
|
+
/** Character offset within the text node */
|
|
9
|
+
offset: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Finds the character position inside a block element where content
|
|
13
|
+
* crosses the available height boundary.
|
|
14
|
+
*
|
|
15
|
+
* Uses a binary search with Range.getBoundingClientRect() for efficiency.
|
|
16
|
+
* Returns the offset backed up to the nearest word boundary.
|
|
17
|
+
*
|
|
18
|
+
* @returns The DOM text node and offset, or null if no valid split found
|
|
19
|
+
*/
|
|
20
|
+
export declare function findMidBlockSplitPoint(blockElement: HTMLElement, availableHeight: number): DomSplitPoint | null;
|
|
21
|
+
/**
|
|
22
|
+
* Performs a mid-block split on the first overflowing block in the editor.
|
|
23
|
+
*
|
|
24
|
+
* Handles two cases:
|
|
25
|
+
* 1. Paragraph/Heading: splits at a text offset using Range measurement
|
|
26
|
+
* 2. List: splits at a ListItem boundary
|
|
27
|
+
*
|
|
28
|
+
* Must be called inside an editor.update() context.
|
|
29
|
+
*
|
|
30
|
+
* @returns Serialized overflow nodes, or null if split wasn't possible
|
|
31
|
+
*/
|
|
32
|
+
export declare function performMidBlockSplit(rootElement: HTMLElement, availableHeight: number, overflowBlockIndex: number): SerializedLexicalNode[] | null;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=mid-block-split.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mid-block-split.d.ts","sourceRoot":"","sources":["../../../src/lexical/utils/mid-block-split.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,qBAAqB,EAE3B,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,UAAU,aAAa;IACrB,oDAAoD;IACpD,QAAQ,EAAE,IAAI,CAAC;IACf,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,WAAW,EACzB,eAAe,EAAE,MAAM,GACtB,aAAa,GAAG,IAAI,CAuDtB;AAwED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,MAAM,GACzB,qBAAqB,EAAE,GAAG,IAAI,CAiChC"}
|
package/dist/style.css
CHANGED
|
@@ -645,6 +645,11 @@ video {
|
|
|
645
645
|
margin-right: 0.125rem;
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
+
.my-1{
|
|
649
|
+
margin-top: 0.25rem;
|
|
650
|
+
margin-bottom: 0.25rem;
|
|
651
|
+
}
|
|
652
|
+
|
|
648
653
|
.mb-1{
|
|
649
654
|
margin-bottom: 0.25rem;
|
|
650
655
|
}
|
|
@@ -693,6 +698,10 @@ video {
|
|
|
693
698
|
display: inline-flex;
|
|
694
699
|
}
|
|
695
700
|
|
|
701
|
+
.grid{
|
|
702
|
+
display: grid;
|
|
703
|
+
}
|
|
704
|
+
|
|
696
705
|
.list-item{
|
|
697
706
|
display: list-item;
|
|
698
707
|
}
|
|
@@ -729,6 +738,10 @@ video {
|
|
|
729
738
|
height: 100%;
|
|
730
739
|
}
|
|
731
740
|
|
|
741
|
+
.h-px{
|
|
742
|
+
height: 1px;
|
|
743
|
+
}
|
|
744
|
+
|
|
732
745
|
.max-h-48{
|
|
733
746
|
max-height: 12rem;
|
|
734
747
|
}
|
|
@@ -757,6 +770,10 @@ video {
|
|
|
757
770
|
width: 0.75rem;
|
|
758
771
|
}
|
|
759
772
|
|
|
773
|
+
.w-56{
|
|
774
|
+
width: 14rem;
|
|
775
|
+
}
|
|
776
|
+
|
|
760
777
|
.w-6{
|
|
761
778
|
width: 1.5rem;
|
|
762
779
|
}
|
|
@@ -842,12 +859,12 @@ video {
|
|
|
842
859
|
list-style-type: none;
|
|
843
860
|
}
|
|
844
861
|
|
|
845
|
-
.
|
|
846
|
-
|
|
862
|
+
.grid-cols-2{
|
|
863
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
847
864
|
}
|
|
848
865
|
|
|
849
|
-
.flex-
|
|
850
|
-
flex-
|
|
866
|
+
.flex-col{
|
|
867
|
+
flex-direction: column;
|
|
851
868
|
}
|
|
852
869
|
|
|
853
870
|
.items-start{
|
|
@@ -1010,6 +1027,11 @@ video {
|
|
|
1010
1027
|
background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));
|
|
1011
1028
|
}
|
|
1012
1029
|
|
|
1030
|
+
.bg-gray-100{
|
|
1031
|
+
--tw-bg-opacity: 1;
|
|
1032
|
+
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1013
1035
|
.bg-gray-200{
|
|
1014
1036
|
--tw-bg-opacity: 1;
|
|
1015
1037
|
background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
|
|
@@ -1020,20 +1042,11 @@ video {
|
|
|
1020
1042
|
background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1));
|
|
1021
1043
|
}
|
|
1022
1044
|
|
|
1023
|
-
.bg-gray-300\/60{
|
|
1024
|
-
background-color: rgb(209 213 219 / 0.6);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
1045
|
.bg-gray-50{
|
|
1028
1046
|
--tw-bg-opacity: 1;
|
|
1029
1047
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
|
|
1030
1048
|
}
|
|
1031
1049
|
|
|
1032
|
-
.bg-gray-700{
|
|
1033
|
-
--tw-bg-opacity: 1;
|
|
1034
|
-
background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
1050
|
.bg-white{
|
|
1038
1051
|
--tw-bg-opacity: 1;
|
|
1039
1052
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
@@ -1115,6 +1128,14 @@ video {
|
|
|
1115
1128
|
padding-bottom: 2rem;
|
|
1116
1129
|
}
|
|
1117
1130
|
|
|
1131
|
+
.pb-1{
|
|
1132
|
+
padding-bottom: 0.25rem;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.pb-2{
|
|
1136
|
+
padding-bottom: 0.5rem;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1118
1139
|
.pb-3{
|
|
1119
1140
|
padding-bottom: 0.75rem;
|
|
1120
1141
|
}
|
|
@@ -1135,6 +1156,10 @@ video {
|
|
|
1135
1156
|
padding-right: 0.75rem;
|
|
1136
1157
|
}
|
|
1137
1158
|
|
|
1159
|
+
.pt-2{
|
|
1160
|
+
padding-top: 0.5rem;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1138
1163
|
.text-left{
|
|
1139
1164
|
text-align: left;
|
|
1140
1165
|
}
|
|
@@ -1143,6 +1168,10 @@ video {
|
|
|
1143
1168
|
text-align: center;
|
|
1144
1169
|
}
|
|
1145
1170
|
|
|
1171
|
+
.text-justify{
|
|
1172
|
+
text-align: justify;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1146
1175
|
.text-2xl{
|
|
1147
1176
|
font-size: 1.5rem;
|
|
1148
1177
|
line-height: 2rem;
|
|
@@ -1171,11 +1200,6 @@ video {
|
|
|
1171
1200
|
line-height: 1.75rem;
|
|
1172
1201
|
}
|
|
1173
1202
|
|
|
1174
|
-
.text-sm{
|
|
1175
|
-
font-size: 0.875rem;
|
|
1176
|
-
line-height: 1.25rem;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
1203
|
.text-xl{
|
|
1180
1204
|
font-size: 1.25rem;
|
|
1181
1205
|
line-height: 1.75rem;
|
|
@@ -1325,7 +1349,13 @@ video {
|
|
|
1325
1349
|
}
|
|
1326
1350
|
|
|
1327
1351
|
.lex4-editor {
|
|
1328
|
-
font-family: '
|
|
1352
|
+
font-family: 'Calibri', 'Carlito', sans-serif;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
.lex4-page,
|
|
1356
|
+
.lex4-page [contenteditable],
|
|
1357
|
+
.lex4-page .pointer-events-none {
|
|
1358
|
+
font-family: inherit;
|
|
1329
1359
|
}
|
|
1330
1360
|
|
|
1331
1361
|
.lex4-editor[data-global-selection-active="true"] [data-testid^="page-body-"] [contenteditable="true"] {
|
|
@@ -1363,10 +1393,6 @@ video {
|
|
|
1363
1393
|
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
|
|
1364
1394
|
}
|
|
1365
1395
|
|
|
1366
|
-
.hover\:bg-gray-200\/60:hover{
|
|
1367
|
-
background-color: rgb(229 231 235 / 0.6);
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
1396
|
.hover\:bg-gray-50:hover{
|
|
1371
1397
|
--tw-bg-opacity: 1;
|
|
1372
1398
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
|
|
@@ -1377,11 +1403,6 @@ video {
|
|
|
1377
1403
|
color: rgb(75 85 99 / var(--tw-text-opacity, 1));
|
|
1378
1404
|
}
|
|
1379
1405
|
|
|
1380
|
-
.hover\:text-gray-700:hover{
|
|
1381
|
-
--tw-text-opacity: 1;
|
|
1382
|
-
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
1406
|
.hover\:text-gray-900:hover{
|
|
1386
1407
|
--tw-text-opacity: 1;
|
|
1387
1408
|
color: rgb(17 24 39 / var(--tw-text-opacity, 1));
|
|
@@ -35,6 +35,16 @@ export declare function mergeEditorStates(stateA: SerializedEditorState | null,
|
|
|
35
35
|
* Append nodes to the end of a serialized editor state.
|
|
36
36
|
*/
|
|
37
37
|
export declare function appendNodes(state: SerializedEditorState | null, nodes: SerializedLexicalNode[]): SerializedEditorState;
|
|
38
|
+
/**
|
|
39
|
+
* Split a serialized block node's children at a given child offset.
|
|
40
|
+
*
|
|
41
|
+
* Returns two copies of the block: the first has children [0, offset),
|
|
42
|
+
* the second has children [offset, end). Both keep the same node type,
|
|
43
|
+
* format, direction, indent, and version.
|
|
44
|
+
*
|
|
45
|
+
* Returns null pair if the offset is out of range.
|
|
46
|
+
*/
|
|
47
|
+
export declare function splitBlockNode(block: SerializedLexicalNode, childOffset: number): [SerializedLexicalNode | null, SerializedLexicalNode | null];
|
|
38
48
|
/**
|
|
39
49
|
* Remove the last N nodes from a serialized editor state.
|
|
40
50
|
* Returns [trimmedState, removedNodes].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-state-utils.d.ts","sourceRoot":"","sources":["../../src/utils/editor-state-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;GASG;AAEH,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,GAAG,qBAAqB,EAAE,CAG7F;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,GAAG,MAAM,CAE9E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,qBAAqB,EAAE,GAC7B,qBAAqB,CAWvB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,GAAG,IAAI,EACnC,UAAU,EAAE,MAAM,GACjB,CAAC,qBAAqB,GAAG,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAAC,CAiB9D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,qBAAqB,GAAG,IAAI,EACpC,MAAM,EAAE,qBAAqB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