From 88f2db7c1ece6a12a9d6b6ee0fdbbaed3b6637d2 Mon Sep 17 00:00:00 2001 From: Benjamin VIELLARD Date: Fri, 7 Apr 2023 14:48:54 +0200 Subject: [PATCH] feat: subscript and superscript extensions --- package.json | 2 ++ pnpm-lock.yaml | 22 ++++++++++++++++++++++ src/extensions.ts | 4 +++- src/icons/subscript.vue | 7 +++++++ src/icons/superscript.vue | 7 +++++++ src/tiptap-editor.vue | 26 ++++++++++++++++++++++++++ 6 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/icons/subscript.vue create mode 100644 src/icons/superscript.vue diff --git a/package.json b/package.json index 1c48d85..d7642cc 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,8 @@ "@tiptap/extension-character-count": "^2.0.2", "@tiptap/extension-highlight": "^2.0.2", "@tiptap/extension-placeholder": "^2.0.2", + "@tiptap/extension-subscript": "^2.0.2", + "@tiptap/extension-superscript": "^2.0.2", "@tiptap/extension-underline": "^2.0.2", "@tiptap/pm": "^2.0.2", "@tiptap/starter-kit": "^2.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4377593..fd13476 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,12 @@ devDependencies: '@tiptap/extension-placeholder': specifier: ^2.0.2 version: 2.0.2(@tiptap/core@2.0.2)(@tiptap/pm@2.0.2) + '@tiptap/extension-subscript': + specifier: ^2.0.2 + version: 2.0.2(@tiptap/core@2.0.2) + '@tiptap/extension-superscript': + specifier: ^2.0.2 + version: 2.0.2(@tiptap/core@2.0.2) '@tiptap/extension-underline': specifier: ^2.0.2 version: 2.0.2(@tiptap/core@2.0.2) @@ -1203,6 +1209,22 @@ packages: '@tiptap/core': 2.0.2(@tiptap/pm@2.0.2) dev: true + /@tiptap/extension-subscript@2.0.2(@tiptap/core@2.0.2): + resolution: {integrity: sha512-ctlxtfNMEeBtaVAcsJ7taUsyKwIe+FoSOj5N3aacEceKjYaZkwBGYGfy8Gn66ZybozkEE0XJ6PJZMzUR/Egq9A==} + peerDependencies: + '@tiptap/core': ^2.0.0 + dependencies: + '@tiptap/core': 2.0.2(@tiptap/pm@2.0.2) + dev: true + + /@tiptap/extension-superscript@2.0.2(@tiptap/core@2.0.2): + resolution: {integrity: sha512-ucCbTuVjnrWfchU7fTicGsqDFzd46vEO+EYtAOEeDiJTg35/pwps8Krtfba5LIHuNc37cDpCHrSTDRZQXDxmOw==} + peerDependencies: + '@tiptap/core': ^2.0.0 + dependencies: + '@tiptap/core': 2.0.2(@tiptap/pm@2.0.2) + dev: true + /@tiptap/extension-text@2.0.2(@tiptap/core@2.0.2): resolution: {integrity: sha512-kAO+WurWOyHIV/x8qHMF3bSlWrdlPtjEYmf+w8wHKy3FzE55eF6SsGt4FymClNkJmyXdgflXBB3Wv/Z53myy8g==} peerDependencies: diff --git a/src/extensions.ts b/src/extensions.ts index 6c5f80d..191032f 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -2,6 +2,8 @@ import type { Extensions } from "@tiptap/core"; import StarterKit from "@tiptap/starter-kit"; import { Underline } from "@tiptap/extension-underline"; import { Highlight } from "@tiptap/extension-highlight"; +import { Subscript } from "@tiptap/extension-subscript"; +import { Superscript } from "@tiptap/extension-superscript"; import { CharacterCount } from "@tiptap/extension-character-count"; -export const extensions: Extensions = [StarterKit, Underline, Highlight, CharacterCount]; +export const extensions: Extensions = [StarterKit, Underline, Highlight, Subscript, Superscript, CharacterCount]; diff --git a/src/icons/subscript.vue b/src/icons/subscript.vue new file mode 100644 index 0000000..bb99845 --- /dev/null +++ b/src/icons/subscript.vue @@ -0,0 +1,7 @@ + diff --git a/src/icons/superscript.vue b/src/icons/superscript.vue new file mode 100644 index 0000000..f71d018 --- /dev/null +++ b/src/icons/superscript.vue @@ -0,0 +1,7 @@ + diff --git a/src/tiptap-editor.vue b/src/tiptap-editor.vue index a7a8557..a16c315 100644 --- a/src/tiptap-editor.vue +++ b/src/tiptap-editor.vue @@ -78,6 +78,30 @@ + + + + + + + +