@os-design/editor 1.0.308 → 1.0.310

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- type JsxButtonProps = JSX.IntrinsicElements['button'];
2
+ type JsxButtonProps = React.JSX.IntrinsicElements['button'];
3
3
  interface ToolbarButtonProps extends JsxButtonProps {
4
4
  active?: boolean;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/Editor/ToolbarButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,cAAc,GAAG,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACtD,UAAU,kBAAmB,SAAQ,cAAc;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAqCD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAE/C,CAAC;AAIF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/Editor/ToolbarButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC5D,UAAU,kBAAmB,SAAQ,cAAc;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAqCD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAE/C,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Figure.d.ts","sourceRoot":"","sources":["../../../src/Editor/blocks/Figure.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;SAQkW,MAAO,WAAW;mGAL/X,CAAC;AAIF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Figure.d.ts","sourceRoot":"","sources":["../../../src/Editor/blocks/Figure.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;;mGAGX,CAAC;AAIF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FigureCaption.d.ts","sourceRoot":"","sources":["../../../src/Editor/blocks/FigureCaption.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa;;SAgB8D,MAAO,WAAW;mGALlG,CAAC;AAIF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"FigureCaption.d.ts","sourceRoot":"","sources":["../../../src/Editor/blocks/FigureCaption.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa;;;mGAWlB,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBlockToolbarProps.d.ts","sourceRoot":"","sources":["../../../src/Editor/hooks/useBlockToolbarProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,GACxB,OAAO,WAAW,EAClB,MAAM,OAAO,KACZ,uBA+CF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useBlockToolbarProps.d.ts","sourceRoot":"","sources":["../../../src/Editor/hooks/useBlockToolbarProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,GACxB,OAAO,WAAW,EAClB,MAAM,OAAO,KACZ,uBAgDF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -15,6 +15,7 @@ const useBlockToolbarProps = (value, show) => {
15
15
  if (!show || !value) return;
16
16
  const selectedBlockElement = getSelectedBlockElement();
17
17
  if (!selectedBlockElement) {
18
+ // eslint-disable-next-line react-hooks/set-state-in-effect
18
19
  setVisible(false);
19
20
  return;
20
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useStyleToolbarProps.d.ts","sourceRoot":"","sources":["../../../src/Editor/hooks/useStyleToolbarProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,UAAU,CAAC;AAIlD,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,GAAI,OAAO,WAAW,KAAG,uBA+BlD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useStyleToolbarProps.d.ts","sourceRoot":"","sources":["../../../src/Editor/hooks/useStyleToolbarProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,UAAU,CAAC;AAIlD,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,GAAI,OAAO,WAAW,KAAG,uBAgClD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { RichUtils } from 'draft-js';
2
- import { useEffect, useState } from 'react';
2
+ import { useLayoutEffect, useState } from 'react';
3
3
  import getSelectionRange from '../utils/getSelectionRange.js';
4
4
  /**
5
5
  * Updates the visibility of the style toolbar
@@ -12,7 +12,7 @@ const useStyleToolbarProps = value => {
12
12
  height: 0
13
13
  });
14
14
  const [visible, setVisible] = useState(false);
15
- useEffect(() => {
15
+ useLayoutEffect(() => {
16
16
  if (!value) return;
17
17
  const selectionRange = getSelectionRange();
18
18
 
@@ -20,6 +20,7 @@ const useStyleToolbarProps = value => {
20
20
  // or the selection range is collapsed,
21
21
  // or the selected text is in an atomic block.
22
22
  if (!selectionRange || value.getSelection().isCollapsed() || RichUtils.getCurrentBlockType(value).startsWith('atomic')) {
23
+ // eslint-disable-next-line react-hooks/set-state-in-effect
23
24
  setVisible(false);
24
25
  return;
25
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Editor/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACL,MAAM,IAAI,WAAW,EACrB,KAAK,WAAW,IAAI,gBAAgB,EACpC,WAAW,EACZ,MAAM,UAAU,CAAC;AAIlB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,OAAiC,EAC/B,KAAK,gBAAgB,EACtB,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,UAAU,CAAC,EACxD,QAAQ;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CAAC;CACzC;AAqBD;;GAEG;AACH,QAAA,MAAM,MAAM,qGAiHX,CAAC;AAIF,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os-design/editor",
3
- "version": "1.0.308",
3
+ "version": "1.0.310",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
6
  "type": "module",
@@ -23,31 +23,31 @@
23
23
  "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist",
24
24
  "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly --declaration --declarationDir dist",
25
25
  "build": "yarn clean && npm-run-all 'build:*'",
26
- "ncu": "ncu -u '/^(?!(react|@types/react|react-dom|@types/react-dom)$).*$/'"
26
+ "ncu": "ncu -u"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@os-design/core": "^1.0.303",
33
- "@os-design/icons": "^1.0.73",
34
- "@os-design/styles": "^1.0.70",
35
- "@os-design/theming": "^1.0.65",
36
- "@os-design/utils": "^1.0.95",
32
+ "@os-design/core": "^1.0.305",
33
+ "@os-design/icons": "^1.0.74",
34
+ "@os-design/styles": "^1.0.71",
35
+ "@os-design/theming": "^1.0.66",
36
+ "@os-design/utils": "^1.0.96",
37
37
  "draft-js": "^0.11.7"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@emotion/react": ">=11",
41
41
  "@emotion/styled": ">=11",
42
- "@types/draft-js": "^0.11.18",
43
- "immutable": "^5.0.3"
42
+ "@types/draft-js": "^0.11.20",
43
+ "immutable": "^5.1.5"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@emotion/react": ">=11",
47
47
  "@emotion/styled": ">=11",
48
48
  "immutable": "~3.7.4",
49
- "react": "18",
50
- "react-dom": "18"
49
+ "react": "19",
50
+ "react-dom": "19"
51
51
  },
52
- "gitHead": "0ef5d7b8bcfefd958d3a51f5181cd6de2ef5ae27"
52
+ "gitHead": "f333f60e39273574d2227cf0ee70b0c8897b2dde"
53
53
  }
@@ -5,7 +5,7 @@ import { clr } from '@os-design/theming';
5
5
  import { omitEmotionProps } from '@os-design/utils';
6
6
  import React from 'react';
7
7
 
8
- type JsxButtonProps = JSX.IntrinsicElements['button'];
8
+ type JsxButtonProps = React.JSX.IntrinsicElements['button'];
9
9
  interface ToolbarButtonProps extends JsxButtonProps {
10
10
  active?: boolean;
11
11
  }
@@ -34,6 +34,7 @@ const useBlockToolbarProps = (
34
34
 
35
35
  const selectedBlockElement = getSelectedBlockElement();
36
36
  if (!selectedBlockElement) {
37
+ // eslint-disable-next-line react-hooks/set-state-in-effect
37
38
  setVisible(false);
38
39
  return;
39
40
  }
@@ -1,5 +1,5 @@
1
1
  import { EditorState, RichUtils } from 'draft-js';
2
- import { useEffect, useState } from 'react';
2
+ import { useLayoutEffect, useState } from 'react';
3
3
  import getSelectionRange from '../utils/getSelectionRange.js';
4
4
 
5
5
  interface Rect {
@@ -26,7 +26,7 @@ const useStyleToolbarProps = (value: EditorState): UseStyleToolbarPropsRes => {
26
26
  });
27
27
  const [visible, setVisible] = useState(false);
28
28
 
29
- useEffect(() => {
29
+ useLayoutEffect(() => {
30
30
  if (!value) return;
31
31
  const selectionRange = getSelectionRange();
32
32
 
@@ -38,6 +38,7 @@ const useStyleToolbarProps = (value: EditorState): UseStyleToolbarPropsRes => {
38
38
  value.getSelection().isCollapsed() ||
39
39
  RichUtils.getCurrentBlockType(value).startsWith('atomic')
40
40
  ) {
41
+ // eslint-disable-next-line react-hooks/set-state-in-effect
41
42
  setVisible(false);
42
43
  return;
43
44
  }
@@ -24,8 +24,7 @@ import defaultStyleToolbarItems, {
24
24
  } from './utils/defaultStyleToolbarItems.js';
25
25
 
26
26
  export interface EditorProps
27
- extends Omit<DraftEditorProps, 'editorState' | 'onChange'>,
28
- WithSize {
27
+ extends Omit<DraftEditorProps, 'editorState' | 'onChange'>, WithSize {
29
28
  /**
30
29
  * Whether the editor is disabled.
31
30
  * @default false