|
1 | | -<!doctype html> |
| 1 | +<!doctype html> |
2 | 2 |
|
3 | 3 | <title>CodeMirror: User Manual</title> |
4 | 4 | <meta charset="utf-8"/> |
@@ -2064,26 +2064,29 @@ <h3 id="api_static">Static properties</h3> |
2064 | 2064 | else (usually one) for dev snapshots.</dd> |
2065 | 2065 |
|
2066 | 2066 | <dt id="fromTextArea"><code><strong>CodeMirror.fromTextArea</strong>(textArea: TextAreaElement, ?config: object)</code></dt> |
2067 | | - <dd> |
2068 | | - The method provides another way to initialize an editor. It |
2069 | | - takes a textarea DOM node as first argument and an optional |
2070 | | - configuration object as second. It will replace the textarea |
2071 | | - with a CodeMirror instance, and wire up the form of that |
2072 | | - textarea (if any) to make sure the editor contents are put |
2073 | | - into the textarea when the form is submitted. The text in the |
2074 | | - textarea will provide the content for the editor. A CodeMirror |
2075 | | - instance created this way has three additional methods: |
2076 | | - <dl> |
2077 | | - <dt id="save"><code><strong>cm.save</strong>()</code></dt> |
2078 | | - <dd>Copy the content of the editor into the textarea.</dd> |
2079 | | - |
2080 | | - <dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt> |
2081 | | - <dd>Remove the editor, and restore the original textarea (with |
2082 | | - the editor's current content).</dd> |
2083 | | - |
2084 | | - <dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt> |
2085 | | - <dd>Returns the textarea that the instance was based on.</dd> |
2086 | | - </dl> |
| 2067 | + <dd>This method provides another way to initialize an editor. It |
| 2068 | + takes a textarea DOM node as first argument and an optional |
| 2069 | + configuration object as second. It will replace the textarea |
| 2070 | + with a CodeMirror instance, and wire up the form of that |
| 2071 | + textarea (if any) to make sure the editor contents are put into |
| 2072 | + the textarea when the form is submitted. The text in the |
| 2073 | + textarea will provide the content for the editor. A CodeMirror |
| 2074 | + instance created this way has three additional methods: |
| 2075 | + <dl> |
| 2076 | + <dt id="save"><code><strong>cm.save</strong>()</code></dt> |
| 2077 | + <dd>Copy the content of the editor into the textarea.</dd> |
| 2078 | + |
| 2079 | + <dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt> |
| 2080 | + <dd>Remove the editor, and restore the original textarea (with |
| 2081 | + the editor's current content). If you dynamically create and |
| 2082 | + destroy editors made with `fromTextArea`, without destroying |
| 2083 | + the form they are part of, you should make sure to call |
| 2084 | + `toTextArea` to remove the editor, or its `"submit"` handler |
| 2085 | + on the form will cause a memory leak.</dd> |
| 2086 | + |
| 2087 | + <dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt> |
| 2088 | + <dd>Returns the textarea that the instance was based on.</dd> |
| 2089 | + </dl> |
2087 | 2090 | </dd> |
2088 | 2091 |
|
2089 | 2092 | <dt id="defaults"><code><strong>CodeMirror.defaults</strong>: object</code></dt> |
|
0 commit comments