@sigma-studio/editor 0.306.2 → 0.402.1
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/README.md +12 -0
- package/dist/SigmaDocEditor.d.ts +15 -1
- package/dist/index.js +5807 -228
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -167,6 +167,8 @@ interface SigmaDocEditorProps {
|
|
|
167
167
|
className?: string;
|
|
168
168
|
style?: React.CSSProperties;
|
|
169
169
|
editorRef?: { current: SigmaDocEditorHandle | null };
|
|
170
|
+
/** UI表示言語。省略時はブラウザ/OSロケールを検出し、判定できなければ日本語。 */
|
|
171
|
+
locale?: "ja" | "en";
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
interface SigmaDocEditorHandle {
|
|
@@ -176,6 +178,16 @@ interface SigmaDocEditorHandle {
|
|
|
176
178
|
}
|
|
177
179
|
```
|
|
178
180
|
|
|
181
|
+
## 表示言語
|
|
182
|
+
|
|
183
|
+
`locale`に`"ja"`か`"en"`を渡すとEditorのUI言語が切り替わります。省略した場合は「以前この端末で選ばれた言語 → ブラウザ/OSのロケール → 日本語」の順で決まります。
|
|
184
|
+
|
|
185
|
+
言語を渡すと、その選択はホストページの`localStorage`(`sigma-studio:ui-locale`)に残ります。したがって**一度`locale="en"`を渡した後にpropを外しても英語のまま**です。ホスト側が言語を所有している場合は、propを外さずに現在の言語を渡し続けてください。
|
|
186
|
+
|
|
187
|
+
ホストページの`<html lang>`は変更しません(ページ全体の言語指定はホストのものだからです)。読み上げやハイフネーションを表示言語に合わせたい場合は、ホスト側で`document.documentElement.lang`を設定してください。
|
|
188
|
+
|
|
189
|
+
言語設定はモジュールグローバルです。**1つのページに2つの`SigmaDocEditor`を別々の言語で置くことはできません** (後からmountした方の`locale`が両方に効きます)。インスタンスごとに言語を分ける必要が出た場合は、i18nextインスタンスを分ける対応が必要です。
|
|
190
|
+
|
|
179
191
|
## 互換性
|
|
180
192
|
|
|
181
193
|
- React / React DOM: `>=18.2.0 <20`
|
package/dist/SigmaDocEditor.d.ts
CHANGED
|
@@ -20,9 +20,23 @@ export interface SigmaDocEditorProps {
|
|
|
20
20
|
editorRef?: {
|
|
21
21
|
current: SigmaDocEditorHandle | null;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* UI 表示言語。
|
|
25
|
+
*
|
|
26
|
+
* 省略時は「以前この端末で選ばれた言語 → ブラウザ / OS ロケール → 日本語」の順で
|
|
27
|
+
* 決まる。一度渡した `locale` はホストページの `localStorage`
|
|
28
|
+
* (`sigma-studio:ui-locale`) に残るため、後から prop を外しても直前の言語のままになる。
|
|
29
|
+
*
|
|
30
|
+
* ホストページの `<html lang>` は変更しない。ページ全体の言語指定はホストのもの
|
|
31
|
+
* なので、読み上げ等を合わせたい場合はホスト側で設定すること。
|
|
32
|
+
*
|
|
33
|
+
* ロケールはモジュールグローバルなので、1 ページに 2 つの `SigmaDocEditor` を
|
|
34
|
+
* 別々の言語で置くことはできない。
|
|
35
|
+
*/
|
|
36
|
+
locale?: "ja" | "en";
|
|
23
37
|
}
|
|
24
38
|
/**
|
|
25
39
|
* Sigma Studio desktop の EditorShell をそのまま組み込み、SigmaDoc の
|
|
26
40
|
* 入出力だけをホストへ委譲する薄いアダプター。
|
|
27
41
|
*/
|
|
28
|
-
export declare function SigmaDocEditor({ document, onChange, onSave, className, style, editorRef, }: SigmaDocEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function SigmaDocEditor({ document, onChange, onSave, className, style, editorRef, locale, }: SigmaDocEditorProps): import("react/jsx-runtime").JSX.Element;
|