feat: add strikethrough
This commit is contained in:
1 parent
b4a26c367b
commit
b28a33b104
5 files changed
+27
No files matched your search
Generated
+15
@@ -7,6 +7,7 @@
|
||||
"": {
|
||||
"name": "web-odf-editor",
|
||||
"version": "0.1.0",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^3.23.6",
|
||||
"@tiptap/extension-bold": "^3.23.6",
|
||||
@@ -21,6 +22,7 @@
|
||||
"@tiptap/extension-ordered-list": "^3.23.6",
|
||||
"@tiptap/extension-paragraph": "^3.23.6",
|
||||
"@tiptap/extension-placeholder": "^3.23.6",
|
||||
"@tiptap/extension-strike": "^3.23.6",
|
||||
"@tiptap/extension-table": "3.23.6",
|
||||
"@tiptap/extension-text": "^3.23.6",
|
||||
"@tiptap/extension-text-align": "^3.23.6",
|
||||
@@ -628,6 +630,19 @@
|
||||
"@tiptap/extensions": "3.23.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-strike": {
|
||||
"version": "3.23.6",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-3.23.6.tgz",
|
||||
"integrity": "sha512-oF7FEZ37f15aCe5kPgzGDYf/m+hr7VdQ/Ko/Hds/UM9pX7AG1fdtmRrl6wqkRqDM/incZaC/AQR2/Dpo2VCNGQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-table": {
|
||||
"version": "3.23.6",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-table/-/extension-table-3.23.6.tgz",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"@tiptap/extension-ordered-list": "^3.23.6",
|
||||
"@tiptap/extension-paragraph": "^3.23.6",
|
||||
"@tiptap/extension-placeholder": "^3.23.6",
|
||||
"@tiptap/extension-strike": "^3.23.6",
|
||||
"@tiptap/extension-table": "3.23.6",
|
||||
"@tiptap/extension-text": "^3.23.6",
|
||||
"@tiptap/extension-text-align": "^3.23.6",
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
let isBold = $derived(tick >= 0 && (!!editor?.isActive('bold') || (isHeading && !hasNormalWeight)));
|
||||
let isItalic = $derived(tick >= 0 && !!editor?.isActive('italic'));
|
||||
let isUnderline = $derived(tick >= 0 && !!editor?.isActive('underline'));
|
||||
let isStrike = $derived(tick >= 0 && !!editor?.isActive('strike'));
|
||||
let isBulletList = $derived(tick >= 0 && !!editor?.isActive('bulletList'));
|
||||
let isOrderedList= $derived(tick >= 0 && !!editor?.isActive('orderedList'));
|
||||
let canUndo = $derived(tick >= 0 && !!editor?.can().undo());
|
||||
@@ -56,6 +57,13 @@
|
||||
>
|
||||
<u>U</u>
|
||||
</button>
|
||||
<button
|
||||
class:active={isStrike}
|
||||
onclick={() => editor?.chain().focus().toggleStrike().run()}
|
||||
title="Strikethrough (Ctrl+Shift+S)"
|
||||
>
|
||||
<s>S</s>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-separator"></div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import Text from '@tiptap/extension-text';
|
||||
import Bold from '@tiptap/extension-bold';
|
||||
import Italic from '@tiptap/extension-italic';
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import Strike from '@tiptap/extension-strike';
|
||||
import Highlight from '@tiptap/extension-highlight';
|
||||
import { TextStyle, FontFamily, FontSize } from '@tiptap/extension-text-style';
|
||||
import { FontWeight } from './fontWeight';
|
||||
@@ -32,6 +33,7 @@ export const extensions = [
|
||||
Bold,
|
||||
Italic,
|
||||
Underline,
|
||||
Strike,
|
||||
TextStyle,
|
||||
FontFamily,
|
||||
FontSize,
|
||||
|
||||
@@ -551,6 +551,7 @@ function applyRuns(p: ParagraphBuilder | CellBuilder, content: TiptapNode[] = []
|
||||
if (marks.some(m => m.type === 'bold')) fmt.bold = true;
|
||||
if (marks.some(m => m.type === 'italic')) fmt.italic = true;
|
||||
if (marks.some(m => m.type === 'underline')) fmt.underline = true;
|
||||
if (marks.some(m => m.type === 'strike')) fmt.strikethrough = true;
|
||||
if (tsm?.attrs?.fontFamily) {
|
||||
const ff = String(tsm.attrs.fontFamily);
|
||||
// Explicitly choosing the editor default should match the untagged
|
||||
|
||||
Reference in new issue
Block a user