From 24e283e22c8e9898ffb204e9eecd6a584f3242a7 Mon Sep 17 00:00:00 2001 From: Ivan Shelepugin Date: Sat, 7 Feb 2026 23:04:37 +0300 Subject: [PATCH] feat: smart typography (#360) * build(web, deps): add `@tiptap/extension-typography` * feat(editor): add typography extension * chore(editor): disable some typographic characters * chore(editor): disable superscript --- apps/web/package.json | 1 + apps/web/src/components/Editor.tsx | 12 ++++++++++++ pnpm-lock.yaml | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/apps/web/package.json b/apps/web/package.json index 85244be5..3acf2e55 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -38,6 +38,7 @@ "@tiptap/extension-link": "^2.22.2", "@tiptap/extension-mention": "^3.0.9", "@tiptap/extension-placeholder": "^2.14.0", + "@tiptap/extension-typography": "^3.18.0", "@tiptap/pm": "^2.14.0", "@tiptap/react": "^2.14.0", "@tiptap/starter-kit": "^2.14.0", diff --git a/apps/web/src/components/Editor.tsx b/apps/web/src/components/Editor.tsx index ecfaf452..3ac29061 100644 --- a/apps/web/src/components/Editor.tsx +++ b/apps/web/src/components/Editor.tsx @@ -17,6 +17,7 @@ import { ReactRenderer, useEditor, } from "@tiptap/react"; +import Typography from "@tiptap/extension-typography"; import StarterKit from "@tiptap/starter-kit"; import Suggestion from "@tiptap/suggestion"; import { @@ -514,6 +515,17 @@ export default function Editor({ return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`; }, }), + Typography.configure({ + openDoubleQuote: false, + closeDoubleQuote: false, + openSingleQuote: false, + closeSingleQuote: false, + oneHalf: false, + oneQuarter: false, + threeQuarters: false, + superscriptTwo: false, + superscriptThree: false, + }), ...(enableYouTubeEmbed ? [YouTubeNode] : []), ], content, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f89b05ce..65aa2917 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -136,6 +136,9 @@ importers: '@tiptap/extension-placeholder': specifier: ^2.14.0 version: 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1) + '@tiptap/extension-typography': + specifier: ^3.18.0 + version: 3.18.0(@tiptap/core@2.26.1(@tiptap/pm@2.26.1)) '@tiptap/pm': specifier: ^2.14.0 version: 2.26.1 @@ -3779,6 +3782,11 @@ packages: peerDependencies: '@tiptap/core': ^2.7.0 + '@tiptap/extension-typography@3.18.0': + resolution: {integrity: sha512-zTNGJjhJG3lObUhhTbDC1IOyi1DCiCd6i11xsnJDPy5BODYc7t7ZP6VMOWU0LIuMsK9kX02dXoNU7OarJgLpCg==} + peerDependencies: + '@tiptap/core': ^3.18.0 + '@tiptap/pm@2.26.1': resolution: {integrity: sha512-8aF+mY/vSHbGFqyG663ds84b+vca5Lge3tHdTMTKazxCnhXR9dn2oQJMnZ78YZvdRbkPkMJJHti9h3K7u2UQvw==} @@ -11919,6 +11927,10 @@ snapshots: dependencies: '@tiptap/core': 2.26.1(@tiptap/pm@2.26.1) + '@tiptap/extension-typography@3.18.0(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))': + dependencies: + '@tiptap/core': 2.26.1(@tiptap/pm@2.26.1) + '@tiptap/pm@2.26.1': dependencies: prosemirror-changeset: 2.3.1