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-universal-code",
"comment": "支持关闭activeLine",
"type": "minor"
}
],
"packageName": "@coze-editor/preset-universal-code",
"email": "zhangyi.hanchayi@bytedance.com"
}
22 changes: 11 additions & 11 deletions packages/text-editor/dev/src/pages/highlight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import { useState } from 'react';
import { examples } from './examples';
import { createEditor } from '@coze-editor/editor/react';

const CodeHighlight = createEditor([
...universal,
...universalCode,
...autoLanguage,
], {
defaultOptions: {
fontSize: 15,
readOnly: true,
editable: false,
}
})
const CodeHighlight = createEditor(
[...universal, ...universalCode, ...autoLanguage],
{
defaultOptions: {
fontSize: 15,
readOnly: true,
editable: false,
},
},
);

const HighlightPage = () => {
const [code, setCode] = useState('const a = 1;');
Expand Down Expand Up @@ -49,6 +48,7 @@ const HighlightPage = () => {
options={{
value: code,
path: path,
activeLine: false,
}}
didMount={api => {
console.log('didMount', api);
Expand Down
4 changes: 0 additions & 4 deletions packages/text-editor/preset-universal-code/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
drawSelection,
dropCursor,
EditorView,
highlightActiveLine,
highlightActiveLineGutter,
highlightSpecialChars,
keymap,
rectangularSelection,
Expand All @@ -34,7 +32,6 @@ import {
} from '@codemirror/autocomplete';

export const basicSetup = (() => [
highlightActiveLineGutter(),
highlightSpecialChars(),
history(),
drawSelection(),
Expand All @@ -47,7 +44,6 @@ export const basicSetup = (() => [
autocompletion(),
rectangularSelection(),
crosshairCursor(),
highlightActiveLine(),
keymap.of([
...defaultKeymap,
...closeBracketsKeymap,
Expand Down
10 changes: 9 additions & 1 deletion packages/text-editor/preset-universal-code/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {
type InferEditorAPIFromPlugins,
option,
} from '@coze-editor/core';
import { EditorView, lineNumbers } from '@codemirror/view';
import {
EditorView,
highlightActiveLine,
highlightActiveLineGutter,
lineNumbers,
} from '@codemirror/view';
import { EditorState, Prec } from '@codemirror/state';
import { foldGutter, indentUnit } from '@codemirror/language';

Expand Down Expand Up @@ -47,6 +52,9 @@ const preset = [
),
]),

option('activeLine', (enable = true) =>
enable ? [highlightActiveLineGutter(), highlightActiveLine()] : [],
),
option('tabSize', tabSize),
option('height', height),
option('minHeight', minHeight),
Expand Down
3 changes: 3 additions & 0 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -810,16 +810,19 @@
{
"packageName": "@coze-editor/preset-universal-code",
"projectFolder": "packages/text-editor/preset-universal-code",
"shouldPublish": true,
"tags": ["level-3"]
},
{
"packageName": "@coze-editor/vscode-search",
"projectFolder": "packages/text-editor/vscode-search",
"shouldPublish": true,
"tags": ["level-3"]
},
{
"packageName": "@coze-editor/vscode-themes",
"projectFolder": "packages/text-editor/vscode-themes",
"shouldPublish": true,
"tags": ["level-3"]
},
// {
Expand Down