-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd6dca0
commit 536df15
Showing
9 changed files
with
211 additions
and
76 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 82 additions & 66 deletions
148
src/app/features/spaces/contents/shared/rich-text-editor/rich-text-editor.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,83 @@ | ||
@if (component(); as field) { | ||
<mat-label>{{ field.displayName || field.name }}</mat-label> | ||
<div class="border-color border border-b-0 rounded-t-md p-1 flex"> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('bold') }" | ||
(click)="editor.chain().focus().toggleBold().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-bold" viewBox="0 0 16 16"> | ||
<path | ||
d="M8.21 13c2.106 0 3.412-1.087 3.412-2.823 0-1.306-.984-2.283-2.324-2.386v-.055a2.176 2.176 0 0 0 1.852-2.14c0-1.51-1.162-2.46-3.014-2.46H3.843V13zM5.908 4.674h1.696c.963 0 1.517.451 1.517 1.244 0 .834-.629 1.32-1.73 1.32H5.908V4.673zm0 6.788V8.598h1.73c1.217 0 1.88.492 1.88 1.415 0 .943-.643 1.449-1.832 1.449H5.907z" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('italic') }" | ||
(click)="editor.chain().focus().toggleItalic().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-italic" viewBox="0 0 16 16"> | ||
<path | ||
d="M7.991 11.674 9.53 4.455c.123-.595.246-.71 1.347-.807l.11-.52H7.211l-.11.52c1.06.096 1.128.212 1.005.807L6.57 11.674c-.123.595-.246.71-1.346.806l-.11.52h3.774l.11-.52c-1.06-.095-1.129-.211-1.006-.806z" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('strike') }" | ||
(click)="editor.chain().focus().toggleStrike().run()"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="20" | ||
height="20" | ||
fill="currentColor" | ||
class="bi bi-type-strikethrough" | ||
viewBox="0 0 16 16"> | ||
<path | ||
d="M6.333 5.686c0 .31.083.581.27.814H5.166a2.8 2.8 0 0 1-.099-.76c0-1.627 1.436-2.768 3.48-2.768 1.969 0 3.39 1.175 3.445 2.85h-1.23c-.11-1.08-.964-1.743-2.25-1.743-1.23 0-2.18.602-2.18 1.607zm2.194 7.478c-2.153 0-3.589-1.107-3.705-2.81h1.23c.144 1.06 1.129 1.703 2.544 1.703 1.34 0 2.31-.705 2.31-1.675 0-.827-.547-1.374-1.914-1.675L8.046 8.5H1v-1h14v1h-3.504c.468.437.675.994.675 1.697 0 1.826-1.436 2.967-3.644 2.967" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('underline') }" | ||
(click)="editor.chain().focus().toggleUnderline().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-underline" viewBox="0 0 16 16"> | ||
<path | ||
d="M5.313 3.136h-1.23V9.54c0 2.105 1.47 3.623 3.917 3.623s3.917-1.518 3.917-3.623V3.136h-1.23v6.323c0 1.49-.978 2.57-2.687 2.57s-2.687-1.08-2.687-2.57zM12.5 15h-9v-1h9z" /> | ||
</svg> | ||
</button> | ||
<span class="vertical-divider"> </span> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('underline') }" | ||
(click)="editor.chain().focus().toggleUnderline().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-underline" viewBox="0 0 16 16"> | ||
<path | ||
d="M5.313 3.136h-1.23V9.54c0 2.105 1.47 3.623 3.917 3.623s3.917-1.518 3.917-3.623V3.136h-1.23v6.323c0 1.49-.978 2.57-2.687 2.57s-2.687-1.08-2.687-2.57zM12.5 15h-9v-1h9z" /> | ||
</svg> | ||
</button> | ||
</div> | ||
<tiptap-editor [editor]="editor" [formControl]="form()"></tiptap-editor> | ||
@if (field.description) { | ||
<mat-hint>{{ field.description }}</mat-hint> | ||
<div class="my-4"> | ||
@if (component(); as field) { | ||
<mat-label>{{ field.displayName || field.name }}</mat-label> | ||
<div class="border-color border border-b-0 rounded-t-md p-1 flex"> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('bold') }" | ||
(click)="editor.chain().focus().toggleBold().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-bold" viewBox="0 0 16 16"> | ||
<path | ||
d="M8.21 13c2.106 0 3.412-1.087 3.412-2.823 0-1.306-.984-2.283-2.324-2.386v-.055a2.176 2.176 0 0 0 1.852-2.14c0-1.51-1.162-2.46-3.014-2.46H3.843V13zM5.908 4.674h1.696c.963 0 1.517.451 1.517 1.244 0 .834-.629 1.32-1.73 1.32H5.908V4.673zm0 6.788V8.598h1.73c1.217 0 1.88.492 1.88 1.415 0 .943-.643 1.449-1.832 1.449H5.907z" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('italic') }" | ||
(click)="editor.chain().focus().toggleItalic().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-italic" viewBox="0 0 16 16"> | ||
<path | ||
d="M7.991 11.674 9.53 4.455c.123-.595.246-.71 1.347-.807l.11-.52H7.211l-.11.52c1.06.096 1.128.212 1.005.807L6.57 11.674c-.123.595-.246.71-1.346.806l-.11.52h3.774l.11-.52c-1.06-.095-1.129-.211-1.006-.806z" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('strike') }" | ||
(click)="editor.chain().focus().toggleStrike().run()"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="20" | ||
height="20" | ||
fill="currentColor" | ||
class="bi bi-type-strikethrough" | ||
viewBox="0 0 16 16"> | ||
<path | ||
d="M6.333 5.686c0 .31.083.581.27.814H5.166a2.8 2.8 0 0 1-.099-.76c0-1.627 1.436-2.768 3.48-2.768 1.969 0 3.39 1.175 3.445 2.85h-1.23c-.11-1.08-.964-1.743-2.25-1.743-1.23 0-2.18.602-2.18 1.607zm2.194 7.478c-2.153 0-3.589-1.107-3.705-2.81h1.23c.144 1.06 1.129 1.703 2.544 1.703 1.34 0 2.31-.705 2.31-1.675 0-.827-.547-1.374-1.914-1.675L8.046 8.5H1v-1h14v1h-3.504c.468.437.675.994.675 1.697 0 1.826-1.436 2.967-3.644 2.967" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('underline') }" | ||
(click)="editor.chain().focus().toggleUnderline().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-type-underline" viewBox="0 0 16 16"> | ||
<path | ||
d="M5.313 3.136h-1.23V9.54c0 2.105 1.47 3.623 3.917 3.623s3.917-1.518 3.917-3.623V3.136h-1.23v6.323c0 1.49-.978 2.57-2.687 2.57s-2.687-1.08-2.687-2.57zM12.5 15h-9v-1h9z" /> | ||
</svg> | ||
</button> | ||
<span class="vertical-divider"> </span> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('bulletList') }" | ||
(click)="editor.chain().focus().toggleBulletList().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-list-ul" viewBox="0 0 16 16"> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m-3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2" /> | ||
</svg> | ||
</button> | ||
<button | ||
class="rounded h-7 w-7 flex justify-center items-center ml-1" | ||
[ngClass]="{ 'bg-black text-white': editor.isActive('orderedList') }" | ||
(click)="editor.chain().focus().toggleOrderedList().run()"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-list-ol" viewBox="0 0 16 16"> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5" /> | ||
<path | ||
d="M1.713 11.865v-.474H2c.217 0 .363-.137.363-.317 0-.185-.158-.31-.361-.31-.223 0-.367.152-.373.31h-.59c.016-.467.373-.787.986-.787.588-.002.954.291.957.703a.595.595 0 0 1-.492.594v.033a.615.615 0 0 1 .569.631c.003.533-.502.8-1.051.8-.656 0-1-.37-1.008-.794h.582c.008.178.186.306.422.309.254 0 .424-.145.422-.35-.002-.195-.155-.348-.414-.348h-.3zm-.004-4.699h-.604v-.035c0-.408.295-.844.958-.844.583 0 .96.326.96.756 0 .389-.257.617-.476.848l-.537.572v.03h1.054V9H1.143v-.395l.957-.99c.138-.142.293-.304.293-.508 0-.18-.147-.32-.342-.32a.33.33 0 0 0-.342.338zM2.564 5h-.635V2.924h-.031l-.598.42v-.567l.629-.443h.635z" /> | ||
</svg> | ||
</button> | ||
<span class="vertical-divider"> </span> | ||
</div> | ||
<tiptap-editor [editor]="editor" [formControl]="form()"></tiptap-editor> | ||
@if (field.description) { | ||
<mat-hint>{{ field.description }}</mat-hint> | ||
} | ||
@if (field.maxLength) { | ||
<mat-hint align="end"> {{ form().value?.length || 0 }} /{{ field.maxLength }}</mat-hint> | ||
} | ||
@if (form().errors; as errors) { | ||
<mat-error>{{ fe.errors(errors) }}</mat-error> | ||
} | ||
} | ||
@if (field.maxLength) { | ||
<mat-hint align="end"> {{ form().value?.length || 0 }} /{{ field.maxLength }}</mat-hint> | ||
} | ||
@if (form().errors; as errors) { | ||
<mat-error>{{ fe.errors(errors) }}</mat-error> | ||
} | ||
} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters