@uniformdev/canvas-react 20.74.6-alpha.6 → 20.74.6-alpha.7.sha-23d7a1d929
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/{PureUniformText-CzdaUBnC.d.mts → PureUniformText-BFhXK0lt.d.mts} +4 -4
- package/dist/{PureUniformText-CzdaUBnC.d.ts → PureUniformText-BFhXK0lt.d.ts} +4 -4
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.esm.js +19 -4
- package/dist/index.js +33 -18
- package/dist/index.mjs +19 -4
- package/package.json +6 -6
|
@@ -5,7 +5,7 @@ type ParameterTextValue = string | undefined;
|
|
|
5
5
|
type PureUniformTextProps = {
|
|
6
6
|
/**
|
|
7
7
|
* The name of the HTML tag to render.
|
|
8
|
-
* @
|
|
8
|
+
* @defaultValue "span"
|
|
9
9
|
*/
|
|
10
10
|
as?: React.ElementType;
|
|
11
11
|
/** The ID of the parameter. */
|
|
@@ -16,20 +16,20 @@ type PureUniformTextProps = {
|
|
|
16
16
|
isContextualEditing: boolean;
|
|
17
17
|
/**
|
|
18
18
|
* When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
|
|
19
|
-
* @
|
|
19
|
+
* @defaultValue false
|
|
20
20
|
*/
|
|
21
21
|
isMultiline?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
24
24
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
25
|
-
* @
|
|
25
|
+
* @defaultValue undefined
|
|
26
26
|
*/
|
|
27
27
|
placeholder?: string | ((parameter: {
|
|
28
28
|
id: string;
|
|
29
29
|
}) => string | undefined);
|
|
30
30
|
/**
|
|
31
31
|
* A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
|
|
32
|
-
* @
|
|
32
|
+
* @defaultValue "(value) => value"
|
|
33
33
|
*/
|
|
34
34
|
render?: (value: ParameterTextValue) => React.ReactNode;
|
|
35
35
|
} & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
|
|
@@ -5,7 +5,7 @@ type ParameterTextValue = string | undefined;
|
|
|
5
5
|
type PureUniformTextProps = {
|
|
6
6
|
/**
|
|
7
7
|
* The name of the HTML tag to render.
|
|
8
|
-
* @
|
|
8
|
+
* @defaultValue "span"
|
|
9
9
|
*/
|
|
10
10
|
as?: React.ElementType;
|
|
11
11
|
/** The ID of the parameter. */
|
|
@@ -16,20 +16,20 @@ type PureUniformTextProps = {
|
|
|
16
16
|
isContextualEditing: boolean;
|
|
17
17
|
/**
|
|
18
18
|
* When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
|
|
19
|
-
* @
|
|
19
|
+
* @defaultValue false
|
|
20
20
|
*/
|
|
21
21
|
isMultiline?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
24
24
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
25
|
-
* @
|
|
25
|
+
* @defaultValue undefined
|
|
26
26
|
*/
|
|
27
27
|
placeholder?: string | ((parameter: {
|
|
28
28
|
id: string;
|
|
29
29
|
}) => string | undefined);
|
|
30
30
|
/**
|
|
31
31
|
* A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
|
|
32
|
-
* @
|
|
32
|
+
* @defaultValue "(value) => value"
|
|
33
33
|
*/
|
|
34
34
|
render?: (value: ParameterTextValue) => React.ReactNode;
|
|
35
35
|
} & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
|
package/dist/core.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
|
-
export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-
|
|
3
|
+
export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.mjs';
|
|
4
4
|
|
|
5
5
|
type PureContextualEditingComponentWrapperProps = {
|
|
6
6
|
isPlaceholder: boolean | undefined;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
|
-
export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-
|
|
3
|
+
export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.js';
|
|
4
4
|
|
|
5
5
|
type PureContextualEditingComponentWrapperProps = {
|
|
6
6
|
isPlaceholder: boolean | undefined;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
3
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
4
|
-
import { a as PureUniformTextProps } from './PureUniformText-
|
|
4
|
+
import { a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.mjs';
|
|
5
5
|
import { CompositionMetadata } from '@uniformdev/context';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
export { linkParamValueToAnchorProps } from '@uniformdev/richtext';
|
|
@@ -160,6 +160,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
160
160
|
name: string;
|
|
161
161
|
value?: string;
|
|
162
162
|
helpText?: string;
|
|
163
|
+
editorVisibility?: "opt-in";
|
|
163
164
|
optionsSource?: {
|
|
164
165
|
source: "static";
|
|
165
166
|
options: {
|
|
@@ -252,6 +253,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
252
253
|
};
|
|
253
254
|
};
|
|
254
255
|
};
|
|
256
|
+
_patternOptedInQueryStrings?: string[];
|
|
255
257
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
256
258
|
_overrides?: {
|
|
257
259
|
[key: string]: {
|
|
@@ -408,6 +410,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
408
410
|
};
|
|
409
411
|
};
|
|
410
412
|
};
|
|
413
|
+
_patternOptedInQueryStrings?: string[];
|
|
411
414
|
_dataResources?: {
|
|
412
415
|
[key: string]: {
|
|
413
416
|
type: string;
|
|
@@ -541,6 +544,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
541
544
|
};
|
|
542
545
|
};
|
|
543
546
|
};
|
|
547
|
+
_patternOptedInQueryStrings?: string[];
|
|
544
548
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
545
549
|
_overrides?: {
|
|
546
550
|
[key: string]: /*elided*/ any;
|
|
@@ -693,6 +697,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
693
697
|
};
|
|
694
698
|
};
|
|
695
699
|
};
|
|
700
|
+
_patternOptedInQueryStrings?: string[];
|
|
696
701
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
697
702
|
_overrides?: {
|
|
698
703
|
[key: string]: /*elided*/ any;
|
|
@@ -732,6 +737,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
732
737
|
hideLockedParameters?: boolean;
|
|
733
738
|
};
|
|
734
739
|
_locales?: string[];
|
|
740
|
+
_optedInQueryStrings?: string[];
|
|
735
741
|
} | undefined;
|
|
736
742
|
isContextualEditing: boolean;
|
|
737
743
|
};
|
|
@@ -792,7 +798,7 @@ type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererC
|
|
|
792
798
|
type UniformRichTextProps = {
|
|
793
799
|
/**
|
|
794
800
|
* The name of the HTML tag to render.
|
|
795
|
-
* @
|
|
801
|
+
* @defaultValue "div"
|
|
796
802
|
*/
|
|
797
803
|
as?: React$1.ElementType | null;
|
|
798
804
|
/** The ID of the parameter. */
|
|
@@ -805,7 +811,7 @@ type UniformRichTextProps = {
|
|
|
805
811
|
/**
|
|
806
812
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
807
813
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
808
|
-
* @
|
|
814
|
+
* @defaultValue undefined
|
|
809
815
|
*/
|
|
810
816
|
placeholder?: string | ((parameter: {
|
|
811
817
|
id: string;
|
|
@@ -817,7 +823,7 @@ type UniformRichTextProps = {
|
|
|
817
823
|
declare const UniformRichText: React$1.ForwardRefExoticComponent<{
|
|
818
824
|
/**
|
|
819
825
|
* The name of the HTML tag to render.
|
|
820
|
-
* @
|
|
826
|
+
* @defaultValue "div"
|
|
821
827
|
*/
|
|
822
828
|
as?: React$1.ElementType | null;
|
|
823
829
|
/** The ID of the parameter. */
|
|
@@ -830,7 +836,7 @@ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
|
|
|
830
836
|
/**
|
|
831
837
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
832
838
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
833
|
-
* @
|
|
839
|
+
* @defaultValue undefined
|
|
834
840
|
*/
|
|
835
841
|
placeholder?: string | ((parameter: {
|
|
836
842
|
id: string;
|
|
@@ -896,7 +902,7 @@ type UseUniformContextualEditingStateProps = {
|
|
|
896
902
|
/**
|
|
897
903
|
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
898
904
|
* When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
|
|
899
|
-
* @
|
|
905
|
+
* @defaultValue false
|
|
900
906
|
**/
|
|
901
907
|
global?: boolean;
|
|
902
908
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
3
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
4
|
-
import { a as PureUniformTextProps } from './PureUniformText-
|
|
4
|
+
import { a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.js';
|
|
5
5
|
import { CompositionMetadata } from '@uniformdev/context';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
export { linkParamValueToAnchorProps } from '@uniformdev/richtext';
|
|
@@ -160,6 +160,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
160
160
|
name: string;
|
|
161
161
|
value?: string;
|
|
162
162
|
helpText?: string;
|
|
163
|
+
editorVisibility?: "opt-in";
|
|
163
164
|
optionsSource?: {
|
|
164
165
|
source: "static";
|
|
165
166
|
options: {
|
|
@@ -252,6 +253,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
252
253
|
};
|
|
253
254
|
};
|
|
254
255
|
};
|
|
256
|
+
_patternOptedInQueryStrings?: string[];
|
|
255
257
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
256
258
|
_overrides?: {
|
|
257
259
|
[key: string]: {
|
|
@@ -408,6 +410,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
408
410
|
};
|
|
409
411
|
};
|
|
410
412
|
};
|
|
413
|
+
_patternOptedInQueryStrings?: string[];
|
|
411
414
|
_dataResources?: {
|
|
412
415
|
[key: string]: {
|
|
413
416
|
type: string;
|
|
@@ -541,6 +544,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
541
544
|
};
|
|
542
545
|
};
|
|
543
546
|
};
|
|
547
|
+
_patternOptedInQueryStrings?: string[];
|
|
544
548
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
545
549
|
_overrides?: {
|
|
546
550
|
[key: string]: /*elided*/ any;
|
|
@@ -693,6 +697,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
693
697
|
};
|
|
694
698
|
};
|
|
695
699
|
};
|
|
700
|
+
_patternOptedInQueryStrings?: string[];
|
|
696
701
|
_patternError?: "NOTFOUND" | "CYCLIC";
|
|
697
702
|
_overrides?: {
|
|
698
703
|
[key: string]: /*elided*/ any;
|
|
@@ -732,6 +737,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
732
737
|
hideLockedParameters?: boolean;
|
|
733
738
|
};
|
|
734
739
|
_locales?: string[];
|
|
740
|
+
_optedInQueryStrings?: string[];
|
|
735
741
|
} | undefined;
|
|
736
742
|
isContextualEditing: boolean;
|
|
737
743
|
};
|
|
@@ -792,7 +798,7 @@ type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererC
|
|
|
792
798
|
type UniformRichTextProps = {
|
|
793
799
|
/**
|
|
794
800
|
* The name of the HTML tag to render.
|
|
795
|
-
* @
|
|
801
|
+
* @defaultValue "div"
|
|
796
802
|
*/
|
|
797
803
|
as?: React$1.ElementType | null;
|
|
798
804
|
/** The ID of the parameter. */
|
|
@@ -805,7 +811,7 @@ type UniformRichTextProps = {
|
|
|
805
811
|
/**
|
|
806
812
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
807
813
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
808
|
-
* @
|
|
814
|
+
* @defaultValue undefined
|
|
809
815
|
*/
|
|
810
816
|
placeholder?: string | ((parameter: {
|
|
811
817
|
id: string;
|
|
@@ -817,7 +823,7 @@ type UniformRichTextProps = {
|
|
|
817
823
|
declare const UniformRichText: React$1.ForwardRefExoticComponent<{
|
|
818
824
|
/**
|
|
819
825
|
* The name of the HTML tag to render.
|
|
820
|
-
* @
|
|
826
|
+
* @defaultValue "div"
|
|
821
827
|
*/
|
|
822
828
|
as?: React$1.ElementType | null;
|
|
823
829
|
/** The ID of the parameter. */
|
|
@@ -830,7 +836,7 @@ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
|
|
|
830
836
|
/**
|
|
831
837
|
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
832
838
|
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
833
|
-
* @
|
|
839
|
+
* @defaultValue undefined
|
|
834
840
|
*/
|
|
835
841
|
placeholder?: string | ((parameter: {
|
|
836
842
|
id: string;
|
|
@@ -896,7 +902,7 @@ type UseUniformContextualEditingStateProps = {
|
|
|
896
902
|
/**
|
|
897
903
|
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
898
904
|
* When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
|
|
899
|
-
* @
|
|
905
|
+
* @defaultValue false
|
|
900
906
|
**/
|
|
901
907
|
global?: boolean;
|
|
902
908
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -288,8 +288,7 @@ var useUniformContextualEditing = ({
|
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
290
|
function getCanvasInContextEmbedScriptUrl() {
|
|
291
|
-
|
|
292
|
-
return scriptUrl;
|
|
291
|
+
return new URL("/files/canvas-in-context-embed/index.js", window.document.referrer).toString();
|
|
293
292
|
}
|
|
294
293
|
function isInContextEditingMode() {
|
|
295
294
|
if (typeof window === "undefined") {
|
|
@@ -781,18 +780,34 @@ var LinebreakRichTextNode = () => {
|
|
|
781
780
|
};
|
|
782
781
|
|
|
783
782
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
783
|
+
import { getRichTextListItemValue } from "@uniformdev/richtext";
|
|
784
784
|
import React13 from "react";
|
|
785
785
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
786
786
|
const { value } = node;
|
|
787
|
-
|
|
787
|
+
const normalizedValue = getRichTextListItemValue(value);
|
|
788
|
+
return /* @__PURE__ */ React13.createElement(
|
|
789
|
+
"li",
|
|
790
|
+
{
|
|
791
|
+
value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
|
|
792
|
+
},
|
|
793
|
+
children
|
|
794
|
+
);
|
|
788
795
|
};
|
|
789
796
|
|
|
790
797
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
798
|
+
import { getRichTextListStart } from "@uniformdev/richtext";
|
|
791
799
|
import React14 from "react";
|
|
792
800
|
var ListRichTextNode = ({ children, node }) => {
|
|
793
801
|
const { tag, start } = node;
|
|
794
802
|
const ListTag = tag != null ? tag : "ul";
|
|
795
|
-
|
|
803
|
+
const normalizedStart = getRichTextListStart(start);
|
|
804
|
+
return /* @__PURE__ */ React14.createElement(
|
|
805
|
+
ListTag,
|
|
806
|
+
{
|
|
807
|
+
start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
|
|
808
|
+
},
|
|
809
|
+
children
|
|
810
|
+
);
|
|
796
811
|
};
|
|
797
812
|
|
|
798
813
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
package/dist/index.js
CHANGED
|
@@ -318,8 +318,7 @@ var useUniformContextualEditing = ({
|
|
|
318
318
|
};
|
|
319
319
|
};
|
|
320
320
|
function getCanvasInContextEmbedScriptUrl() {
|
|
321
|
-
|
|
322
|
-
return scriptUrl;
|
|
321
|
+
return new URL("/files/canvas-in-context-embed/index.js", window.document.referrer).toString();
|
|
323
322
|
}
|
|
324
323
|
function isInContextEditingMode() {
|
|
325
324
|
if (typeof window === "undefined") {
|
|
@@ -759,11 +758,11 @@ var LinkRichTextNode = ({ children, node }) => {
|
|
|
759
758
|
|
|
760
759
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
761
760
|
var import_canvas11 = require("@uniformdev/canvas");
|
|
762
|
-
var
|
|
761
|
+
var import_richtext8 = require("@uniformdev/richtext");
|
|
763
762
|
var import_react22 = __toESM(require("react"));
|
|
764
763
|
|
|
765
764
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
766
|
-
var
|
|
765
|
+
var import_richtext7 = require("@uniformdev/richtext");
|
|
767
766
|
var import_react21 = __toESM(require("react"));
|
|
768
767
|
|
|
769
768
|
// src/components/UniformRichText/nodes/AssetRichTextNode.tsx
|
|
@@ -801,41 +800,57 @@ var LinebreakRichTextNode = () => {
|
|
|
801
800
|
};
|
|
802
801
|
|
|
803
802
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
803
|
+
var import_richtext2 = require("@uniformdev/richtext");
|
|
804
804
|
var import_react15 = __toESM(require("react"));
|
|
805
805
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
806
806
|
const { value } = node;
|
|
807
|
-
|
|
807
|
+
const normalizedValue = (0, import_richtext2.getRichTextListItemValue)(value);
|
|
808
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
809
|
+
"li",
|
|
810
|
+
{
|
|
811
|
+
value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
|
|
812
|
+
},
|
|
813
|
+
children
|
|
814
|
+
);
|
|
808
815
|
};
|
|
809
816
|
|
|
810
817
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
818
|
+
var import_richtext3 = require("@uniformdev/richtext");
|
|
811
819
|
var import_react16 = __toESM(require("react"));
|
|
812
820
|
var ListRichTextNode = ({ children, node }) => {
|
|
813
821
|
const { tag, start } = node;
|
|
814
822
|
const ListTag = tag != null ? tag : "ul";
|
|
815
|
-
|
|
823
|
+
const normalizedStart = (0, import_richtext3.getRichTextListStart)(start);
|
|
824
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
825
|
+
ListTag,
|
|
826
|
+
{
|
|
827
|
+
start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
|
|
828
|
+
},
|
|
829
|
+
children
|
|
830
|
+
);
|
|
816
831
|
};
|
|
817
832
|
|
|
818
833
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
819
|
-
var
|
|
834
|
+
var import_richtext4 = require("@uniformdev/richtext");
|
|
820
835
|
var import_react17 = __toESM(require("react"));
|
|
821
836
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
822
837
|
const { format, direction } = node;
|
|
823
838
|
return /* @__PURE__ */ import_react17.default.createElement(
|
|
824
839
|
"p",
|
|
825
840
|
{
|
|
826
|
-
dir: (0,
|
|
827
|
-
style: (0,
|
|
841
|
+
dir: (0, import_richtext4.isPureDirection)(direction) ? direction : void 0,
|
|
842
|
+
style: (0, import_richtext4.isPureTextAlign)(format) ? { textAlign: format } : void 0
|
|
828
843
|
},
|
|
829
844
|
children
|
|
830
845
|
);
|
|
831
846
|
};
|
|
832
847
|
|
|
833
848
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
834
|
-
var
|
|
849
|
+
var import_richtext5 = require("@uniformdev/richtext");
|
|
835
850
|
var import_react18 = __toESM(require("react"));
|
|
836
851
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
837
852
|
const { headerState } = node;
|
|
838
|
-
const TableCellTag = (0,
|
|
853
|
+
const TableCellTag = (0, import_richtext5.getRichTextTagFromTableCellHeaderState)(headerState);
|
|
839
854
|
return /* @__PURE__ */ import_react18.default.createElement(TableCellTag, null, children);
|
|
840
855
|
};
|
|
841
856
|
|
|
@@ -846,18 +861,18 @@ var TabRichTextNode = () => {
|
|
|
846
861
|
};
|
|
847
862
|
|
|
848
863
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
849
|
-
var
|
|
864
|
+
var import_richtext6 = require("@uniformdev/richtext");
|
|
850
865
|
var import_react20 = __toESM(require("react"));
|
|
851
866
|
var TextRichTextNode = ({ node }) => {
|
|
852
867
|
const { text, format } = node;
|
|
853
|
-
const tags = (0,
|
|
868
|
+
const tags = (0, import_richtext6.getRichTextTagsFromTextFormat)(format);
|
|
854
869
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react20.default.createElement(Tag, null, children), text) : text);
|
|
855
870
|
};
|
|
856
871
|
|
|
857
872
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
858
873
|
function UniformRichTextNode({ node, ...props }) {
|
|
859
874
|
var _a;
|
|
860
|
-
if (!(0,
|
|
875
|
+
if (!(0, import_richtext7.isRichTextNode)(node)) return null;
|
|
861
876
|
let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
|
|
862
877
|
if (typeof NodeRenderer === "undefined") {
|
|
863
878
|
NodeRenderer = resolveRichTextDefaultRenderer(node);
|
|
@@ -907,10 +922,10 @@ var UniformRichText = import_react22.default.forwardRef(function UniformRichText
|
|
|
907
922
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
908
923
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
909
924
|
const value = parameter.value;
|
|
910
|
-
if (!value || !(0,
|
|
911
|
-
if (!isContextualEditing && (0,
|
|
925
|
+
if (!value || !(0, import_richtext8.isRichTextValue)(value)) return null;
|
|
926
|
+
if (!isContextualEditing && (0, import_richtext8.isRichTextValueConsideredEmpty)(value)) return null;
|
|
912
927
|
if (!Tag) {
|
|
913
|
-
return isContextualEditing && (0,
|
|
928
|
+
return isContextualEditing && (0, import_richtext8.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement(
|
|
914
929
|
"p",
|
|
915
930
|
{
|
|
916
931
|
...{
|
|
@@ -933,7 +948,7 @@ var UniformRichText = import_react22.default.forwardRef(function UniformRichText
|
|
|
933
948
|
[import_canvas11.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
934
949
|
} : {}
|
|
935
950
|
},
|
|
936
|
-
(0,
|
|
951
|
+
(0, import_richtext8.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement("p", null, /* @__PURE__ */ import_react22.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react22.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
937
952
|
);
|
|
938
953
|
});
|
|
939
954
|
|
package/dist/index.mjs
CHANGED
|
@@ -288,8 +288,7 @@ var useUniformContextualEditing = ({
|
|
|
288
288
|
};
|
|
289
289
|
};
|
|
290
290
|
function getCanvasInContextEmbedScriptUrl() {
|
|
291
|
-
|
|
292
|
-
return scriptUrl;
|
|
291
|
+
return new URL("/files/canvas-in-context-embed/index.js", window.document.referrer).toString();
|
|
293
292
|
}
|
|
294
293
|
function isInContextEditingMode() {
|
|
295
294
|
if (typeof window === "undefined") {
|
|
@@ -781,18 +780,34 @@ var LinebreakRichTextNode = () => {
|
|
|
781
780
|
};
|
|
782
781
|
|
|
783
782
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
783
|
+
import { getRichTextListItemValue } from "@uniformdev/richtext";
|
|
784
784
|
import React13 from "react";
|
|
785
785
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
786
786
|
const { value } = node;
|
|
787
|
-
|
|
787
|
+
const normalizedValue = getRichTextListItemValue(value);
|
|
788
|
+
return /* @__PURE__ */ React13.createElement(
|
|
789
|
+
"li",
|
|
790
|
+
{
|
|
791
|
+
value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
|
|
792
|
+
},
|
|
793
|
+
children
|
|
794
|
+
);
|
|
788
795
|
};
|
|
789
796
|
|
|
790
797
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
798
|
+
import { getRichTextListStart } from "@uniformdev/richtext";
|
|
791
799
|
import React14 from "react";
|
|
792
800
|
var ListRichTextNode = ({ children, node }) => {
|
|
793
801
|
const { tag, start } = node;
|
|
794
802
|
const ListTag = tag != null ? tag : "ul";
|
|
795
|
-
|
|
803
|
+
const normalizedStart = getRichTextListStart(start);
|
|
804
|
+
return /* @__PURE__ */ React14.createElement(
|
|
805
|
+
ListTag,
|
|
806
|
+
{
|
|
807
|
+
start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
|
|
808
|
+
},
|
|
809
|
+
children
|
|
810
|
+
);
|
|
796
811
|
};
|
|
797
812
|
|
|
798
813
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "20.74.6-alpha.
|
|
3
|
+
"version": "20.74.6-alpha.7.sha-23d7a1d929",
|
|
4
4
|
"description": "React SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"apidocs-extract": "api-extractor run --local"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@uniformdev/canvas": "20.74.6-alpha.
|
|
48
|
-
"@uniformdev/context": "20.74.6-alpha.
|
|
49
|
-
"@uniformdev/context-react": "20.74.6-alpha.
|
|
50
|
-
"@uniformdev/richtext": "20.74.6-alpha.
|
|
47
|
+
"@uniformdev/canvas": "20.74.6-alpha.7.sha-23d7a1d929",
|
|
48
|
+
"@uniformdev/context": "20.74.6-alpha.7.sha-23d7a1d929",
|
|
49
|
+
"@uniformdev/context-react": "20.74.6-alpha.7.sha-23d7a1d929",
|
|
50
|
+
"@uniformdev/richtext": "20.74.6-alpha.7.sha-23d7a1d929"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"immer": ">= 10",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "23d7a1d929f2626dc09db5965d8aa6d25588d67c"
|
|
70
70
|
}
|