@contello/rich-text 8.20.0 → 8.20.1-next.1763378113
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/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare function createRichTextDocumentFromString(text: string): RichTextDocument;
|
|
1
|
+
export declare function createRichTextDocumentFromString(text: string | null | undefined): RichTextDocument;
|
|
2
2
|
|
|
3
3
|
export declare function isRichTextDocumentEmpty(document: RichTextDocument): boolean;
|
|
4
4
|
|
|
5
5
|
export declare type Maybe<T> = T | null | undefined;
|
|
6
6
|
|
|
7
|
-
export declare function parseRichTextDocument(text: string): RichTextDocument;
|
|
7
|
+
export declare function parseRichTextDocument(text: string | null | undefined): RichTextDocument;
|
|
8
8
|
|
|
9
9
|
export declare type RichTextBlockquote = {
|
|
10
10
|
type: 'blockquote';
|
|
@@ -21,7 +21,7 @@ export declare type RichTextBulletList = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export declare type RichTextCodeBlock = {
|
|
24
|
-
type: '
|
|
24
|
+
type: 'codeBlock';
|
|
25
25
|
content?: Maybe<RichTextText[]>;
|
|
26
26
|
};
|
|
27
27
|
|
package/dist/index.js
CHANGED
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.ContelloRichText={}))})(this,function(n){"use strict";function e(t){if(t.type==="text")return t.text;switch(t.type){case"heading":case"paragraph":case"
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.ContelloRichText={}))})(this,function(n){"use strict";function e(t){if(t.type==="text")return t.text;switch(t.type){case"heading":case"paragraph":case"codeBlock":case"blockquote":return(t.content??[]).map(e).join("");case"bulletList":case"orderedList":return(t.content??[]).map(c=>(c.content??[]).map(e).join("")).join("");case"listItem":return(t.content??[]).map(e).join("");case"horizontalRule":return"---";case"hardBreak":return`
|
|
2
2
|
`;case"table":return(t.content??[]).map(c=>(c.content??[]).map(m=>(m.content??[]).map(e).join("")).join(" | ")).join(`
|
|
3
3
|
`);case"tableRow":return(t.content??[]).map(c=>(c.content??[]).map(e).join("")).join(" | ");case"tableCell":return(t.content??[]).map(e).join("");case"tableHeader":return(t.content??[]).map(e).join("")}}function r(t){return t.map(e).join(`
|
|
4
4
|
`)}function i(t){return r(t.content??[])}function a(t){return(t.content??[]).length===0||(t.content??[]).every(c=>e(c).trim()==="")}function u(t){return{type:"doc",content:[{type:"paragraph",content:t?[{type:"text",text:t}]:[]}]}}function o(){return{type:"doc",content:[]}}function p(t){if(!t)return o();const c=JSON.parse(t);return c.type!=="doc"?o():c}n.createRichTextDocumentFromString=u,n.isRichTextDocumentEmpty=a,n.parseRichTextDocument=p,n.richTextDocumentToString=i,n.richTextNodeToString=e,n.richTextNodesToString=r,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED