diff --git a/packages/secretnote-lite/package.json b/packages/secretnote-lite/package.json index 87eefba9..edfdf5d8 100644 --- a/packages/secretnote-lite/package.json +++ b/packages/secretnote-lite/package.json @@ -21,24 +21,21 @@ "pb": "pnpm publish --no-git-checks --filter @secretflow/secretnote-lite" }, "dependencies": { + "@aarkue/tiptap-math-extension": "^1.3.3", "@antv/s2": "^1.52.0", - "@difizen/mana-app": "0.1.23", - "@difizen/mana-common": "0.1.23", - "@difizen/mana-l10n": "0.1.23", - "@difizen/mana-react": "0.1.23", - "@difizen/libro-jupyter": "0.2.24", - "@difizen/libro-language-client": "0.2.24", "@difizen/libro-code-cell": "0.2.24", "@difizen/libro-code-editor": "0.2.24", "@difizen/libro-codemirror": "0.2.24", "@difizen/libro-cofine-editor": "0.2.24", - "@difizen/libro-cofine-editor-core": "0.2.24", "@difizen/libro-cofine-editor-contribution": "0.2.24", + "@difizen/libro-cofine-editor-core": "0.2.24", "@difizen/libro-cofine-textmate": "0.2.24", "@difizen/libro-common": "0.2.24", "@difizen/libro-core": "0.2.24", + "@difizen/libro-jupyter": "0.2.24", "@difizen/libro-kernel": "0.2.24", "@difizen/libro-l10n": "0.2.24", + "@difizen/libro-language-client": "0.2.24", "@difizen/libro-lsp": "0.2.24", "@difizen/libro-markdown": "0.2.24", "@difizen/libro-markdown-cell": "0.2.24", @@ -49,6 +46,10 @@ "@difizen/libro-search-code-cell": "0.2.24", "@difizen/libro-shared-model": "0.2.24", "@difizen/libro-virtualized": "0.2.24", + "@difizen/mana-app": "0.1.23", + "@difizen/mana-common": "0.1.23", + "@difizen/mana-l10n": "0.1.23", + "@difizen/mana-react": "0.1.23", "@kanaries/web-data-loader": "^0.1.7", "@lumino/polling": "^2.1.3", "@tiptap/core": "^2.1.11", @@ -70,6 +71,7 @@ "classnames": "^2.3.2", "d3-dsv": "^3.0.1", "highlight.js": "^11.9.0", + "katex": "^0.16.11", "lodash-es": "^4.17.21", "lucide-react": "^0.284.0", "markdown-it": "^14.1.0", diff --git a/packages/secretnote-lite/src/components/markdown-editor/extensions/index.tsx b/packages/secretnote-lite/src/components/markdown-editor/extensions/index.tsx index 5f2f6a1e..9c300416 100644 --- a/packages/secretnote-lite/src/components/markdown-editor/extensions/index.tsx +++ b/packages/secretnote-lite/src/components/markdown-editor/extensions/index.tsx @@ -12,6 +12,7 @@ import TiptapUnderline from '@tiptap/extension-underline'; import { StarterKit } from '@tiptap/starter-kit'; import { Markdown } from 'tiptap-markdown'; import SlashCommand from './slash-command'; +import { MathExtension } from '@aarkue/tiptap-math-extension'; export const defaultExtensions = [ StarterKit.configure({ @@ -115,4 +116,5 @@ export const defaultExtensions = [ html: true, transformCopiedText: true, }), + MathExtension, ]; diff --git a/packages/secretnote-lite/src/components/markdown-editor/index.tsx b/packages/secretnote-lite/src/components/markdown-editor/index.tsx index 50b69ad9..96764f15 100644 --- a/packages/secretnote-lite/src/components/markdown-editor/index.tsx +++ b/packages/secretnote-lite/src/components/markdown-editor/index.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { EditorBubbleMenu } from './bubble-menu'; import { defaultExtensions } from './extensions'; import './index.less'; +import 'katex/dist/katex.min.css'; function Editor({ defaultValue = '', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f72a985..0dd93eb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -324,6 +324,9 @@ importers: packages/secretnote-lite: dependencies: + '@aarkue/tiptap-math-extension': + specifier: ^1.3.3 + version: 1.3.3(@tiptap/core@2.6.6(@tiptap/pm@2.6.6))(@tiptap/pm@2.6.6) '@antv/s2': specifier: ^1.52.0 version: 1.55.8(@antv/g-base@0.5.16) @@ -474,6 +477,9 @@ importers: highlight.js: specifier: ^11.9.0 version: 11.10.0 + katex: + specifier: ^0.16.11 + version: 0.16.11 lodash-es: specifier: ^4.17.21 version: 4.17.21 @@ -662,6 +668,12 @@ importers: packages: + '@aarkue/tiptap-math-extension@1.3.3': + resolution: {integrity: sha512-hwNyoHv7xB0r/bFlt7UpFtlQ+0CzYJuq0aEqdLAoYiKcbzM8HYv919YPQp/rYl7YR+nldmZeU5i5CbYgjVsOgA==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.220 + '@tiptap/pm': ^2.0.0-beta.220 + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -6884,7 +6896,6 @@ packages: chokidar@2.1.8: resolution: {integrity: sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==} - deprecated: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies chokidar@3.3.0: resolution: {integrity: sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==} @@ -8906,6 +8917,9 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} + evaluatex@2.2.0: + resolution: {integrity: sha512-QVtGvYTf9HvQyDjbBCwoDQPP9KMuVB56H8KalrkLsPPCQfngpVmkiIoxJ4FU/SVmlmhnbr/heOmP5VlbCTEJpg==} + event-emitter@0.3.5: resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==} @@ -9416,7 +9430,7 @@ packages: resolution: {integrity: sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==} engines: {node: '>= 4.0'} os: [darwin] - deprecated: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 + deprecated: Upgrade to fsevents v2 to mitigate potential security issues fsevents@2.1.3: resolution: {integrity: sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==} @@ -17569,6 +17583,13 @@ packages: snapshots: + '@aarkue/tiptap-math-extension@1.3.3(@tiptap/core@2.6.6(@tiptap/pm@2.6.6))(@tiptap/pm@2.6.6)': + dependencies: + '@tiptap/core': 2.6.6(@tiptap/pm@2.6.6) + '@tiptap/pm': 2.6.6 + evaluatex: 2.2.0 + katex: 0.16.11 + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -29471,6 +29492,8 @@ snapshots: etag@1.8.1: {} + evaluatex@2.2.0: {} + event-emitter@0.3.5: dependencies: d: 1.0.2 @@ -37990,7 +38013,7 @@ snapshots: sass@1.78.0: dependencies: - chokidar: 3.3.0 + chokidar: 3.6.0 immutable: 4.3.7 source-map-js: 1.2.1