@fvc/richtext 1.3.3 → 1.3.5

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/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{RichTextEditorComponent as e,Inject as t,Toolbar as r,HtmlEditor as i,Table as o,QuickToolbar as a}from"@cyber-wysiwyg/richtexteditor";import*as n from"react";import{useCallback as s}from"react";import"@cyber-wysiwyg/richtexteditor/ej2-base/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-icons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-buttons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-splitbuttons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-inputs/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-lists/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-navigations/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-popups/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-richtexteditor/styles/material.css";var l=function(){return l=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".e-rte-content {\n display: flex;\n justify-content: center;\n margin-bottom: 75px;\n margin-top: 75px;\n}\n\n.e-content {\n max-width: 685px;\n padding: 0;\n}");var c={items:["Bold","Italic","Underline","StrikeThrough","FontName","FontSize","FontColor","BackgroundColor","LowerCase","UpperCase","|","Formats","Alignments","OrderedList","UnorderedList","Outdent","Indent","|","CreateLink","CreateTable","|","ClearFormat","|"]},y={table:["TableHeader","TableRows","TableColumns","TableCell","-","BackgroundColor","TableRemove","TableCellVerticalAlign","Styles"]},p=function(p){var d=p.autoCloseHTMLTags,m=void 0===d||d;p.testId;var b=p.toolbarSettings,u=void 0===b?c:b,g=p.quickToolbarSettings,h=void 0===g?y:g,f=p.height,v=void 0===f?450:f,w=p.enableTabKey,x=void 0===w||w,T=p.enableHtmlSanitizer,S=void 0===T||T,C=p.change,j=p.value,O=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(r[i[o]]=e[i[o]])}return r}(p,["autoCloseHTMLTags","testId","toolbarSettings","quickToolbarSettings","height","enableTabKey","enableHtmlSanitizer","change","value"]),k=n.useRef(null),E=n.useMemo((function(){return"function"==typeof u?u(c):u}),[u]),H=s((function(e){var t=m?e.value.replace(/<br\b([^>]*)?(?<!\/)>/gi,"<br$1 />").replace(/<img\b([^>]*)?(?<!\/)>/gi,"<img$1 />"):e.value;null==C||C(l(l({},e),{value:t}))}),[m,C]),I=m&&j?j.replace(/<br\s*\/?>/gi,"<br>").replace(/<img\s+([^>]+?)\s*\/>/gi,"<img $1>"):j;return n.createElement(e,l({ref:k,tabIndex:0,height:v,enableTabKey:x,toolbarSettings:E,quickToolbarSettings:h,enableHtmlSanitizer:S,change:H,value:I},O),n.createElement(t,{services:[r,i,o,a]}))};export{p as Richtext};
1
+ import{RichTextEditorComponent as e,Inject as t,Toolbar as r,HtmlEditor as i,Table as a,QuickToolbar as o}from"@cyber-wysiwyg/richtexteditor";import*as n from"react";import{useCallback as s}from"react";import"@cyber-wysiwyg/richtexteditor/ej2-base/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-icons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-buttons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-splitbuttons/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-inputs/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-lists/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-navigations/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-popups/styles/material.css";import"@cyber-wysiwyg/richtexteditor/ej2-richtexteditor/styles/material.css";var l=function(){return l=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".e-rte-content {\n display: flex;\n justify-content: center;\n margin-bottom: 75px;\n margin-top: 75px;\n}\n\n.e-content {\n max-width: 685px;\n padding: 0;\n}");var c={items:["Bold","Italic","Underline","StrikeThrough","FontName","FontSize","FontColor","BackgroundColor","LowerCase","UpperCase","|","Formats","Alignments","OrderedList","UnorderedList","Outdent","Indent","|","CreateLink","CreateTable","|","ClearFormat","|"]},p={table:["TableHeader","TableRows","TableColumns","TableCell","-","BackgroundColor","TableRemove","TableCellVerticalAlign","Styles"]},y=function(y){var m=y.autoSanitize,d=void 0===m||m;y.testId;var g=y.toolbarSettings,u=void 0===g?c:g,b=y.quickToolbarSettings,h=void 0===b?p:b,f=y.height,v=void 0===f?450:f,w=y.enableTabKey,x=void 0===w||w,S=y.enableHtmlSanitizer,T=void 0===S||S,j=y.change,C=y.value,O=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r}(y,["autoSanitize","testId","toolbarSettings","quickToolbarSettings","height","enableTabKey","enableHtmlSanitizer","change","value"]),k=n.useRef(null),z=n.useMemo((function(){return"function"==typeof u?u(c):u}),[u]),E=s((function(e){var t=d?function(e){return t=e.replace(/<\/?o:p>/gi,"").replace(/\sclass="Mso[a-zA-Z]*"/gi,"").replace(/<!--[\s\S]*?-->/g,"").replace(/<\/?xml[^>]*>/gi,"").replace(/<\/?w:[^>]*>/gi,"").replace(/<\/?m:[^>]*>/gi,"").replace(/\sxmlns(:\w+)?="[^"]*"/gi,""),t.replace(/<br(\s*[^/>]*)>/gi,"<br />").replace(/<img(\s+[^>]*?)(?<!\/)>/gi,"<img$1 />");var t}(e.value):e.value;null==j||j(l(l({},e),{value:t}))}),[d,j]),I=d&&C?C.replace(/<br\s*\/?>/gi,"<br>").replace(/<img\s+([^>]+?)\s*\/>/gi,"<img $1>"):C;return n.createElement(e,l({ref:k,tabIndex:0,height:v,enableTabKey:x,toolbarSettings:z,quickToolbarSettings:h,enableHtmlSanitizer:T,change:E,value:I},O),n.createElement(t,{services:[r,i,a,o]}))};export{y as Richtext};
@@ -10,4 +10,4 @@ import '@cyber-wysiwyg/richtexteditor/ej2-lists/styles/material.css';
10
10
  import '@cyber-wysiwyg/richtexteditor/ej2-navigations/styles/material.css';
11
11
  import '@cyber-wysiwyg/richtexteditor/ej2-popups/styles/material.css';
12
12
  import '@cyber-wysiwyg/richtexteditor/ej2-richtexteditor/styles/material.css';
13
- export declare const Richtext: ({ autoCloseHTMLTags, testId, toolbarSettings, quickToolbarSettings, height, enableTabKey, enableHtmlSanitizer, change, value, ...rest }: RichTextProps) => React.JSX.Element;
13
+ export declare const Richtext: ({ autoSanitize, testId, toolbarSettings, quickToolbarSettings, height, enableTabKey, enableHtmlSanitizer, change, value, ...rest }: RichTextProps) => React.JSX.Element;
@@ -1,2 +1,4 @@
1
1
  export declare const sanitizeUnClosedTags: (html: string) => string;
2
+ export declare const sanitizeWordExtras: (html: string) => string;
3
+ export declare const sanitizeEditorValue: (value: string) => string;
2
4
  export declare const revertUnClosedTags: (html: string) => string;
@@ -2,5 +2,5 @@ import { RichTextEditor } from '@cyber-wysiwyg/richtexteditor/ej2-react-richtext
2
2
  export type RichTextProps = Partial<Omit<RichTextEditor, 'toolbarSettings'>> & {
3
3
  testId?: string;
4
4
  toolbarSettings?: RichTextEditor['toolbarSettings'] | ((defaultToolbarSettings: RichTextEditor['toolbarSettings']) => RichTextEditor['toolbarSettings']);
5
- autoCloseHTMLTags?: boolean;
5
+ autoSanitize?: boolean;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fvc/richtext",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "main": "./dist/lib/index.js",
5
5
  "types": "./dist/lib/richtext/src/index.d.ts",
6
6
  "files": [