una-editor 0.4.0-alpha.0 → 0.4.0-alpha.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.en.md +35 -0
- package/README.md +35 -0
- package/dist/{index-CeTMfP8Z.cjs → index-BOojJ3OI.cjs} +1 -1
- package/dist/{index-BnVlSGix.cjs → index-BgLOUmiA.cjs} +1 -1
- package/dist/{index-B6iSwiLv.js → index-Bqasoc--.js} +1 -1
- package/dist/{index-DBHwJjkL.cjs → index-C1gtDi3_.cjs} +1 -1
- package/dist/{index-CKydJJ8n.js → index-CViNGLKc.js} +4145 -3966
- package/dist/{index-CJBxDvDy.js → index-DBiGHlN0.js} +1 -1
- package/dist/index-DWNPPFdZ.cjs +72 -0
- package/dist/{index-C8zz5a-F.js → index-DsSHtx9e.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +9 -7
- package/dist/types/components/UnaEditor.vue.d.ts +1 -1
- package/dist/types/components/UnaEditor.vue.d.ts.map +1 -1
- package/dist/types/composables/useEditor.d.ts.map +1 -1
- package/dist/types/extensions/hybridMarkdown.d.ts +3 -1
- package/dist/types/extensions/hybridMarkdown.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/themes/editorThemes.d.ts +13 -0
- package/dist/types/themes/editorThemes.d.ts.map +1 -0
- package/dist/types/types/editor.d.ts +76 -1
- package/dist/types/types/editor.d.ts.map +1 -1
- package/dist/una-editor.css +1 -1
- package/package.json +1 -1
- package/dist/index-RMx02Mab.cjs +0 -72
package/README.en.md
CHANGED
|
@@ -82,6 +82,41 @@ Una Editor has built-in code block syntax highlighting with 9 color schemes and
|
|
|
82
82
|
|
|
83
83
|
Set `code-theme="auto"` to follow the editor theme (`theme="dark"` uses `one-dark`, `theme="light"` uses `github-light`).
|
|
84
84
|
|
|
85
|
+
## 🌓 Editor Theming
|
|
86
|
+
|
|
87
|
+
The `theme` prop supports preset theme names and override objects based on `light` / `dark`. Consumers do not need to construct low-level CodeMirror extensions directly.
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<script setup lang="ts">
|
|
91
|
+
import { ref } from 'vue';
|
|
92
|
+
import { UnaEditor } from 'una-editor';
|
|
93
|
+
import type { EditorTheme } from 'una-editor';
|
|
94
|
+
|
|
95
|
+
const content = ref('## Themed Heading\n\n[link](https://example.com)');
|
|
96
|
+
|
|
97
|
+
const customTheme: EditorTheme = {
|
|
98
|
+
type: 'dark',
|
|
99
|
+
content: {
|
|
100
|
+
link: {
|
|
101
|
+
color: '#f59e0b',
|
|
102
|
+
},
|
|
103
|
+
inlineCode: {
|
|
104
|
+
backgroundColor: 'rgba(245, 158, 11, 0.14)',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
table: {
|
|
108
|
+
headerBackground: 'rgba(245, 158, 11, 0.12)',
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<UnaEditor v-model="content" :theme="customTheme" code-theme="auto" />
|
|
115
|
+
</template>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
When `code-theme="auto"` is used, code blocks follow the resolved editor theme `type`, so a custom `dark` theme will still default to `one-dark`.
|
|
119
|
+
|
|
85
120
|
### Supported Languages
|
|
86
121
|
|
|
87
122
|
**Core languages** (loaded synchronously): JavaScript/JS, TypeScript/TS, JSX, TSX, CSS, Shell/Bash
|
package/README.md
CHANGED
|
@@ -82,6 +82,41 @@ Una Editor 内置了代码块语法高亮功能,支持 9 套配色方案和可
|
|
|
82
82
|
|
|
83
83
|
设置 `code-theme="auto"` 可自动跟随编辑器主题(`theme="dark"` 使用 `one-dark`,`theme="light"` 使用 `github-light`)。
|
|
84
84
|
|
|
85
|
+
## 🌓 编辑器主题
|
|
86
|
+
|
|
87
|
+
`theme` 支持直接使用预置主题名,也支持传入“基于 light / dark 的覆盖对象”,不需要自行构造底层 CodeMirror 扩展。
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<script setup lang="ts">
|
|
91
|
+
import { ref } from 'vue';
|
|
92
|
+
import { UnaEditor } from 'una-editor';
|
|
93
|
+
import type { EditorTheme } from 'una-editor';
|
|
94
|
+
|
|
95
|
+
const content = ref('## Themed Heading\n\n[link](https://example.com)');
|
|
96
|
+
|
|
97
|
+
const customTheme: EditorTheme = {
|
|
98
|
+
type: 'dark',
|
|
99
|
+
content: {
|
|
100
|
+
link: {
|
|
101
|
+
color: '#f59e0b',
|
|
102
|
+
},
|
|
103
|
+
inlineCode: {
|
|
104
|
+
backgroundColor: 'rgba(245, 158, 11, 0.14)',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
table: {
|
|
108
|
+
headerBackground: 'rgba(245, 158, 11, 0.12)',
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<UnaEditor v-model="content" :theme="customTheme" code-theme="auto" />
|
|
115
|
+
</template>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
当 `code-theme="auto"` 时,代码块会跟随 resolved editor theme 的 `type`,因此自定义 `dark` 主题仍会默认使用 `one-dark`。
|
|
119
|
+
|
|
85
120
|
### 支持的语言
|
|
86
121
|
|
|
87
122
|
**核心语言**(同步加载):JavaScript/JS、TypeScript/TS、JSX、TSX、CSS、Shell/Bash
|