@discuss-ds/ui 0.21.0 → 0.22.0

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/index.d.cts CHANGED
@@ -351,6 +351,11 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
351
351
  * different message appears.
352
352
  */
353
353
  showLimits?: boolean;
354
+ /**
355
+ * Multiline only: Enter saves (like a single-line field) and Shift+Enter inserts a line break. Cmd/Ctrl+Enter keeps
356
+ * saving too. The `question` variant already works this way.
357
+ */
358
+ submitOnEnter?: boolean;
354
359
  disabled?: boolean;
355
360
  /** Called when editing starts or ends. */
356
361
  onEditingChange?: (editing: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -351,6 +351,11 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
351
351
  * different message appears.
352
352
  */
353
353
  showLimits?: boolean;
354
+ /**
355
+ * Multiline only: Enter saves (like a single-line field) and Shift+Enter inserts a line break. Cmd/Ctrl+Enter keeps
356
+ * saving too. The `question` variant already works this way.
357
+ */
358
+ submitOnEnter?: boolean;
354
359
  disabled?: boolean;
355
360
  /** Called when editing starts or ends. */
356
361
  onEditingChange?: (editing: boolean) => void;
package/dist/index.js CHANGED
@@ -1407,6 +1407,7 @@ var InlineEdit = React24.forwardRef(
1407
1407
  minLength,
1408
1408
  validate,
1409
1409
  showLimits,
1410
+ submitOnEnter,
1410
1411
  disabled,
1411
1412
  onEditingChange,
1412
1413
  onDraftChange,
@@ -1500,7 +1501,7 @@ var InlineEdit = React24.forwardRef(
1500
1501
  cancelled.current = true;
1501
1502
  setError(null);
1502
1503
  finish(false, true);
1503
- } else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
1504
+ } else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || (question || submitOnEnter) && !event.shiftKey)) {
1504
1505
  event.preventDefault();
1505
1506
  finish(true, true);
1506
1507
  }