Skip to content

Commit e076461

Browse files
committed
Merge branch 'develop' into beta
2 parents 726eba7 + e5f735f commit e076461

File tree

25 files changed

+970
-1207
lines changed

25 files changed

+970
-1207
lines changed

dev/main.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ config({
3838
type: 'lineNumbers',
3939
extension: lineNumbers()
4040
}
41-
];
41+
].map((item) => {
42+
if (item.type === 'linkShortener') {
43+
return {
44+
...item,
45+
options: {
46+
maxLength: 100
47+
}
48+
};
49+
}
50+
51+
return item;
52+
});
4253
},
4354
// markdownItConfig: (mdit) => {
4455
// mdit.use(ancher, {

eslint.config.mjs

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,5 @@
1-
// import js from '@eslint/js';
2-
// import globals from 'globals';
3-
// import reactHooks from 'eslint-plugin-react-hooks';
4-
// import reactRefresh from 'eslint-plugin-react-refresh';
5-
// import tseslint from 'typescript-eslint';
6-
7-
// export default tseslint.config(
8-
// { ignores: ['lib'] },
9-
// {
10-
// extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
// files: ['**/*.{ts,tsx}'],
12-
// languageOptions: {
13-
// ecmaVersion: 2020,
14-
// globals: globals.browser
15-
// },
16-
// plugins: {
17-
// 'react-hooks': reactHooks,
18-
// 'react-refresh': reactRefresh
19-
// },
20-
// rules: {
21-
// ...reactHooks.configs.recommended.rules,
22-
// 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
23-
// '@typescript-eslint/no-explicit-any': 'off'
24-
// }
25-
// }
26-
// );
27-
281
import eslint from '@eslint/js';
2+
import { defineConfig } from 'eslint/config';
293
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
304
import globals from 'globals';
315
import tseslint from 'typescript-eslint';
@@ -34,7 +8,7 @@ import importPlugin from 'eslint-plugin-import';
348
import reactHooks from 'eslint-plugin-react-hooks';
359
import reactRefresh from 'eslint-plugin-react-refresh';
3610

37-
export default tseslint.config(
11+
export default defineConfig(
3812
{
3913
ignores: ['lib', 'eslint.config.mjs']
4014
},

package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@
4545
"prepare": "husky"
4646
},
4747
"dependencies": {
48-
"@codemirror/autocomplete": "^6.18.6",
48+
"@codemirror/autocomplete": "^6.18.7",
4949
"@codemirror/commands": "^6.8.1",
50-
"@codemirror/lang-markdown": "^6.3.0",
51-
"@codemirror/language": "^6.11.0",
50+
"@codemirror/lang-markdown": "^6.3.4",
51+
"@codemirror/language": "^6.11.3",
5252
"@codemirror/language-data": "^6.5.1",
5353
"@codemirror/search": "^6.5.11",
5454
"@codemirror/state": "^6.5.2",
55-
"@codemirror/view": "^6.36.8",
55+
"@codemirror/view": "^6.38.2",
5656
"@lezer/highlight": "^1.2.1",
5757
"@types/markdown-it": "^14.0.1",
5858
"@vavt/copy2clipboard": "^1.0.1",
5959
"@vavt/util": "^2.1.0",
60-
"codemirror": "^6.0.1",
61-
"lru-cache": "^11.0.1",
62-
"lucide-react": "^0.454.0",
60+
"codemirror": "^6.0.2",
61+
"lru-cache": "^11.2.1",
62+
"lucide-react": "^0.542.0",
6363
"markdown-it": "^14.0.0",
6464
"markdown-it-image-figures": "^2.1.1",
6565
"markdown-it-sub": "^2.0.0",
@@ -68,44 +68,44 @@
6868
"xss": "^1.0.15"
6969
},
7070
"devDependencies": {
71-
"@eslint/js": "^9.34.0",
71+
"@eslint/js": "^9.35.0",
7272
"@types/katex": "^0.16.7",
7373
"@types/multiparty": "^4.2.1",
74-
"@types/node": "^22.8.2",
75-
"@types/react": "^18.3.12",
76-
"@types/react-dom": "^18.3.1",
77-
"@typescript-eslint/eslint-plugin": "^8.42.0",
78-
"@typescript-eslint/parser": "^8.42.0",
74+
"@types/node": "^24.3.1",
75+
"@types/react": "^19.1.12",
76+
"@types/react-dom": "^19.1.9",
77+
"@typescript-eslint/eslint-plugin": "^8.43.0",
78+
"@typescript-eslint/parser": "^8.43.0",
7979
"@vavt/markdown-theme": "^4.5.2",
8080
"@vavt/vite-plugin-import-markdown": "^1.0.1",
81-
"@vitejs/plugin-react": "^4.3.3",
82-
"axios": "^1.7.7",
81+
"@vitejs/plugin-react": "^5.0.2",
82+
"axios": "^1.11.0",
8383
"cropperjs": "^1.6.2",
8484
"echarts": "^6.0.0",
85-
"eslint": "^9.34.0",
85+
"eslint": "^9.35.0",
8686
"eslint-config-prettier": "^10.1.8",
8787
"eslint-import-resolver-typescript": "^4.4.4",
8888
"eslint-plugin-import": "^2.32.0",
8989
"eslint-plugin-prettier": "^5.5.4",
9090
"eslint-plugin-react-hooks": "^5.0.0",
9191
"eslint-plugin-react-refresh": "^0.4.13",
92-
"globals": "^15.11.0",
92+
"globals": "^16.3.0",
9393
"highlight.js": "^11.10.0",
9494
"husky": "^9.1.7",
9595
"katex": "^0.16.22",
96-
"less": "^4.2.0",
97-
"lint-staged": "^15.4.3",
98-
"mermaid": "^11.9.0",
96+
"less": "^4.4.1",
97+
"lint-staged": "^16.1.6",
98+
"mermaid": "^11.11.0",
9999
"multiparty": "^4.2.3",
100100
"prettier": "^3.6.2",
101-
"react": "^18.3.1",
102-
"react-dom": "^18.3.1",
101+
"react": "^19.1.1",
102+
"react-dom": "^19.1.1",
103103
"screenfull": "^6.0.2",
104104
"tsc-alias": "^1.8.10",
105-
"tsx": "^4.19.2",
105+
"tsx": "^4.20.5",
106106
"typescript": "^5.9.2",
107-
"typescript-eslint": "^8.42.0",
108-
"vite": "^5.4.9"
107+
"typescript-eslint": "^8.43.0",
108+
"vite": "^7.1.5"
109109
},
110110
"peerDependencies": {
111111
"react": ">=18.0.0",

packages/MdCatalog/context.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { createContext, MutableRefObject } from 'react';
1+
import { createContext, RefObject } from 'react';
22

3-
export const CatalogContext = createContext<{
4-
scrollElementRef: MutableRefObject<HTMLElement | undefined> | undefined;
5-
rootNodeRef: MutableRefObject<Document | ShadowRoot | undefined> | undefined;
6-
}>({
3+
export interface CatalogContextValue {
4+
scrollElementRef?: RefObject<HTMLElement | null>;
5+
rootNodeRef?: RefObject<Document | ShadowRoot | null>;
6+
}
7+
8+
export const CatalogContext = createContext<CatalogContextValue>({
79
scrollElementRef: undefined,
810
rootNodeRef: undefined
911
});

packages/MdCatalog/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import bus from '~/utils/event-bus';
2222
import { getComputedStyleNum } from '~/utils/scroll-auto';
2323

2424
import CatalogLink from './CatalogLink';
25-
import { CatalogContext } from './context';
25+
import { CatalogContext, CatalogContextValue } from './context';
2626

2727
export interface TocItem extends HeadList {
2828
index: number;
@@ -106,11 +106,11 @@ const MdCatalog = (props: CatalogProps) => {
106106
// 目录根部元素
107107
const catalogRef = useRef<HTMLDivElement>(null);
108108
// 获取到的滚动root节点
109-
const scrollElementRef = useRef<HTMLElement>();
109+
const scrollElementRef = useRef<HTMLElement>(null);
110110
// 滚动容器,包括document
111-
const scrollContainerRef = useRef<HTMLElement | Document>();
111+
const scrollContainerRef = useRef<HTMLElement | Document>(undefined);
112112
// 获取到的目录root节点,注意,不支持目录和编辑器不在同一个web c中使用
113-
const rootNodeRef = useRef<Document | ShadowRoot>();
113+
const rootNodeRef = useRef<Document | ShadowRoot>(null);
114114
// 编辑器view
115115
const [editorView, setEditorView] = useState<EditorView>();
116116

@@ -301,7 +301,7 @@ const MdCatalog = (props: CatalogProps) => {
301301
};
302302
}, [offsetTop, mdHeadingId, getScrollElement, editorId, syncWith, editorView]);
303303

304-
const providerValue = useMemo(() => {
304+
const providerValue = useMemo<CatalogContextValue>(() => {
305305
return {
306306
scrollElementRef,
307307
rootNodeRef

packages/MdEditor/Editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const Editor = forwardRef((props: EditorProps, ref: ForwardedRef<unknown>) => {
9090
};
9191
});
9292
const rootRef = useRef<HTMLDivElement>(null);
93-
const codeRef = useRef<ContentExposeParam>();
93+
const codeRef = useRef<ContentExposeParam>(undefined);
9494

9595
const onScrollAutoChange = useCallback(
9696
(v: boolean) => {

packages/MdEditor/components/Dropdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const DropDown = (props: ModalProps) => {
128128
const slotOverlay = props.overlay;
129129

130130
// 触发器
131-
const trigger = cloneElement(slotDefault, {
131+
const trigger = cloneElement<any>(slotDefault, {
132132
ref: triggerRef,
133133
key: 'cloned-dropdown-trigger'
134134
});

packages/MdEditor/components/Modal/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Modal = (props: ModalProps) => {
4141
const modalRef = useRef<HTMLDivElement>(null);
4242
const modalHeaderRef = useRef<HTMLDivElement>(null);
4343

44-
const bodyRef = useRef<Element | ShadowRoot>();
44+
const bodyRef = useRef<Element | ShadowRoot>(null);
4545

4646
// 创建的弹窗容器,存放在document.body末尾
4747
const containerRef = useRef<HTMLDivElement>(null);
@@ -83,10 +83,10 @@ const Modal = (props: ModalProps) => {
8383
}, [props.height, props.isFullscreen, props.width]);
8484

8585
useEffect(() => {
86-
const rootNode = rootRef!.current?.getRootNode() as ShadowRoot;
86+
const rootNode = rootRef?.current?.getRootNode() as ShadowRoot;
8787
bodyRef.current = rootNode instanceof Document ? document.body : rootNode;
8888
return () => {
89-
bodyRef.current = undefined;
89+
bodyRef.current = null;
9090
};
9191
}, [rootRef]);
9292

packages/MdEditor/layouts/Content/codemirror/floatingToolbar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { StateEffect, StateField } from '@codemirror/state';
22
import { EditorView, showTooltip, Tooltip } from '@codemirror/view';
33
import { createContext, useContext, useSyncExternalStore } from 'react';
4-
import ReactDOM from 'react-dom/client';
4+
import { createRoot } from 'react-dom/client';
55
import { defaultContextValue } from '~/context';
66
import Toolbar from '~/layouts/FloatingToolbar';
77
import { ContextType } from '~/type';
@@ -37,7 +37,7 @@ const tooltipField = StateField.define<Tooltip | null>({
3737
provide: (f) => showTooltip.from(f)
3838
});
3939

40-
export const createFloatingToolbarPlugin = (options: {
40+
export const createFloatingToolbar = (options: {
4141
contextValue: FloatingToolbarContextValue<ContextType>;
4242
}) => {
4343
const showTooltip = (view: EditorView, pos: number) => {
@@ -54,7 +54,7 @@ export const createFloatingToolbarPlugin = (options: {
5454
const appNode = document.createElement('div');
5555
dom.appendChild(appNode);
5656

57-
const root = ReactDOM.createRoot(appNode);
57+
const root = createRoot(appNode);
5858

5959
root.render(
6060
<FloatingToolbarContext.Provider value={options.contextValue}>

packages/MdEditor/layouts/Content/codemirror/textShortener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const defaultTextRegex = new RegExp(
2626
'gi'
2727
);
2828

29-
export const textShortenerPlugin = (options: TextShortenerOptions) => {
29+
export const createTextShortener = (options: TextShortenerOptions) => {
3030
const shortenText = (text: string): string => {
3131
return text.length > 10 ? text.slice(0, 10) + '...' : text;
3232
};

0 commit comments

Comments
 (0)