knowidea-ui 0.12.1 → 0.13.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.
@@ -61,6 +61,8 @@ export interface CodeEditorProps {
61
61
  height?: string;
62
62
  /** CodeMirror の拡張を足す */
63
63
  extensions?: Extension[];
64
+ /** CSP の nonce。CodeMirror は見た目を <style> で差し込むので、style-src を nonce で許す画面で渡す。作った時の値だけを使う */
65
+ cspNonce?: string;
64
66
  className?: string;
65
67
  style?: CSSProperties;
66
68
  }
@@ -70,4 +72,4 @@ export interface CodeEditorProps {
70
72
  * 外から value を替えると(別のファイルを開いた時など)、onChange は呼ばず、元に戻す履歴を空にする。
71
73
  * knowidea-ui/editor から読み込む(CodeMirror を、使う画面でだけ読み込むため)。
72
74
  */
73
- export declare function CodeEditor({ value, onChange, label, language, readOnly, wrap, diagnostics, complete, hover, onDefinition, onSave, height, extensions, className, style }: CodeEditorProps): import("react").JSX.Element;
75
+ export declare function CodeEditor({ value, onChange, label, language, readOnly, wrap, diagnostics, complete, hover, onDefinition, onSave, height, extensions, cspNonce, className, style }: CodeEditorProps): import("react").JSX.Element;
@@ -61,7 +61,7 @@ const infoField = StateField.define({
61
61
  * 外から value を替えると(別のファイルを開いた時など)、onChange は呼ばず、元に戻す履歴を空にする。
62
62
  * knowidea-ui/editor から読み込む(CodeMirror を、使う画面でだけ読み込むため)。
63
63
  */
64
- export function CodeEditor({ value, onChange, label, language = "text", readOnly = false, wrap, diagnostics, complete, hover, onDefinition, onSave, height, extensions, className, style }) {
64
+ export function CodeEditor({ value, onChange, label, language = "text", readOnly = false, wrap, diagnostics, complete, hover, onDefinition, onSave, height, extensions, cspNonce, className, style }) {
65
65
  const host = useRef(null);
66
66
  const view = useRef(null);
67
67
  // ready は、エディタを作った回数と、外から中身を入れ替えた回数。替わるたびに、下の effect が今の設定を送り直す
@@ -142,6 +142,8 @@ export function CodeEditor({ value, onChange, label, language = "text", readOnly
142
142
  EditorView.updateListener.of((u) => { if (u.docChanged)
143
143
  cb.current.onChange?.(u.state.doc.toString()); }),
144
144
  p.label.of([]), p.language.of([]), p.readOnly.of([]), p.wrap.of([]), p.extra.of([]),
145
+ // 見た目の <style> は作った時に差し込むので、nonce は作る時から持たせる
146
+ cspNonce ? EditorView.cspNonce.of(cspNonce) : [],
145
147
  ];
146
148
  const v = new EditorView({ parent: host.current, state: EditorState.create({ doc: value, extensions: base.current }) });
147
149
  view.current = v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowidea-ui",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "KNOW IDEA UI の React の部品(Base UI が土台)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,9 +45,9 @@
45
45
  "peerDependencies": {
46
46
  "react": "^19.0.0",
47
47
  "react-dom": "^19.0.0",
48
- "knowidea-css": "^0.12.1",
49
- "knowidea-icons": "^0.12.1",
50
- "knowidea-tokens": "^0.12.1"
48
+ "knowidea-icons": "^0.13.0",
49
+ "knowidea-tokens": "^0.13.0",
50
+ "knowidea-css": "^0.13.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "19.3.0",
@@ -55,9 +55,9 @@
55
55
  "react": "19.3.0",
56
56
  "react-dom": "19.3.0",
57
57
  "typescript": "5.9.3",
58
- "knowidea-tokens": "0.12.1",
59
- "knowidea-icons": "0.12.1",
60
- "knowidea-css": "0.12.1"
58
+ "knowidea-css": "0.13.0",
59
+ "knowidea-icons": "0.13.0",
60
+ "knowidea-tokens": "0.13.0"
61
61
  },
62
62
  "files": [
63
63
  "dist",