@remit/ui 0.0.110 → 0.0.111
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/package.json
CHANGED
|
@@ -371,9 +371,18 @@ const openDestinationTree = async (canvasElement: HTMLElement) => {
|
|
|
371
371
|
await tick();
|
|
372
372
|
};
|
|
373
373
|
|
|
374
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Opens a folder in the tree; tapping it both picks it and reveals its
|
|
376
|
+
* children. A tap toggles, and the branch holding the rule's current
|
|
377
|
+
* destination is already open when the tree appears, so a folder that is open
|
|
378
|
+
* is left alone rather than tapped shut.
|
|
379
|
+
*/
|
|
375
380
|
const openFolder = async (canvasElement: HTMLElement, label: string) => {
|
|
376
|
-
|
|
381
|
+
const row = canvasElement.querySelector<HTMLElement>(
|
|
382
|
+
`[aria-label="Move to ${label}"]`,
|
|
383
|
+
);
|
|
384
|
+
if (!row) throw new Error(`no control labelled "Move to ${label}"`);
|
|
385
|
+
if (row.getAttribute("aria-expanded") !== "true") row.click();
|
|
377
386
|
await tick();
|
|
378
387
|
};
|
|
379
388
|
|
|
@@ -444,13 +444,23 @@ const AutoFocus = ({ caret }: { caret?: ComposeCaret }) => {
|
|
|
444
444
|
|
|
445
445
|
useEffect(() => {
|
|
446
446
|
if (!caret) return;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
447
|
+
// Seeding the document leaves a selection behind at the end of what was
|
|
448
|
+
// inserted, and `defaultSelection` only applies where there is none — so
|
|
449
|
+
// the caret is placed here rather than left to `focus`, which would open a
|
|
450
|
+
// new message below the signature instead of above it.
|
|
451
|
+
const timer = setTimeout(() => {
|
|
452
|
+
editor.update(
|
|
453
|
+
() => {
|
|
454
|
+
const root = $getRoot();
|
|
455
|
+
if (caret === "start") {
|
|
456
|
+
root.selectStart();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
root.selectEnd();
|
|
460
|
+
},
|
|
461
|
+
{ onUpdate: () => editor.focus() },
|
|
462
|
+
);
|
|
463
|
+
}, 0);
|
|
454
464
|
return () => clearTimeout(timer);
|
|
455
465
|
}, [editor, caret]);
|
|
456
466
|
|