Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate TipTap editor #91

Merged
merged 9 commits into from
Dec 19, 2024
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,613 changes: 1,460 additions & 153 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
"private": true,
"license": "UNLICENSED",
"dependencies": {
"@tiptap/extension-color": "^2.10.3",
"@tiptap/extension-font-family": "^2.10.3",
"@tiptap/extension-image": "^2.10.3",
"@tiptap/extension-link": "^2.10.3",
"@tiptap/extension-list-item": "^2.10.3",
"@tiptap/extension-ordered-list": "^2.10.3",
"@tiptap/extension-placeholder": "^2.10.3",
"@tiptap/extension-table": "^2.10.3",
"@tiptap/extension-table-cell": "^2.10.3",
"@tiptap/extension-table-header": "^2.10.3",
"@tiptap/extension-table-row": "^2.10.3",
"@tiptap/extension-text-style": "^2.10.3",
"@tiptap/extension-typography": "^2.10.3",
"@tiptap/pm": "^2.10.3",
"@tiptap/starter-kit": "^2.10.3",
"@travisspomer/tidbits": "^1.0.9"
},
"devDependencies": {
Expand Down
47 changes: 46 additions & 1 deletion src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@
src: url("https://files.greeneclipse.com/font/cot4.woff2") format("woff2");
}
@font-face
{
font-family: Concourse;
font-style: italic;
font-weight: 600;
font-display: block;
src: url("https://files.greeneclipse.com/font/cot4i.woff2") format("woff2");
}
@font-face
{
font-family: Inconsolata;
font-style: normal;
Expand Down Expand Up @@ -544,6 +552,12 @@ ul, ol
{
margin: 8px 0 8px 0;

& > p
{
margin-top: 0;
margin-bottom: 0;
}

/* ::marker is not widely-supported right now so don't depend on it. */
&::marker
{
Expand Down Expand Up @@ -602,6 +616,12 @@ table
border-color: transparent transparent var(--grey) transparent;

vertical-align: top;

& > p
{
margin-top: 0;
margin-bottom: 0;
}
}

&.compact
Expand Down Expand Up @@ -1199,11 +1219,36 @@ input[type=text], input[type=email], input[type=number], input[type=password], i
height: 36px;
}

textarea, select
textarea, select, .tiptap
{
@include textbox;
}

.tiptap
{
min-height: 6em;
cursor: text;

& > :first-child
{
margin-top: 0;
}

& > :last-child
{
margin-bottom: 0;
}

&:not(.ProseMirror-focused) p.is-editor-empty:first-child::before
{
content: attr(data-placeholder);
opacity: 0.25;
float: left;
height: 0;
pointer-events: none;
}
}

textarea
{
resize: vertical;
Expand Down
5 changes: 4 additions & 1 deletion src/lib/components/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import ButtonBorder from "./ButtonBorder.svelte"

/** Come on, you know what the id property is for. */
export let id: string | undefined = undefined
/** Optionally, a link to navigate to when the button is clicked. Supplying this will make the button an A tag. If you also use on:click, call preventDefault on the event object to stop navigation to this URL. */
Expand All @@ -14,6 +14,8 @@
export let disabled: boolean = false
/** If true, the content can be selected. */
export let selectable: boolean = false
/** If true, the button appears checked. */
export let checked: boolean = false

/** If true, the button is itty bitty. */
export let tiny: boolean = false
Expand All @@ -32,6 +34,7 @@
{danger} {accent} {toolbar} {ghost}
regular={!tiny} tiny={tiny}
{selectable}
{checked}
{align}
on:click
>
Expand Down
32 changes: 27 additions & 5 deletions src/lib/components/ButtonBorder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/** If true, the control will show focus visuals at rest. */
export let focus: boolean = false
export let selectable: boolean = false
export let checked: boolean = false
/** If false, the button border won't use click visuals. Defaults to true. */
export let clickable: boolean = true

Expand Down Expand Up @@ -43,7 +44,7 @@
display: inline-grid;
justify-content: center;
position: relative;

font: inherit;

user-select: none;
Expand Down Expand Up @@ -220,7 +221,7 @@
{
transform: translateY(3px);
}
}
}
}

@include disabled-or-disabled-class
Expand Down Expand Up @@ -332,7 +333,7 @@

&.toolbar
{
min-width: unset;
min-width: 32px;

@include rest
{
Expand Down Expand Up @@ -573,15 +574,34 @@
opacity: var(--solid-shadow-opacity);
transform: translateY(2px);
}
}
}
}

}

&.checked
{
.face
{
background-color: var(--link-underline);
}

@include hover-or-focus-class
{
.face
{
background-color: var(--link-underline);
}
}
}

}
</style>

<svelte:element this={tag} {id} class:root={true} {href} {title} disabled={disabled ? true : undefined} class:disabled
<svelte:element this={tag} {id}
class:root={true} {href} {title}
role="button"
disabled={disabled ? true : undefined} class:disabled
class:danger={danger && !disabled}
class:accent={accent && !disabled && !danger}
class:toolbar={toolbar && !disabled && !accent && !danger}
Expand All @@ -591,10 +611,12 @@
class:tiny={tiny && !regular}
class:clickable={clickable && !disabled}
class:focus
class:checked
style:user-select={selectable ? "unset" : ""}
style:justify-content={justifyContent}
on:click
on:dragstart|preventDefault
tabindex="0"
>
<span class="shadow"></span>
<span class="bottom"></span>
Expand Down
Loading
Loading