@bbl-digital/snorre 2.2.79 → 2.2.83

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
@@ -31088,7 +31088,6 @@
31088
31088
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
31089
31089
  });
31090
31090
 
31091
- const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s';
31092
31091
  const editorContentCss = `
31093
31092
  body { font-family:Helvetica,Arial,sans-serif; font-size:16px; } p {margin: 0;} h1,h2,h3,h4,h5,h6 {margin-top: 0;margin-bottom: 0;}
31094
31093
  `;
@@ -31099,6 +31098,7 @@
31099
31098
 
31100
31099
  /** @jsxImportSource @emotion/react */
31101
31100
 
31101
+ // const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s'
31102
31102
  const Editor = ({
31103
31103
  initialValue,
31104
31104
  type = 'basic',
@@ -31109,6 +31109,7 @@
31109
31109
  invalidMessage,
31110
31110
  allowImages,
31111
31111
  pasteAsText,
31112
+ disableResize,
31112
31113
  onChange,
31113
31114
  onBlur
31114
31115
  }) => {
@@ -31118,9 +31119,11 @@
31118
31119
  alert
31119
31120
  } = react.useTheme();
31120
31121
 
31121
- const handleChange = html => {
31122
+ const handleChange = (html, editor) => {
31122
31123
  setValue(html);
31123
- onChange(html, html.length);
31124
+ onChange(html, editor.getContent({
31125
+ format: 'text'
31126
+ }).length);
31124
31127
  };
31125
31128
 
31126
31129
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -31132,8 +31135,8 @@
31132
31135
  className: "editor-wrapper",
31133
31136
  children: jsxRuntime$1.jsx(tinymceReact.Editor, {
31134
31137
  onBlur: onBlur,
31135
- onInit: () => setLoaded(true),
31136
- apiKey: TINYMCE_API_KEY,
31138
+ onInit: () => setLoaded(true) // apiKey={TINYMCE_API_KEY}
31139
+ ,
31137
31140
  value: value,
31138
31141
  onEditorChange: handleChange,
31139
31142
  init: {
@@ -31143,6 +31146,7 @@
31143
31146
  menubar: false,
31144
31147
  branding: false,
31145
31148
  elementpath: false,
31149
+ resize: !disableResize,
31146
31150
  plugins,
31147
31151
  toolbar,
31148
31152
  content_style: editorContentCss,
@@ -1,4 +1,3 @@
1
- export const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s';
2
1
  export const editorContentCss = `
3
2
  body { font-family:Helvetica,Arial,sans-serif; font-size:16px; } p {margin: 0;} h1,h2,h3,h4,h5,h6 {margin-top: 0;margin-bottom: 0;}
4
3
  `;
@@ -2,7 +2,7 @@
2
2
  import { useState } from 'react';
3
3
  import { Editor as TinyEditor } from '@tinymce/tinymce-react';
4
4
  import { ErrorWrapper, Label, styles } from './styles';
5
- import { basicToolbar, editorBlockFormats, editorContentCss, plugins, richToolbar, TINYMCE_API_KEY } from './config';
5
+ import { basicToolbar, editorBlockFormats, editorContentCss, plugins, richToolbar } from './config';
6
6
  import Skeleton from '../Skeleton';
7
7
  import Text from '../Text';
8
8
  import IconErrorOutline from '../../icons/General/IconErrorOutline';
@@ -10,6 +10,7 @@ import { useTheme } from '@emotion/react';
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
12
12
 
13
+ // const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s'
13
14
  const Editor = ({
14
15
  initialValue,
15
16
  type = 'basic',
@@ -20,6 +21,7 @@ const Editor = ({
20
21
  invalidMessage,
21
22
  allowImages,
22
23
  pasteAsText,
24
+ disableResize,
23
25
  onChange,
24
26
  onBlur
25
27
  }) => {
@@ -29,9 +31,11 @@ const Editor = ({
29
31
  alert
30
32
  } = useTheme();
31
33
 
32
- const handleChange = html => {
34
+ const handleChange = (html, editor) => {
33
35
  setValue(html);
34
- onChange(html, html.length);
36
+ onChange(html, editor.getContent({
37
+ format: 'text'
38
+ }).length);
35
39
  };
36
40
 
37
41
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -43,8 +47,8 @@ const Editor = ({
43
47
  className: "editor-wrapper",
44
48
  children: _jsx(TinyEditor, {
45
49
  onBlur: onBlur,
46
- onInit: () => setLoaded(true),
47
- apiKey: TINYMCE_API_KEY,
50
+ onInit: () => setLoaded(true) // apiKey={TINYMCE_API_KEY}
51
+ ,
48
52
  value: value,
49
53
  onEditorChange: handleChange,
50
54
  init: {
@@ -54,6 +58,7 @@ const Editor = ({
54
58
  menubar: false,
55
59
  branding: false,
56
60
  elementpath: false,
61
+ resize: !disableResize,
57
62
  plugins,
58
63
  toolbar,
59
64
  content_style: editorContentCss,
@@ -4,6 +4,6 @@ const regularExpressions = {
4
4
  date: new RegExp(/^(0[1-9]|[12][0-9]|3[01])[\.](0[1-9]|1[012])[\.]\d{4}|(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})|([01][0-9]|2[0-8])(0[0-9]|1[0-2])[0-9][0-9]|30(0[013-9]|1[0-2])[0-9][0-9]|31(0[13578]|1[02])[0-9][0-9]|29((0[013-9]|1[0-2])[0-9][0-9]|02([0246][048]|[13579][26]))|(0[1-9]|[12][0-9]|3[01])[\.](0[1-9]|1[012])[\.]\d{2}$/),
5
5
  email: new RegExp(/^[^<>()\[\]\\.,;:\s@"]+(?:\.[^<>()\[\]\\.,;:\s@"]+)*@(?:[a-zA-ZæÆøØåÅ0-9-]+\.)+[a-zA-Z]{2,}$/),
6
6
  year: new RegExp(/^[12][0-9]{3}$/),
7
- url: new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/)
7
+ url: new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/)
8
8
  };
9
9
  export default regularExpressions;
@@ -1,4 +1,3 @@
1
- export declare const TINYMCE_API_KEY = "v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s";
2
1
  export declare const editorContentCss = "\n body { font-family:Helvetica,Arial,sans-serif; font-size:16px; } p {margin: 0;} h1,h2,h3,h4,h5,h6 {margin-top: 0;margin-bottom: 0;}\n";
3
2
  export declare const editorBlockFormats = "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;";
4
3
  export declare const plugins = "autolink lists link image code print preview media paste";
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Editor/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,qDACwB,CAAA;AAEpD,eAAO,MAAM,gBAAgB,8IAE5B,CAAA;AAED,eAAO,MAAM,kBAAkB,+FAC+D,CAAA;AAE9F,eAAO,MAAM,OAAO,6DACwC,CAAA;AAE5D,eAAO,MAAM,WAAW,QAKN,CAAA;AAElB,eAAO,MAAM,YAAY,2DACiC,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Editor/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,8IAE5B,CAAA;AAED,eAAO,MAAM,kBAAkB,+FAC+D,CAAA;AAE9F,eAAO,MAAM,OAAO,6DACwC,CAAA;AAE5D,eAAO,MAAM,WAAW,QAKN,CAAA;AAElB,eAAO,MAAM,YAAY,2DACiC,CAAA"}
@@ -1,4 +1,3 @@
1
- export const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s';
2
1
  export const editorContentCss = `
3
2
  body { font-family:Helvetica,Arial,sans-serif; font-size:16px; } p {margin: 0;} h1,h2,h3,h4,h5,h6 {margin-top: 0;margin-bottom: 0;}
4
3
  `;
@@ -13,24 +13,18 @@ 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
19
  allowImages?: boolean;
28
20
  /** Strip all pasted styles */
29
21
  pasteAsText?: boolean;
22
+ /** Disables resize */
23
+ disableResize?: boolean;
30
24
  /** Cb on blur */
31
25
  onBlur?: () => void;
32
26
  /** Cb on change */
33
- onChange: (value: string, htmlCount: number) => void;
27
+ onChange: (value: string, plainTextLength: number) => void;
34
28
  }
35
29
  declare const Editor: FC<IProps>;
36
30
  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,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,EAAE,OAAO,CAAA;IACrB,sBAAsB;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,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;AAID,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,CAuFtB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -2,7 +2,7 @@
2
2
  import { useState } from 'react';
3
3
  import { Editor as TinyEditor } from '@tinymce/tinymce-react';
4
4
  import { ErrorWrapper, Label, styles } from './styles';
5
- import { basicToolbar, editorBlockFormats, editorContentCss, plugins, richToolbar, TINYMCE_API_KEY } from './config';
5
+ import { basicToolbar, editorBlockFormats, editorContentCss, plugins, richToolbar } from './config';
6
6
  import Skeleton from '../Skeleton';
7
7
  import Text from '../Text';
8
8
  import IconErrorOutline from '../../icons/General/IconErrorOutline';
@@ -10,6 +10,7 @@ import { useTheme } from '@emotion/react';
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
12
12
 
13
+ // const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s'
13
14
  const Editor = ({
14
15
  initialValue,
15
16
  type = 'basic',
@@ -20,6 +21,7 @@ const Editor = ({
20
21
  invalidMessage,
21
22
  allowImages,
22
23
  pasteAsText,
24
+ disableResize,
23
25
  onChange,
24
26
  onBlur
25
27
  }) => {
@@ -29,9 +31,11 @@ const Editor = ({
29
31
  alert
30
32
  } = useTheme();
31
33
 
32
- const handleChange = html => {
34
+ const handleChange = (html, editor) => {
33
35
  setValue(html);
34
- onChange(html, html.length);
36
+ onChange(html, editor.getContent({
37
+ format: 'text'
38
+ }).length);
35
39
  };
36
40
 
37
41
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
@@ -43,8 +47,8 @@ const Editor = ({
43
47
  className: "editor-wrapper",
44
48
  children: _jsx(TinyEditor, {
45
49
  onBlur: onBlur,
46
- onInit: () => setLoaded(true),
47
- apiKey: TINYMCE_API_KEY,
50
+ onInit: () => setLoaded(true) // apiKey={TINYMCE_API_KEY}
51
+ ,
48
52
  value: value,
49
53
  onEditorChange: handleChange,
50
54
  init: {
@@ -54,6 +58,7 @@ const Editor = ({
54
58
  menubar: false,
55
59
  branding: false,
56
60
  elementpath: false,
61
+ resize: !disableResize,
57
62
  plugins,
58
63
  toolbar,
59
64
  content_style: editorContentCss,
@@ -4,6 +4,6 @@ const regularExpressions = {
4
4
  date: new RegExp(/^(0[1-9]|[12][0-9]|3[01])[\.](0[1-9]|1[012])[\.]\d{4}|(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})|([01][0-9]|2[0-8])(0[0-9]|1[0-2])[0-9][0-9]|30(0[013-9]|1[0-2])[0-9][0-9]|31(0[13578]|1[02])[0-9][0-9]|29((0[013-9]|1[0-2])[0-9][0-9]|02([0246][048]|[13579][26]))|(0[1-9]|[12][0-9]|3[01])[\.](0[1-9]|1[012])[\.]\d{2}$/),
5
5
  email: new RegExp(/^[^<>()\[\]\\.,;:\s@"]+(?:\.[^<>()\[\]\\.,;:\s@"]+)*@(?:[a-zA-ZæÆøØåÅ0-9-]+\.)+[a-zA-Z]{2,}$/),
6
6
  year: new RegExp(/^[12][0-9]{3}$/),
7
- url: new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/)
7
+ url: new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/)
8
8
  };
9
9
  export default regularExpressions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.2.79",
3
+ "version": "2.2.83",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",