Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@coze-editor/preset-code-languages",
"comment": "支持SVG文件语法高亮并优化路径处理",
"type": "minor"
}
],
"packageName": "@coze-editor/preset-code-languages",
"email": "hanchayi@163.com"
}
8 changes: 8 additions & 0 deletions packages/text-editor/dev/src/pages/highlight/examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export default App;
},
{
code: `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
`,
path: 'a.svg',
},
{
code: `
body {
background-color: #f0f0f0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const supportedLanguages = [
}),
LanguageDescription.of({
name: 'HTML',
extensions: ['html'],
extensions: ['html', 'svg'],
async load() {
return import('@codemirror/lang-html').then(module => module.html());
},
Expand Down
2 changes: 1 addition & 1 deletion packages/text-editor/preset-code-languages/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { asyncOption } from '@coze-editor/core';
import { getLanguage } from './languages';

export const preset = [
...asyncOption('path', (path: string) => getLanguage(path), {
...asyncOption('path', (path?: string) => getLanguage(path ?? ''), {
reset: true,
}),
];