formanitor 0.0.30 → 0.0.31

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
@@ -462,7 +462,7 @@ interface StoreConfig {
462
462
  * - `stopRecording` — stop capturing, transcribe, and return the transcript
463
463
  */
464
464
  voice?: {
465
- startRecording: () => Promise<void>;
465
+ startRecording: (fieldId?: string) => Promise<void>;
466
466
  stopRecording: () => Promise<string>;
467
467
  };
468
468
  }
package/dist/index.d.ts CHANGED
@@ -462,7 +462,7 @@ interface StoreConfig {
462
462
  * - `stopRecording` — stop capturing, transcribe, and return the transcript
463
463
  */
464
464
  voice?: {
465
- startRecording: () => Promise<void>;
465
+ startRecording: (fieldId?: string) => Promise<void>;
466
466
  stopRecording: () => Promise<string>;
467
467
  };
468
468
  }
package/dist/index.mjs CHANGED
@@ -812,7 +812,7 @@ function VoiceMicButton({ fieldId, onTranscriptReady }) {
812
812
  setActiveFieldId(fieldId);
813
813
  setStatus("recording");
814
814
  try {
815
- await voice.startRecording();
815
+ await voice.startRecording(fieldId);
816
816
  } catch {
817
817
  setStatus("idle");
818
818
  setActiveFieldId(null);
@@ -1194,6 +1194,19 @@ var RichTextWidget = ({ fieldId }) => {
1194
1194
  const el = editor.view.dom;
1195
1195
  el.style.minHeight = `${minHeight}px`;
1196
1196
  }, [editor, minHeight]);
1197
+ useEffect(() => {
1198
+ if (!editor || editor.isDestroyed) return;
1199
+ const el = editor.view.dom;
1200
+ const handler = (e) => {
1201
+ const { text } = e.detail;
1202
+ if (!text) return;
1203
+ const currentText = editor.getText();
1204
+ const prefix = currentText.length > 0 && !/\s$/.test(currentText) ? " " : "";
1205
+ editor.chain().focus().insertContent(prefix + text).run();
1206
+ };
1207
+ el.addEventListener("insertTranscript", handler);
1208
+ return () => el.removeEventListener("insertTranscript", handler);
1209
+ }, [editor]);
1197
1210
  useEffect(() => {
1198
1211
  if (!editor || editor.isDestroyed) return;
1199
1212
  const fromForm = stringValue;