@snack-uikit/code-editor 0.4.7-preview-ac85ab7b.0 → 0.4.7-preview-aa6874cd.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.
package/README.md
CHANGED
|
@@ -12,6 +12,36 @@
|
|
|
12
12
|
### Props
|
|
13
13
|
| name | type | default value | description |
|
|
14
14
|
|------|------|---------------|-------------|
|
|
15
|
+
| themeName | `string` | - | Название текущей темы. Значение не важно, важно что смена значения запускает пересчет стилей. |
|
|
16
|
+
| hasBackground | `boolean` | true | Включение/отключение псевдобекграунда |
|
|
17
|
+
| yamlSchema | `SchemasSettings` | - | Схема для yaml валидации |
|
|
18
|
+
| defaultValue | `string` | - | Default value of the current model |
|
|
19
|
+
| defaultLanguage | `string` | - | Default language of the current model |
|
|
20
|
+
| defaultPath | `string` | - | Default path of the current model Will be passed as the third argument to `.createModel` method `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` |
|
|
21
|
+
| value | `string` | - | Value of the current model |
|
|
22
|
+
| language | `string` | - | Language of the current model |
|
|
23
|
+
| path | `string` | - | Path of the current model Will be passed as the third argument to `.createModel` method `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` |
|
|
24
|
+
| theme | `string` | "light" | The theme for the monaco Available options "vs-dark" \| "light" Define new themes by `monaco.editor.defineTheme` |
|
|
25
|
+
| line | `number` | - | The line to jump on it |
|
|
26
|
+
| loading | `ReactNode` | "Loading..." | The loading screen before the editor will be mounted |
|
|
27
|
+
| options | `IStandaloneEditorConstructionOptions` | - | IStandaloneEditorConstructionOptions |
|
|
28
|
+
| overrideServices | `IEditorOverrideServices` | - | IEditorOverrideServices |
|
|
29
|
+
| saveViewState | `boolean` | - | Indicator whether to save the models' view states between model changes or not Defaults to true |
|
|
30
|
+
| keepCurrentModel | `boolean` | false | Indicator whether to dispose the current model when the Editor is unmounted or not |
|
|
31
|
+
| width | `string \| number` | "100%" | Width of the editor wrapper |
|
|
32
|
+
| height | `string \| number` | "100%" | Height of the editor wrapper |
|
|
33
|
+
| className | `string` | - | Class name for the editor container |
|
|
34
|
+
| wrapperProps | `object` | - | Props applied to the wrapper element |
|
|
35
|
+
| beforeMount | `BeforeMount` | - | Signature: function(monaco: Monaco) => void An event is emitted before the editor is mounted It gets the monaco instance as a first argument Defaults to "noop" |
|
|
36
|
+
| onMount | `OnMount` | - | Signature: function(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void An event is emitted when the editor is mounted It gets the editor instance as a first argument and the monaco instance as a second Defaults to "noop" |
|
|
37
|
+
| onChange | `OnChange` | - | Signature: function(value: string \| undefined, ev: monaco.editor.IModelContentChangedEvent) => void An event is emitted when the content of the current model is changed |
|
|
38
|
+
| onValidate | `OnValidate` | - | Signature: function(markers: monaco.editor.IMarker[]) => void An event is emitted when the content of the current model is changed and the current model markers are ready Defaults to "noop" |
|
|
15
39
|
|
|
16
40
|
|
|
17
41
|
[//]: DOCUMENTATION_SECTION_END
|
|
42
|
+
|
|
43
|
+
### Поддержка YAML
|
|
44
|
+
Для обеспечения полноценной работы YAML Monaco Editor необходимо подключить `yaml.worker`. Это можно сделать следующими способами: с использованием [`window.MonacoEnvironment`](https://www.npmjs.com/package/monaco-yaml#usage) или с помощью плагина [`MonacoWebpackPlugin`](https://www.npmjs.com/package/monaco-yaml#using-monaco-webpack-loader-plugin) . Подробнее с `monaco-yaml` можно ознакомиться [тут]((https://www.npmjs.com/package/monaco-yaml))
|
|
45
|
+
|
|
46
|
+
### Как редактор загружает worker?
|
|
47
|
+
Для storybook воркеры определены и расширены `yaml` в настройках вебпака сторибука. Плагин создает новые точки входа каждого build-in воркера и для каждого дабавленного отдельно. Плагин создат глобальную переменную, используя которую редкатор будет загружать нужный воркер на основе текущего `language`.
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.4.7-preview-
|
|
7
|
+
"version": "0.4.7-preview-aa6874cd.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/chroma-js": "2.4.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e8e7969f21fb78891213f7bac60d2c87ceb7b8f9"
|
|
50
50
|
}
|