Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions blog/templates/blog/widgets/tiptap.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
</div>
<div data-editor class="prose prose-lg max-w-none min-h-[500px]"></div>
</div>
<p class="tiptap-help">Press <kbd>/</kbd> for blocks · Select text for formatting · Type <code>##</code> for heading, <code>&gt;</code> for quote, <code>**bold**</code> for bold</p>
</div>
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@tiptap/core": "^2.27.2",
"@tiptap/extension-bubble-menu": "^2.27.2",
"@tiptap/extension-link": "^2.27.2",
"@tiptap/extension-placeholder": "^2.27.2",
"@tiptap/extension-underline": "^2.27.2",
"@tiptap/starter-kit": "^2.27.2",
"@tiptap/suggestion": "^2.27.2",
Expand Down
2 changes: 2 additions & 0 deletions src/tiptap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import StarterKit from "@tiptap/starter-kit";
import Underline from "@tiptap/extension-underline";
import Link from "@tiptap/extension-link";
import BubbleMenu from "@tiptap/extension-bubble-menu";
import Placeholder from "@tiptap/extension-placeholder";
import { SlashMenu } from "./slash-menu.js";
import { smartPasteHandler } from "./paste.js";

Expand Down Expand Up @@ -37,6 +38,7 @@ function mountEditor(shell) {
Link.configure({ openOnClick: false, autolink: true, HTMLAttributes: { rel: "noopener noreferrer" } }),
BubbleMenu.configure({ element: bubble }),
SlashMenu,
Placeholder.configure({ placeholder: "Tell your story…" }),
],
content: textarea.value,
editorProps: {
Expand Down
27 changes: 27 additions & 0 deletions static/blog/tiptap.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,30 @@
}
.slash-menu__item.is-selected,
.slash-menu__item:hover { background: rgba(0,0,0,0.05); }

/* Placeholder shown in empty editor (Tiptap Placeholder extension renders
::before with data-placeholder content on empty paragraphs). */
[data-editor] p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
color: var(--md-sys-color-on-surface-variant, #888);
pointer-events: none;
float: left;
height: 0;
}

/* Help line under the editor */
.tiptap-help {
margin: 0.75rem 0.25rem 0;
font-size: 0.8125rem;
color: var(--md-sys-color-on-surface-variant, #666);
line-height: 1.5;
}
.tiptap-help kbd,
.tiptap-help code {
background: rgba(0, 0, 0, 0.06);
padding: 0.05em 0.4em;
border-radius: 4px;
font-family: ui-monospace, monospace;
font-size: 0.875em;
color: inherit;
}
58 changes: 29 additions & 29 deletions static/blog/tiptap.js

Large diffs are not rendered by default.

Loading