@elementor/editor-site-navigation 0.19.7 → 0.19.9

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.19.9](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.19.8...@elementor/editor-site-navigation@0.19.9) (2023-11-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **editor-site-navigation:** wrong state handling in edit mode [ED-12814] ([#146](https://github.com/elementor/elementor-packages/issues/146)) ([5bee3ee](https://github.com/elementor/elementor-packages/commit/5bee3eed17d8f6589c5cddd87ace012dcc9549ce))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.19.8](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.19.7...@elementor/editor-site-navigation@0.19.8) (2023-11-07)
18
+
19
+ **Note:** Version bump only for package @elementor/editor-site-navigation
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.19.7](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.19.6...@elementor/editor-site-navigation@0.19.7) (2023-11-02)
7
26
 
8
27
  **Note:** Version bump only for package @elementor/editor-site-navigation
package/dist/index.js CHANGED
@@ -507,7 +507,7 @@ var import_ui7 = require("@elementor/ui");
507
507
  var import_icons6 = require("@elementor/icons");
508
508
  var import_i18n4 = require("@wordpress/i18n");
509
509
  function EditModeTemplate({ postTitle, isLoading, callback }) {
510
- const inputRef = (0, import_react6.useRef)();
510
+ const [title, setTitle] = (0, import_react6.useState)(postTitle);
511
511
  const [inputError, setInputError] = (0, import_react6.useState)("");
512
512
  const closeButton = (0, import_react6.useRef)();
513
513
  const onBlur = (e) => {
@@ -522,7 +522,7 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
522
522
  };
523
523
  const validateInput = () => {
524
524
  let isValid = true;
525
- if (inputRef.current?.value === "") {
525
+ if (title.trim() === "") {
526
526
  isValid = false;
527
527
  setInputError((0, import_i18n4.__)("Name is required", "elementor"));
528
528
  }
@@ -532,7 +532,7 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
532
532
  if (!validateInput()) {
533
533
  return;
534
534
  }
535
- callback(inputRef.current?.value || "");
535
+ callback(title);
536
536
  };
537
537
  return /* @__PURE__ */ React8.createElement(
538
538
  import_ui7.ListItem,
@@ -545,8 +545,8 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
545
545
  {
546
546
  autoFocus: true,
547
547
  fullWidth: true,
548
- ref: inputRef,
549
- defaultValue: postTitle,
548
+ value: title,
549
+ onChange: (e) => setTitle(e.target.value),
550
550
  disabled: isLoading,
551
551
  error: !!inputError,
552
552
  onBlur,
package/dist/index.mjs CHANGED
@@ -495,7 +495,7 @@ import {
495
495
  import { XIcon } from "@elementor/icons";
496
496
  import { __ as __4 } from "@wordpress/i18n";
497
497
  function EditModeTemplate({ postTitle, isLoading, callback }) {
498
- const inputRef = useRef();
498
+ const [title, setTitle] = useState5(postTitle);
499
499
  const [inputError, setInputError] = useState5("");
500
500
  const closeButton = useRef();
501
501
  const onBlur = (e) => {
@@ -510,7 +510,7 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
510
510
  };
511
511
  const validateInput = () => {
512
512
  let isValid = true;
513
- if (inputRef.current?.value === "") {
513
+ if (title.trim() === "") {
514
514
  isValid = false;
515
515
  setInputError(__4("Name is required", "elementor"));
516
516
  }
@@ -520,7 +520,7 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
520
520
  if (!validateInput()) {
521
521
  return;
522
522
  }
523
- callback(inputRef.current?.value || "");
523
+ callback(title);
524
524
  };
525
525
  return /* @__PURE__ */ React8.createElement(
526
526
  ListItem2,
@@ -533,8 +533,8 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
533
533
  {
534
534
  autoFocus: true,
535
535
  fullWidth: true,
536
- ref: inputRef,
537
- defaultValue: postTitle,
536
+ value: title,
537
+ onChange: (e) => setTitle(e.target.value),
538
538
  disabled: isLoading,
539
539
  error: !!inputError,
540
540
  onBlur,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "0.19.7",
3
+ "version": "0.19.9",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -32,16 +32,16 @@
32
32
  "dev": "tsup --config=../../tsup.dev.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@elementor/editor-app-bar": "^0.9.6",
35
+ "@elementor/editor-app-bar": "^0.9.7",
36
36
  "@elementor/editor-documents": "^0.10.1",
37
- "@elementor/editor-panels": "^0.4.4",
37
+ "@elementor/editor-panels": "^0.4.5",
38
38
  "@elementor/env": "^0.3.2",
39
- "@elementor/icons": "^0.7.1",
40
- "@elementor/query": "^0.1.5",
41
- "@elementor/ui": "^1.4.60",
42
- "@wordpress/api-fetch": "^6.41.0",
43
- "@wordpress/i18n": "^4.44.0",
44
- "@wordpress/url": "^3.45.0"
39
+ "@elementor/icons": "^0.7.2",
40
+ "@elementor/query": "^0.1.6",
41
+ "@elementor/ui": "^1.4.61",
42
+ "@wordpress/api-fetch": "^6.42.0",
43
+ "@wordpress/i18n": "^4.45.0",
44
+ "@wordpress/url": "^3.46.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": "18.x"
@@ -49,5 +49,5 @@
49
49
  "elementor": {
50
50
  "type": "extension"
51
51
  },
52
- "gitHead": "cbfffae2a0d21655d4e3b524095aaf3a0430ae76"
52
+ "gitHead": "bf6f15fca29b0ed3fc9e5f0a7a801ab31264553a"
53
53
  }
@@ -18,7 +18,7 @@ type Props = {
18
18
  }
19
19
 
20
20
  export default function EditModeTemplate( { postTitle, isLoading, callback }: Props ) {
21
- const inputRef = useRef<HTMLInputElement>();
21
+ const [ title, setTitle ] = useState( postTitle );
22
22
  const [ inputError, setInputError ] = useState( '' );
23
23
  const closeButton = useRef<HTMLButtonElement>();
24
24
 
@@ -38,7 +38,7 @@ export default function EditModeTemplate( { postTitle, isLoading, callback }: Pr
38
38
  const validateInput = () => {
39
39
  let isValid = true;
40
40
 
41
- if ( inputRef.current?.value === '' ) {
41
+ if ( title.trim() === '' ) {
42
42
  isValid = false;
43
43
  setInputError( __( 'Name is required', 'elementor' ) );
44
44
  }
@@ -51,7 +51,7 @@ export default function EditModeTemplate( { postTitle, isLoading, callback }: Pr
51
51
  return;
52
52
  }
53
53
 
54
- callback( inputRef.current?.value || '' );
54
+ callback( title );
55
55
  };
56
56
 
57
57
  return (
@@ -63,8 +63,8 @@ export default function EditModeTemplate( { postTitle, isLoading, callback }: Pr
63
63
  <TextField
64
64
  autoFocus // eslint-disable-line jsx-a11y/no-autofocus
65
65
  fullWidth
66
- ref={ inputRef }
67
- defaultValue={ postTitle }
66
+ value={ title }
67
+ onChange={ ( e: React.ChangeEvent<{value: string}> ) => setTitle( e.target.value ) }
68
68
  disabled={ isLoading }
69
69
  error={ !! inputError }
70
70
  onBlur={ onBlur }