@bbl-digital/snorre 2.2.78 → 2.2.81

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/bundle.js CHANGED
@@ -31107,7 +31107,8 @@
31107
31107
  maxHeight,
31108
31108
  customToolbar,
31109
31109
  invalidMessage,
31110
- allowImage,
31110
+ allowImages,
31111
+ pasteAsText,
31111
31112
  onChange,
31112
31113
  onBlur
31113
31114
  }) => {
@@ -31117,9 +31118,11 @@
31117
31118
  alert
31118
31119
  } = react.useTheme();
31119
31120
 
31120
- const handleChange = html => {
31121
+ const handleChange = (html, editor) => {
31121
31122
  setValue(html);
31122
- onChange(html, html.length);
31123
+ onChange(html, editor.getContent({
31124
+ format: 'text'
31125
+ }).length);
31123
31126
  };
31124
31127
 
31125
31128
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -31132,7 +31135,6 @@
31132
31135
  children: jsxRuntime$1.jsx(tinymceReact.Editor, {
31133
31136
  onBlur: onBlur,
31134
31137
  onInit: () => setLoaded(true),
31135
- initialValue: initialValue,
31136
31138
  apiKey: TINYMCE_API_KEY,
31137
31139
  value: value,
31138
31140
  onEditorChange: handleChange,
@@ -31148,10 +31150,10 @@
31148
31150
  content_style: editorContentCss,
31149
31151
  language: 'nb_NO',
31150
31152
  block_formats: editorBlockFormats,
31151
- paste_data_images: allowImage,
31152
- paste_as_text: type === 'basic',
31153
+ paste_data_images: allowImages,
31154
+ paste_as_text: pasteAsText !== undefined ? pasteAsText : type === 'basic',
31153
31155
  contextmenu: false,
31154
- invalid_elements: !allowImage ? 'img' : undefined,
31156
+ invalid_elements: !allowImages ? 'img' : undefined,
31155
31157
  default_link_target: '_blank',
31156
31158
  link_assume_external_targets: 'https',
31157
31159
  link_title: false,
@@ -18,7 +18,8 @@ const Editor = ({
18
18
  maxHeight,
19
19
  customToolbar,
20
20
  invalidMessage,
21
- allowImage,
21
+ allowImages,
22
+ pasteAsText,
22
23
  onChange,
23
24
  onBlur
24
25
  }) => {
@@ -28,9 +29,11 @@ const Editor = ({
28
29
  alert
29
30
  } = useTheme();
30
31
 
31
- const handleChange = html => {
32
+ const handleChange = (html, editor) => {
32
33
  setValue(html);
33
- onChange(html, html.length);
34
+ onChange(html, editor.getContent({
35
+ format: 'text'
36
+ }).length);
34
37
  };
35
38
 
36
39
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -43,7 +46,6 @@ const Editor = ({
43
46
  children: _jsx(TinyEditor, {
44
47
  onBlur: onBlur,
45
48
  onInit: () => setLoaded(true),
46
- initialValue: initialValue,
47
49
  apiKey: TINYMCE_API_KEY,
48
50
  value: value,
49
51
  onEditorChange: handleChange,
@@ -59,10 +61,10 @@ const Editor = ({
59
61
  content_style: editorContentCss,
60
62
  language: 'nb_NO',
61
63
  block_formats: editorBlockFormats,
62
- paste_data_images: allowImage,
63
- paste_as_text: type === 'basic',
64
+ paste_data_images: allowImages,
65
+ paste_as_text: pasteAsText !== undefined ? pasteAsText : type === 'basic',
64
66
  contextmenu: false,
65
- invalid_elements: !allowImage ? 'img' : undefined,
67
+ invalid_elements: !allowImages ? 'img' : undefined,
66
68
  default_link_target: '_blank',
67
69
  link_assume_external_targets: 'https',
68
70
  link_title: false,
@@ -13,22 +13,16 @@ interface IProps {
13
13
  height?: number;
14
14
  /** Max resize height of texteditor */
15
15
  maxHeight?: number;
16
- /** Maxlength of input, TODO: DEPRICATE?? */
17
- maxlength?: number;
18
- /** Specifies whether maxlength should include html or not, defaults to 'plaintext', TODO: DEPRICATE?? */
19
- maxlengthType?: 'plaintext' | 'html';
20
- /** Adds an error message if text is too long, TODO: DEPRICATE?? */
21
- maxlengthText?: string;
22
- /** Adds a counter of characters compared to maxlength, if maxlength is specified, TODO: DEPRICATE?? */
23
- withCounter?: boolean;
24
16
  /** Error message */
25
17
  invalidMessage?: string;
26
18
  /** Allow image in editor */
27
- allowImage?: boolean;
19
+ allowImages?: boolean;
20
+ /** Strip all pasted styles */
21
+ pasteAsText?: boolean;
28
22
  /** Cb on blur */
29
23
  onBlur?: () => void;
30
24
  /** Cb on change */
31
- onChange: (value: string, htmlCount: number) => void;
25
+ onChange: (value: string, plainTextLength: number) => void;
32
26
  }
33
27
  declare const Editor: FC<IProps>;
34
28
  export default Editor;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Editor/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAA;AAgBpC,UAAU,MAAM;IACd,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yGAAyG;IACzG,aAAa,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;IACpC,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uGAAuG;IACvG,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,mBAAmB;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CACrD;AAED,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,CAoFtB,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Editor/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAA;AAgBpC,UAAU,MAAM;IACd,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,mBAAmB;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3D;AAED,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,CAqFtB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -18,7 +18,8 @@ const Editor = ({
18
18
  maxHeight,
19
19
  customToolbar,
20
20
  invalidMessage,
21
- allowImage,
21
+ allowImages,
22
+ pasteAsText,
22
23
  onChange,
23
24
  onBlur
24
25
  }) => {
@@ -28,9 +29,11 @@ const Editor = ({
28
29
  alert
29
30
  } = useTheme();
30
31
 
31
- const handleChange = html => {
32
+ const handleChange = (html, editor) => {
32
33
  setValue(html);
33
- onChange(html, html.length);
34
+ onChange(html, editor.getContent({
35
+ format: 'text'
36
+ }).length);
34
37
  };
35
38
 
36
39
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -43,7 +46,6 @@ const Editor = ({
43
46
  children: _jsx(TinyEditor, {
44
47
  onBlur: onBlur,
45
48
  onInit: () => setLoaded(true),
46
- initialValue: initialValue,
47
49
  apiKey: TINYMCE_API_KEY,
48
50
  value: value,
49
51
  onEditorChange: handleChange,
@@ -59,10 +61,10 @@ const Editor = ({
59
61
  content_style: editorContentCss,
60
62
  language: 'nb_NO',
61
63
  block_formats: editorBlockFormats,
62
- paste_data_images: allowImage,
63
- paste_as_text: type === 'basic',
64
+ paste_data_images: allowImages,
65
+ paste_as_text: pasteAsText !== undefined ? pasteAsText : type === 'basic',
64
66
  contextmenu: false,
65
- invalid_elements: !allowImage ? 'img' : undefined,
67
+ invalid_elements: !allowImages ? 'img' : undefined,
66
68
  default_link_target: '_blank',
67
69
  link_assume_external_targets: 'https',
68
70
  link_title: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.2.78",
3
+ "version": "2.2.81",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",