@usememos/editor 26.10.27 → 26.10.28

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/react.js CHANGED
@@ -1,162 +1,3 @@
1
- // src/react/index.tsx
2
- import { Editor } from "@usememos/editor";
3
- import { forwardRef, useEffect, useRef, useState } from "react";
4
- import { flushSync } from "react-dom";
5
- import { jsx } from "react/jsx-runtime";
6
- var LIVE = ["placeholder", "mode", "editable", "taskToggle", "attributes", "resolveUrl", "onLinkClick", "theme", "extensions"];
7
- var extensionKey = (extensions) => (extensions ?? []).map((e) => e.name).join("\n");
8
- var MarkdownEditor = forwardRef(function MarkdownEditor2(props, ref) {
9
- const container = useRef(null);
10
- const editorRef = useRef(null);
11
- const pending = useRef([]);
12
- const deferred = useRef(null);
13
- const latest = useRef(props);
14
- latest.current = props;
15
- const extensions = extensionKey(props.extensions);
16
- useEffect(() => {
17
- const { value, defaultValue, onChange, onSubmit, onFocus, onBlur, className, style, ...options } = latest.current;
18
- const previous = editorRef.current;
19
- const editor = new Editor({
20
- ...options,
21
- element: container.current,
22
- content: previous?.getMarkdown() ?? value ?? defaultValue ?? "",
23
- onChange: (markdown) => {
24
- pending.current.push(markdown);
25
- if (pending.current.length > 100) pending.current.shift();
26
- flushSync(() => latest.current.onChange?.(markdown));
27
- },
28
- onSubmit: (markdown) => latest.current.onSubmit?.(markdown),
29
- onFocus: () => latest.current.onFocus?.(),
30
- onBlur: () => latest.current.onBlur?.()
31
- });
32
- editorRef.current = editor;
33
- pending.current = [];
34
- assignRef(ref, editor);
35
- const root = container.current;
36
- const onCompositionEnd = () => {
37
- const value2 = deferred.current;
38
- deferred.current = null;
39
- if (value2 !== null && value2 !== editor.getMarkdown()) {
40
- pending.current = [];
41
- editor.setMarkdown(value2);
42
- }
43
- };
44
- root.addEventListener("compositionend", onCompositionEnd);
45
- return () => {
46
- root.removeEventListener("compositionend", onCompositionEnd);
47
- editor.destroy();
48
- if (editorRef.current === editor) editorRef.current = null;
49
- assignRef(ref, null);
50
- };
51
- }, [extensions]);
52
- useEffect(() => {
53
- const editor = editorRef.current;
54
- if (!editor || props.value === void 0) return;
55
- const echo = pending.current.indexOf(props.value);
56
- if (echo >= 0) {
57
- pending.current.splice(0, echo + 1);
58
- return;
59
- }
60
- if (props.value === editor.getMarkdown()) return;
61
- if (editor.isComposing) {
62
- deferred.current = props.value;
63
- return;
64
- }
65
- pending.current = [];
66
- editor.setMarkdown(props.value);
67
- }, [props.value]);
68
- useLiveOptions(editorRef, props);
69
- return /* @__PURE__ */ jsx("div", { ref: container, className: props.className, style: props.style });
70
- });
71
- function useLiveOptions(editorRef, props) {
72
- const applied = useRef({ editor: null, props: {} });
73
- useEffect(() => {
74
- const editor = editorRef.current;
75
- if (!editor) return;
76
- if (applied.current.editor !== editor) {
77
- applied.current = { editor, props: { ...props } };
78
- return;
79
- }
80
- const changed = {};
81
- let any = false;
82
- for (const key of LIVE) {
83
- if (props[key] === applied.current.props[key]) continue;
84
- changed[key] = key === "editable" ? props.editable ?? true : key === "mode" ? props.mode ?? "rich" : key === "taskToggle" ? props.taskToggle ?? false : props[key];
85
- any = true;
86
- }
87
- applied.current = { editor, props: { ...props } };
88
- if (any) editor.setOptions(changed);
89
- });
90
- }
91
- function useEditor(options, deps = []) {
92
- const [editor, setEditor] = useState(null);
93
- const latest = useRef(options);
94
- latest.current = options;
95
- useEffect(() => {
96
- if (editor && options.extensions) editor.setOptions({ extensions: options.extensions });
97
- }, [editor, options.extensions]);
98
- useEffect(() => {
99
- const o = latest.current;
100
- const element = document.createElement("div");
101
- const instance = new Editor({
102
- ...o,
103
- element,
104
- // A detached element cannot take focus; EditorContent focuses once mounted.
105
- autofocus: false,
106
- onChange: (markdown, e) => latest.current.onChange?.(markdown, e),
107
- onSubmit: (markdown, e) => latest.current.onSubmit?.(markdown, e),
108
- onFocus: (e) => latest.current.onFocus?.(e),
109
- onBlur: (e) => latest.current.onBlur?.(e),
110
- onLinkClick: (ctx) => latest.current.onLinkClick?.(ctx)
111
- });
112
- if (o.autofocus) pendingAutofocus.set(instance, o.autofocus === "end" ? "end" : "start");
113
- setEditor(instance);
114
- return () => {
115
- instance.destroy();
116
- setEditor(null);
117
- };
118
- }, deps);
119
- return editor;
120
- }
121
- function useSuggestion(editor, name) {
122
- const select = (state2) => state2 && (name === void 0 || state2.name === name) ? state2 : null;
123
- const [state, setState] = useState(() => select(editor?.suggestion.state));
124
- useEffect(() => {
125
- if (!editor) {
126
- setState(null);
127
- return;
128
- }
129
- setState(select(editor.suggestion.state));
130
- return editor.on("suggestionChange", ({ state: state2 }) => setState(select(state2)));
131
- }, [editor, name]);
132
- return state;
133
- }
134
- function EditorContent({ editor, className, style }) {
135
- const container = useRef(null);
136
- useEffect(() => {
137
- const host = container.current;
138
- if (!editor || !host) return;
139
- host.appendChild(editor.root);
140
- const autofocus = pendingAutofocus.get(editor);
141
- if (autofocus) {
142
- pendingAutofocus.delete(editor);
143
- editor.commands.focus(autofocus);
144
- }
145
- return () => {
146
- if (editor.root.parentNode === host) host.removeChild(editor.root);
147
- };
148
- }, [editor]);
149
- return /* @__PURE__ */ jsx("div", { ref: container, className, style });
150
- }
151
- var pendingAutofocus = /* @__PURE__ */ new WeakMap();
152
- function assignRef(ref, value) {
153
- if (typeof ref === "function") ref(value);
154
- else if (ref) ref.current = value;
155
- }
156
- export {
157
- EditorContent,
158
- MarkdownEditor,
159
- useEditor,
160
- useSuggestion
161
- };
1
+ import{Editor as h}from"@usememos/editor";import{forwardRef as x,useEffect as f,useRef as d,useState as S}from"react";import{flushSync as P}from"react-dom";import{jsx as y}from"react/jsx-runtime";var b=["placeholder","mode","editable","taskToggle","attributes","resolveUrl","onLinkClick","theme","extensions"],M=t=>(t??[]).map(e=>e.name).join(`
2
+ `),D=x(function(e,r){let s=d(null),n=d(null),o=d([]),i=d(null),l=d(e);l.current=e;let u=M(e.extensions);return f(()=>{let{value:c,defaultValue:m,onChange:O,onSubmit:F,onFocus:T,onBlur:R,className:N,style:B,...C}=l.current,w=n.current,g=new h({...C,element:s.current,content:w?.getMarkdown()??c??m??"",onChange:a=>{o.current.push(a),o.current.length>100&&o.current.shift(),P(()=>l.current.onChange?.(a))},onSubmit:a=>l.current.onSubmit?.(a),onFocus:()=>l.current.onFocus?.(),onBlur:()=>l.current.onBlur?.()});n.current=g,o.current=[],v(r,g);let k=s.current,p=()=>{let a=i.current;i.current=null,a!==null&&a!==g.getMarkdown()&&(o.current=[],g.setMarkdown(a))};return k.addEventListener("compositionend",p),()=>{k.removeEventListener("compositionend",p),g.destroy(),n.current===g&&(n.current=null),v(r,null)}},[u]),f(()=>{let c=n.current;if(!c||e.value===void 0)return;let m=o.current.indexOf(e.value);if(m>=0){o.current.splice(0,m+1);return}if(e.value!==c.getMarkdown()){if(c.isComposing){i.current=e.value;return}o.current=[],c.setMarkdown(e.value)}},[e.value]),L(n,e),y("div",{ref:s,className:e.className,style:e.style})});function L(t,e){let r=d({editor:null,props:{}});f(()=>{let s=t.current;if(!s)return;if(r.current.editor!==s){r.current={editor:s,props:{...e}};return}let n={},o=!1;for(let i of b)e[i]!==r.current.props[i]&&(n[i]=i==="editable"?e.editable??!0:i==="mode"?e.mode??"rich":i==="taskToggle"?e.taskToggle??!1:e[i],o=!0);r.current={editor:s,props:{...e}},o&&s.setOptions(n)})}function U(t,e=[]){let[r,s]=S(null),n=d(t);return n.current=t,f(()=>{r&&t.extensions&&r.setOptions({extensions:t.extensions})},[r,t.extensions]),f(()=>{let o=n.current,i=document.createElement("div"),l=new h({...o,element:i,autofocus:!1,onChange:(u,c)=>n.current.onChange?.(u,c),onSubmit:(u,c)=>n.current.onSubmit?.(u,c),onFocus:u=>n.current.onFocus?.(u),onBlur:u=>n.current.onBlur?.(u),onLinkClick:u=>n.current.onLinkClick?.(u)});return o.autofocus&&E.set(l,o.autofocus==="end"?"end":"start"),s(l),()=>{l.destroy(),s(null)}},e),r}function A(t,e){let r=o=>o&&(e===void 0||o.name===e)?o:null,[s,n]=S(()=>r(t?.suggestion.state));return f(()=>{if(!t){n(null);return}return n(r(t.suggestion.state)),t.on("suggestionChange",({state:o})=>n(r(o)))},[t,e]),s}function K({editor:t,className:e,style:r}){let s=d(null);return f(()=>{let n=s.current;if(!t||!n)return;n.appendChild(t.root);let o=E.get(t);return o&&(E.delete(t),t.commands.focus(o)),()=>{t.root.parentNode===n&&n.removeChild(t.root)}},[t]),y("div",{ref:s,className:e,style:r})}var E=new WeakMap;function v(t,e){typeof t=="function"?t(e):t&&(t.current=e)}export{K as EditorContent,D as MarkdownEditor,U as useEditor,A as useSuggestion};
162
3
  //# sourceMappingURL=react.js.map
package/dist/react.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/react/index.tsx"],
4
4
  "sourcesContent": ["import { Editor, type EditorOptions, type SuggestionState } from '@usememos/editor';\nimport { type CSSProperties, type ForwardedRef, forwardRef, useEffect, useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\n\nexport type { Editor, SuggestionState } from '@usememos/editor';\n\n/** Constructor options that the React components take as props. */\ntype EditorProps = Pick<\n EditorOptions,\n | 'markdown'\n | 'extensions'\n | 'placeholder'\n | 'mode'\n | 'smartLists'\n | 'sourceHighlighting'\n | 'editable'\n | 'taskToggle'\n | 'autofocus'\n | 'attributes'\n | 'resolveUrl'\n | 'referrerPolicy'\n | 'headingIds'\n | 'onLinkClick'\n | 'theme'\n | 'toolbar'\n | 'linkCard'\n | 'slashMenu'\n | 'slashHint'\n | 'labels'\n | 'icons'\n>;\n\nexport interface MarkdownEditorProps extends EditorProps {\n /** Markdown. The editor updates only when this is not a value it emitted itself. */\n value?: string;\n /** Initial Markdown for uncontrolled use. */\n defaultValue?: string;\n /** Called after document changes, at most once per animation frame. */\n onChange?: (markdown: string) => void;\n /** Called on Mod+Enter or Ctrl+Enter with the current Markdown. */\n onSubmit?: (markdown: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Options that `setOptions` applies without recreating the editor. `extensions` updates suggestion callbacks only. */\nconst LIVE = ['placeholder', 'mode', 'editable', 'taskToggle', 'attributes', 'resolveUrl', 'onLinkClick', 'theme', 'extensions'] as const;\n\n/** The extension list's identity for recreating the editor: names, so an inline array does not recreate it on every render. */\nconst extensionKey = (extensions: EditorOptions['extensions']) => (extensions ?? []).map((e) => e.name).join('\\n');\n\n/**\n * The editor as a controlled React component. A `ref` gives the core `Editor`.\n *\n * `placeholder`, `mode`, `editable`, `taskToggle`, `attributes`, `resolveUrl`, `onLinkClick` and `theme` update live.\n * A change to the names in `extensions` recreates the editor, keeping its\n * Markdown; with the same names, the callbacks of `suggestion()` extensions\n * (`items`, `command`, `match`, `allow`) update live. Other props are read\n * when the editor is created; change the component's `key` to apply new values.\n *\n * A `value` that arrives while an input method is composing text is applied\n * when the composition ends, so it does not break the composition.\n */\nexport const MarkdownEditor = forwardRef(function MarkdownEditor(props: MarkdownEditorProps, ref: ForwardedRef<Editor | null>) {\n const container = useRef<HTMLDivElement>(null);\n const editorRef = useRef<Editor | null>(null);\n // Values the editor emitted that the parent has not passed back yet, oldest\n // first. While the user keeps typing, React may hand back an older one;\n // those echoes must not reset the document.\n const pending = useRef<string[]>([]);\n // An outside value that arrived during IME composition.\n const deferred = useRef<string | null>(null);\n // Callbacks are read through a ref so changing them does not recreate the editor.\n const latest = useRef(props);\n latest.current = props;\n const extensions = extensionKey(props.extensions);\n\n useEffect(() => {\n const { value, defaultValue, onChange, onSubmit, onFocus, onBlur, className, style, ...options } = latest.current;\n const previous = editorRef.current;\n const editor = new Editor({\n ...options,\n element: container.current!,\n content: previous?.getMarkdown() ?? value ?? defaultValue ?? '',\n onChange: (markdown) => {\n pending.current.push(markdown);\n if (pending.current.length > 100) pending.current.shift();\n // Render the parent's update now, as React does for a native input's\n // onChange. Left to React's scheduler, it can still be waiting when\n // the parent sets a new value (clearing the box on submit) that equals\n // the value it last rendered; the value effect would then not run.\n flushSync(() => latest.current.onChange?.(markdown));\n },\n onSubmit: (markdown) => latest.current.onSubmit?.(markdown),\n onFocus: () => latest.current.onFocus?.(),\n onBlur: () => latest.current.onBlur?.(),\n });\n editorRef.current = editor;\n pending.current = [];\n assignRef(ref, editor);\n const root = container.current!;\n const onCompositionEnd = () => {\n // Runs after the editor's own compositionend handler, which was added first.\n const value = deferred.current;\n deferred.current = null;\n if (value !== null && value !== editor.getMarkdown()) {\n pending.current = [];\n editor.setMarkdown(value);\n }\n };\n root.addEventListener('compositionend', onCompositionEnd);\n return () => {\n root.removeEventListener('compositionend', onCompositionEnd);\n editor.destroy();\n if (editorRef.current === editor) editorRef.current = null;\n assignRef(ref, null);\n };\n // Recreate only when the extension names change; see the note on the component.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [extensions]);\n\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor || props.value === undefined) return;\n const echo = pending.current.indexOf(props.value);\n if (echo >= 0) {\n // The parent caught up to a value the editor emitted.\n pending.current.splice(0, echo + 1);\n return;\n }\n if (props.value === editor.getMarkdown()) return;\n if (editor.isComposing) {\n deferred.current = props.value;\n return;\n }\n pending.current = [];\n editor.setMarkdown(props.value);\n }, [props.value]);\n\n useLiveOptions(editorRef, props);\n\n return <div ref={container} className={props.className} style={props.style} />;\n});\n\n/** Applies the live options when they change. */\nfunction useLiveOptions(editorRef: { current: Editor | null }, props: EditorProps): void {\n const applied = useRef<{ editor: Editor | null; props: Partial<EditorProps> }>({ editor: null, props: {} });\n useEffect(() => {\n const editor = editorRef.current;\n if (!editor) return;\n if (applied.current.editor !== editor) {\n // A new editor was created with these props.\n applied.current = { editor, props: { ...props } };\n return;\n }\n const changed: Partial<Pick<EditorOptions, (typeof LIVE)[number]>> = {};\n let any = false;\n for (const key of LIVE) {\n if (props[key] === applied.current.props[key]) continue;\n (changed as Record<string, unknown>)[key] = key === 'editable' ? (props.editable ?? true) : key === 'mode' ? (props.mode ?? 'rich') : key === 'taskToggle' ? (props.taskToggle ?? false) : props[key];\n any = true;\n }\n applied.current = { editor, props: { ...props } };\n if (any) editor.setOptions(changed);\n });\n}\n\n/**\n * Creates an editor for the lifetime of the component, or until a value in\n * `deps` changes. Returns null until the editor exists. Pair it with\n * `<EditorContent editor={editor} />`, which shows it.\n *\n * Callbacks in `options` are read when called, so they may change between\n * renders without recreating the editor. So do the callbacks of\n * `suggestion()` extensions, matched by name.\n */\nexport function useEditor(options: Omit<EditorOptions, 'element'>, deps: readonly unknown[] = []): Editor | null {\n const [editor, setEditor] = useState<Editor | null>(null);\n const latest = useRef(options);\n latest.current = options;\n\n useEffect(() => {\n if (editor && options.extensions) editor.setOptions({ extensions: options.extensions });\n }, [editor, options.extensions]);\n\n useEffect(() => {\n const o = latest.current;\n const element = document.createElement('div');\n const instance = new Editor({\n ...o,\n element,\n // A detached element cannot take focus; EditorContent focuses once mounted.\n autofocus: false,\n onChange: (markdown, e) => latest.current.onChange?.(markdown, e),\n onSubmit: (markdown, e) => latest.current.onSubmit?.(markdown, e),\n onFocus: (e) => latest.current.onFocus?.(e),\n onBlur: (e) => latest.current.onBlur?.(e),\n onLinkClick: (ctx) => latest.current.onLinkClick?.(ctx),\n });\n if (o.autofocus) pendingAutofocus.set(instance, o.autofocus === 'end' ? 'end' : 'start');\n setEditor(instance);\n return () => {\n instance.destroy();\n setEditor(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return editor;\n}\n\n/**\n * The open autocomplete popup of `editor`, or of its suggestion `name`, and\n * a re-render on each change. With `render: false` on a suggestion, draw your\n * own popup from it: put it at `state.anchorRect()`, give the listbox\n * `id={state.listboxId}` and each option `id={state.optionId(i)}`, highlight\n * `state.active`, and call `editor.suggestion.accept(i)` on click.\n */\nexport function useSuggestion(editor: Editor | null, name?: string): SuggestionState | null {\n const select = (state: SuggestionState | null | undefined) => (state && (name === undefined || state.name === name) ? state : null);\n const [state, setState] = useState<SuggestionState | null>(() => select(editor?.suggestion.state));\n useEffect(() => {\n if (!editor) {\n setState(null);\n return;\n }\n setState(select(editor.suggestion.state));\n return editor.on('suggestionChange', ({ state }) => setState(select(state)));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor, name]);\n return state;\n}\n\nexport interface EditorContentProps {\n editor: Editor | null;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Shows an editor created with `useEditor`. */\nexport function EditorContent({ editor, className, style }: EditorContentProps) {\n const container = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const host = container.current;\n if (!editor || !host) return;\n host.appendChild(editor.root);\n const autofocus = pendingAutofocus.get(editor);\n if (autofocus) {\n pendingAutofocus.delete(editor);\n editor.commands.focus(autofocus);\n }\n return () => {\n if (editor.root.parentNode === host) host.removeChild(editor.root);\n };\n }, [editor]);\n return <div ref={container} className={className} style={style} />;\n}\n\n/** Where to focus an editor from `useEditor` once `EditorContent` mounts it. */\nconst pendingAutofocus = new WeakMap<Editor, 'start' | 'end'>();\n\nfunction assignRef<T>(ref: ForwardedRef<T>, value: T): void {\n if (typeof ref === 'function') ref(value);\n else if (ref) ref.current = value;\n}\n"],
5
- "mappings": ";AAAA,SAAS,cAAwD;AACjE,SAAgD,YAAY,WAAW,QAAQ,gBAAgB;AAC/F,SAAS,iBAAiB;AA6IjB;AA/FT,IAAM,OAAO,CAAC,eAAe,QAAQ,YAAY,cAAc,cAAc,cAAc,eAAe,SAAS,YAAY;AAG/H,IAAM,eAAe,CAAC,gBAA6C,cAAc,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI;AAc1G,IAAM,iBAAiB,WAAW,SAASA,gBAAe,OAA4B,KAAkC;AAC7H,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,YAAY,OAAsB,IAAI;AAI5C,QAAM,UAAU,OAAiB,CAAC,CAAC;AAEnC,QAAM,WAAW,OAAsB,IAAI;AAE3C,QAAM,SAAS,OAAO,KAAK;AAC3B,SAAO,UAAU;AACjB,QAAM,aAAa,aAAa,MAAM,UAAU;AAE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CACXuB,EAAS,IAAI,EACb,MACF,CACA,OAAAA,EAASF,EAAOrB,EAAO,WAAW,KAAK,CAAC,EACjCA,EAAO,GAAG,mBAAoB,CAAC,CAAE,MAAAsB,CAAM,IAAMC,EAASF,EAAOC,CAAK,CAAC,CAAC,CAE7E,EAAG,CAACtB,EAAQoB,CAAI,CAAC,EACVE,CACT,CASO,SAASE,EAAc,CAAE,OAAAxB,EAAQ,UAAAJ,EAAW,MAAAC,CAAM,EAAuB,CAC9E,IAAMZ,EAAYV,EAAuB,IAAI,EAC7C,OAAAD,EAAU,IAAM,CACd,IAAMmD,EAAOxC,EAAU,QACvB,GAAI,CAACe,GAAU,CAACyB,EAAM,OACtBA,EAAK,YAAYzB,EAAO,IAAI,EAC5B,IAAM0B,EAAYR,EAAiB,IAAIlB,CAAM,EAC7C,OAAI0B,IACFR,EAAiB,OAAOlB,CAAM,EAC9BA,EAAO,SAAS,MAAM0B,CAAS,GAE1B,IAAM,CACP1B,EAAO,KAAK,aAAeyB,GAAMA,EAAK,YAAYzB,EAAO,IAAI,CACnE,CACF,EAAG,CAACA,CAAM,CAAC,EACJtB,EAAC,OAAI,IAAKO,EAAW,UAAWW,EAAW,MAAOC,EAAO,CAClE,CAGA,IAAMqB,EAAmB,IAAI,QAE7B,SAAShB,EAAalB,EAAsBM,EAAgB,CACtD,OAAON,GAAQ,WAAYA,EAAIM,CAAK,EAC/BN,IAAKA,EAAI,QAAUM,EAC9B",
6
+ "names": ["Editor", "forwardRef", "useEffect", "useRef", "useState", "flushSync", "jsx", "LIVE", "extensionKey", "extensions", "MarkdownEditor", "props", "ref", "container", "editorRef", "pending", "deferred", "latest", "value", "defaultValue", "onChange", "onSubmit", "onFocus", "onBlur", "className", "style", "options", "previous", "editor", "markdown", "assignRef", "root", "onCompositionEnd", "echo", "useLiveOptions", "applied", "changed", "any", "key", "useEditor", "deps", "setEditor", "element", "instance", "e", "ctx", "pendingAutofocus", "useSuggestion", "name", "select", "state", "setState", "EditorContent", "host", "autofocus"]
7
7
  }