@growgroup/visual-editor 0.1.1 → 0.1.2
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
|
@@ -394,8 +394,20 @@ export function PptCommentsPanel({
|
|
|
394
394
|
const open = comments.filter((c) => !c.resolved);
|
|
395
395
|
const resolved = comments.filter((c) => c.resolved);
|
|
396
396
|
|
|
397
|
-
|
|
397
|
+
/**
|
|
398
|
+
* 1スレッドの見た目。
|
|
399
|
+
*
|
|
400
|
+
* ⚠️ ここをコンポーネント(`const Thread = () => …` を JSX で `<Thread />` と書く形)
|
|
401
|
+
* にしてはいけない。パネルが再描画されるたびに関数の実体が変わり、Reactが
|
|
402
|
+
* 「別のコンポーネント」と見なしてスレッドごと作り直す。
|
|
403
|
+
* その結果、返信欄のテキストエリアが1打鍵ごとに作り直され、
|
|
404
|
+
* ・キャレットが先頭に戻るため、文字が右から左に入るように見える
|
|
405
|
+
* ・日本語入力の変換が1文字ずつ確定してしまう
|
|
406
|
+
* という状態になる(実際に起きた)。ただの関数として呼び出す形にしておく。
|
|
407
|
+
*/
|
|
408
|
+
const renderThread = (c: SlideComment) => (
|
|
398
409
|
<div
|
|
410
|
+
key={c.id}
|
|
399
411
|
ref={(el) => { threadRefs.current[c.id] = el; }}
|
|
400
412
|
className="rounded-lg border p-2.5"
|
|
401
413
|
style={{
|
|
@@ -662,7 +674,7 @@ export function PptCommentsPanel({
|
|
|
662
674
|
まだコメントはありません。要素を選択して投稿すると、その要素に吹き出しが付きます。
|
|
663
675
|
</p>
|
|
664
676
|
)}
|
|
665
|
-
{open.map((c) =>
|
|
677
|
+
{open.map((c) => renderThread(c))}
|
|
666
678
|
|
|
667
679
|
{resolved.length > 0 && (
|
|
668
680
|
<button
|
|
@@ -673,7 +685,7 @@ export function PptCommentsPanel({
|
|
|
673
685
|
{showResolved ? '▾' : '▸'} 解決済み ({resolved.length})
|
|
674
686
|
</button>
|
|
675
687
|
)}
|
|
676
|
-
{showResolved && resolved.map((c) =>
|
|
688
|
+
{showResolved && resolved.map((c) => renderThread(c))}
|
|
677
689
|
</div>
|
|
678
690
|
</div>
|
|
679
691
|
);
|