@sierra-95/svelte-scaffold 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/Hooks/layout_menu.d.ts +1 -0
- package/dist/Hooks/layout_menu.js +24 -0
- package/dist/Hooks/preview.d.ts +3 -0
- package/dist/Hooks/preview.js +24 -0
- package/dist/components/Core/Alerts/Backdrop/backdrop.svelte +27 -0
- package/dist/components/Core/Alerts/Backdrop/backdrop.svelte.d.ts +15 -0
- package/dist/components/Core/Alerts/Modal/modal.svelte +40 -0
- package/dist/components/Core/Alerts/Modal/modal.svelte.d.ts +26 -0
- package/dist/components/Core/Alerts/Toast/toast.css +39 -0
- package/dist/components/Core/Alerts/Toast/toast.svelte +32 -0
- package/dist/components/Core/Alerts/Toast/toast.svelte.d.ts +26 -0
- package/dist/components/Core/Alerts/Wrapper/wrapper.svelte +19 -0
- package/dist/components/Core/Alerts/Wrapper/wrapper.svelte.d.ts +17 -0
- package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte +34 -0
- package/dist/components/Core/Alerts/site-under-maintenance/site-under-maintenance.svelte.d.ts +11 -0
- package/dist/components/Core/Form/Hr/hr.svelte +11 -0
- package/dist/components/Core/Form/Hr/hr.svelte.d.ts +21 -0
- package/dist/components/Core/Form/Input/FileInput/fileInput.svelte +130 -0
- package/dist/components/Core/Form/Input/FileInput/fileInput.svelte.d.ts +6 -0
- package/dist/components/Core/Form/Input/FileInput/preview.svelte +38 -0
- package/dist/components/Core/Form/Input/FileInput/preview.svelte.d.ts +18 -0
- package/dist/components/Core/Form/Input/input/input.svelte +17 -0
- package/dist/components/Core/Form/Input/input/input.svelte.d.ts +24 -0
- package/dist/components/Core/Form/Input/password/password.svelte +27 -0
- package/dist/components/Core/Form/Input/password/password.svelte.d.ts +23 -0
- package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte +94 -0
- package/dist/components/Core/Menus/DropdownContainer/dropdown.svelte.d.ts +9 -0
- package/dist/components/Core/Menus/MenuItem/menuItem.svelte +44 -0
- package/dist/components/Core/Menus/MenuItem/menuItem.svelte.d.ts +10 -0
- package/dist/components/Core/Menus/UserMenu/profile.svelte +35 -0
- package/dist/components/Core/Menus/UserMenu/profile.svelte.d.ts +11 -0
- package/dist/components/Core/others/Button/Flip/button.css +51 -0
- package/dist/components/Core/others/Button/Flip/button.svelte +69 -0
- package/dist/components/Core/others/Button/Flip/button.svelte.d.ts +21 -0
- package/dist/components/Core/others/Button/Marquee/button.css +37 -0
- package/dist/components/Core/others/Button/Marquee/button.svelte +45 -0
- package/dist/components/Core/others/Button/Marquee/button.svelte.d.ts +9 -0
- package/dist/components/Core/others/Button/Swipe/button.css +31 -0
- package/dist/components/Core/others/Button/Swipe/button.svelte +45 -0
- package/dist/components/Core/others/Button/Swipe/button.svelte.d.ts +17 -0
- package/dist/components/Core/others/Button/default/button.css +52 -0
- package/dist/components/Core/others/Button/default/button.svelte +112 -0
- package/dist/components/Core/others/Button/default/button.svelte.d.ts +16 -0
- package/dist/components/Core/others/Button/select/select.svelte +29 -0
- package/dist/components/Core/others/Button/select/select.svelte.d.ts +3 -0
- package/dist/components/Core/others/Button/theme/theme.css +122 -0
- package/dist/components/Core/others/Button/theme/theme.svelte +68 -0
- package/dist/components/Core/others/Button/theme/theme.svelte.d.ts +19 -0
- package/dist/components/Core/others/Button/times/times.svelte +25 -0
- package/dist/components/Core/others/Button/times/times.svelte.d.ts +6 -0
- package/dist/components/Core/others/Clock/Date/date.svelte +25 -0
- package/dist/components/Core/others/Clock/Date/date.svelte.d.ts +20 -0
- package/dist/components/Core/others/Clock/Time/time.svelte +35 -0
- package/dist/components/Core/others/Clock/Time/time.svelte.d.ts +20 -0
- package/dist/components/Core/others/Previews/Audio/audio.svelte +62 -0
- package/dist/components/Core/others/Previews/Audio/audio.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Document/documents.svelte +25 -0
- package/dist/components/Core/others/Previews/Document/documents.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Image/image.svelte +27 -0
- package/dist/components/Core/others/Previews/Image/image.svelte.d.ts +22 -0
- package/dist/components/Core/others/Previews/Video/video.svelte +29 -0
- package/dist/components/Core/others/Previews/Video/video.svelte.d.ts +24 -0
- package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte +55 -0
- package/dist/components/Core/others/Progress/CircularProgress/CircularProgress.svelte.d.ts +15 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.css +61 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte +79 -0
- package/dist/components/Core/others/Progress/LinearProgress/LinearProgress.svelte.d.ts +26 -0
- package/dist/components/Modules/Editor/Hooks/extractContent.d.ts +7 -0
- package/dist/components/Modules/Editor/Hooks/extractContent.js +15 -0
- package/dist/components/Modules/Editor/Hooks/extractImage.d.ts +7 -0
- package/dist/components/Modules/Editor/Hooks/extractImage.js +30 -0
- package/dist/components/Modules/Editor/Hooks/insertImage.d.ts +5 -0
- package/dist/components/Modules/Editor/Hooks/insertImage.js +27 -0
- package/dist/components/Modules/Editor/Hooks/insertYoutube.d.ts +6 -0
- package/dist/components/Modules/Editor/Hooks/insertYoutube.js +35 -0
- package/dist/components/Modules/Editor/Marks/Links/links.svelte +79 -0
- package/dist/components/Modules/Editor/Marks/Links/links.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte +32 -0
- package/dist/components/Modules/Editor/Marks/TextFormatting/textFormatting.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte +58 -0
- package/dist/components/Modules/Editor/Nodes/Headings/heading.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/History/history.svelte +21 -0
- package/dist/components/Modules/Editor/Nodes/History/history.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Images/images.svelte +85 -0
- package/dist/components/Modules/Editor/Nodes/Images/images.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte +30 -0
- package/dist/components/Modules/Editor/Nodes/Lists/lists.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte +55 -0
- package/dist/components/Modules/Editor/Nodes/TextAlign/textAlign.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/styles.css +18 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte +88 -0
- package/dist/components/Modules/Editor/Nodes/TextColor/textColor.svelte.d.ts +22 -0
- package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte +32 -0
- package/dist/components/Modules/Editor/Nodes/Youtube/youtube.svelte.d.ts +21 -0
- package/dist/components/Modules/Editor/colors.d.ts +2 -0
- package/dist/components/Modules/Editor/colors.js +21 -0
- package/dist/components/Modules/Editor/controls.svelte +72 -0
- package/dist/components/Modules/Editor/controls.svelte.d.ts +24 -0
- package/dist/components/Modules/Editor/extensions.d.ts +1 -0
- package/dist/components/Modules/Editor/extensions.js +59 -0
- package/dist/components/Modules/Editor/main.svelte +42 -0
- package/dist/components/Modules/Editor/main.svelte.d.ts +25 -0
- package/dist/components/Modules/Editor/save.svelte +28 -0
- package/dist/components/Modules/Editor/save.svelte.d.ts +23 -0
- package/dist/components/Modules/Editor/styles/controls.css +70 -0
- package/dist/components/Modules/Editor/styles/main.css +43 -0
- package/dist/components/Modules/Editor/tools.d.ts +14 -0
- package/dist/components/Modules/Editor/tools.js +23 -0
- package/dist/components/Modules/FilePicker/cloudStore.svelte +96 -0
- package/dist/components/Modules/FilePicker/cloudStore.svelte.d.ts +20 -0
- package/dist/components/Modules/FilePicker/controls.svelte +122 -0
- package/dist/components/Modules/FilePicker/controls.svelte.d.ts +20 -0
- package/dist/components/Modules/FilePicker/filePicker.svelte +61 -0
- package/dist/components/Modules/FilePicker/filePicker.svelte.d.ts +18 -0
- package/dist/components/Modules/FilePicker/previews.svelte +19 -0
- package/dist/components/Modules/FilePicker/previews.svelte.d.ts +20 -0
- package/dist/components/Modules/Layout/Header/header.css +38 -0
- package/dist/components/Modules/Layout/Header/header.svelte +29 -0
- package/dist/components/Modules/Layout/Header/header.svelte.d.ts +21 -0
- package/dist/components/Modules/Layout/Menu/menu.css +45 -0
- package/dist/components/Modules/Layout/Menu/menu.svelte +129 -0
- package/dist/components/Modules/Layout/Menu/menu.svelte.d.ts +24 -0
- package/dist/components/Modules/Layout/background.svelte +28 -0
- package/dist/components/Modules/Layout/background.svelte.d.ts +26 -0
- package/dist/components/Modules/Layout/main.css +21 -0
- package/dist/components/Modules/Layout/main.svelte +119 -0
- package/dist/components/Modules/Layout/main.svelte.d.ts +27 -0
- package/dist/global.css +226 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +53 -0
- package/dist/stores/core/general.d.ts +3 -0
- package/dist/stores/core/general.js +5 -0
- package/dist/stores/core/ismobile.d.ts +1 -0
- package/dist/stores/core/ismobile.js +14 -0
- package/dist/stores/core/modal.d.ts +14 -0
- package/dist/stores/core/modal.js +35 -0
- package/dist/stores/core/user.d.ts +9 -0
- package/dist/stores/core/user.js +14 -0
- package/dist/stores/modules/editor.d.ts +9 -0
- package/dist/stores/modules/editor.js +14 -0
- package/dist/stores/modules/fileInput.d.ts +22 -0
- package/dist/stores/modules/fileInput.js +25 -0
- package/dist/stores/modules/toast.d.ts +8 -0
- package/dist/stores/modules/toast.js +21 -0
- package/package.json +75 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Heading: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Heading = InstanceType<typeof Heading>;
|
|
21
|
+
export default Heading;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Editor } from "@tiptap/core";
|
|
3
|
+
|
|
4
|
+
export let editor: Editor;
|
|
5
|
+
|
|
6
|
+
function undo() {
|
|
7
|
+
editor.chain().focus().undo().run();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function redo() {
|
|
11
|
+
editor.chain().focus().redo().run();
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<button on:click={undo} aria-label="Undo" title="Undo" disabled={!editor.can().undo()}>
|
|
16
|
+
<i class="fa fa-undo"></i>
|
|
17
|
+
</button>
|
|
18
|
+
|
|
19
|
+
<button on:click={redo} aria-label="Redo" title="Redo" disabled={!editor.can().redo()}>
|
|
20
|
+
<i class="fa fa-redo"></i>
|
|
21
|
+
</button>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const History: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type History = InstanceType<typeof History>;
|
|
21
|
+
export default History;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { insertImageAndMoveCursor } from '../../tools.js';
|
|
3
|
+
import {fileInputStore, resetFileInputStore, editorStore, setToastMessage, modalStore, Input, DropdownContainer, MenuItem} from '../../../../../index.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import type { Editor } from "@tiptap/core";
|
|
7
|
+
export let editor: Editor;
|
|
8
|
+
|
|
9
|
+
let openDropdown = false;
|
|
10
|
+
function handleInsertImage(){
|
|
11
|
+
if(
|
|
12
|
+
!$editorStore.r2_key ||
|
|
13
|
+
!$editorStore.serverGetUrl ||
|
|
14
|
+
!$editorStore.serverUploadUrl ||
|
|
15
|
+
!$editorStore.serverDeleteUrl
|
|
16
|
+
){
|
|
17
|
+
setToastMessage('error','File upload configuration is missing.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
fileInputStore.update(store => ({
|
|
21
|
+
...store,
|
|
22
|
+
uploadType: ['image'],
|
|
23
|
+
disabledMenuItem: ['Music', 'Videos', 'Documents'],
|
|
24
|
+
r2_key: $editorStore.r2_key,
|
|
25
|
+
serverGetUrl: $editorStore.serverGetUrl,
|
|
26
|
+
serverUploadUrl: $editorStore.serverUploadUrl,
|
|
27
|
+
serverDeleteUrl: $editorStore.serverDeleteUrl,
|
|
28
|
+
uploadModalOpen: true
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$: if (
|
|
33
|
+
$fileInputStore.submissionComplete &&
|
|
34
|
+
$fileInputStore.submissions.length > 0 &&
|
|
35
|
+
$fileInputStore.uploadModalOpen === false &&
|
|
36
|
+
editor
|
|
37
|
+
) {
|
|
38
|
+
const urlsToInsert = $fileInputStore.submissions.map(item => item.url);
|
|
39
|
+
|
|
40
|
+
for (const finalURL of urlsToInsert) {
|
|
41
|
+
insertImageAndMoveCursor(finalURL, editor);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
resetFileInputStore();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let value = ''
|
|
48
|
+
function enterURL(){
|
|
49
|
+
modalStore.update(m => ({
|
|
50
|
+
...m,
|
|
51
|
+
open: true,
|
|
52
|
+
title: 'Editor',
|
|
53
|
+
onConfirm: () => {
|
|
54
|
+
if (!isValidUrl(value)) {
|
|
55
|
+
setToastMessage('error', 'Please enter a valid image URL.');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
insertImageAndMoveCursor(value, editor);
|
|
59
|
+
value = ''
|
|
60
|
+
},
|
|
61
|
+
onCancel: () => { value = ''},
|
|
62
|
+
render: formContent
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
function isValidUrl(value: string): boolean {
|
|
66
|
+
try {
|
|
67
|
+
const url = new URL(value);
|
|
68
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
{#snippet formContent()}
|
|
75
|
+
<Input label="Enter Image URL" id="image-url" bind:value={value}/>
|
|
76
|
+
{/snippet}
|
|
77
|
+
<DropdownContainer bind:open={openDropdown} width="150px">
|
|
78
|
+
{#snippet dropdownTrigger()}
|
|
79
|
+
<button aria-label="Insert Image" title="Insert File" on:click={() => openDropdown = !openDropdown}>
|
|
80
|
+
<i class="fa fa-file"></i>
|
|
81
|
+
</button>
|
|
82
|
+
{/snippet}
|
|
83
|
+
<MenuItem onclick={() => { handleInsertImage(); openDropdown = false; }}>File Picker</MenuItem>
|
|
84
|
+
<MenuItem onclick={() => { enterURL(); openDropdown = false; }}>Enter URL</MenuItem>
|
|
85
|
+
</DropdownContainer>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Images: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Images = InstanceType<typeof Images>;
|
|
21
|
+
export default Images;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Editor } from "@tiptap/core";
|
|
3
|
+
export let editor: Editor;
|
|
4
|
+
|
|
5
|
+
const toggleBullet = () => {
|
|
6
|
+
editor.chain().focus().toggleBulletList().run();
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const toggleOrdered = () => {
|
|
10
|
+
editor.chain().focus().toggleOrderedList().run();
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div style="display: flex; gap: 0.5rem">
|
|
15
|
+
<button
|
|
16
|
+
aria-label="Bullet List"
|
|
17
|
+
title="Bullet List"
|
|
18
|
+
on:click={toggleBullet}
|
|
19
|
+
class="{editor?.isActive('bulletList') ? 'active' : ''}"
|
|
20
|
+
><i class="fa fa-list"></i>
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<button
|
|
24
|
+
aria-label="Ordered List"
|
|
25
|
+
title="Ordered List"
|
|
26
|
+
on:click={toggleOrdered}
|
|
27
|
+
class="{editor?.isActive('orderedList') ? 'active' : ''}"
|
|
28
|
+
><i class="fa fa-list-ol"></i>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Lists: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Lists = InstanceType<typeof Lists>;
|
|
21
|
+
export default Lists;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import type { Editor } from "@tiptap/core";
|
|
4
|
+
import {DropdownContainer, MenuItem} from '../../../../../index.js'
|
|
5
|
+
|
|
6
|
+
export let editor: Editor;
|
|
7
|
+
|
|
8
|
+
let open = false;
|
|
9
|
+
|
|
10
|
+
const alignments = [
|
|
11
|
+
{ value: 'left', label: 'Left' },
|
|
12
|
+
{ value: 'center', label: 'Center' },
|
|
13
|
+
{ value: 'right', label: 'Right' },
|
|
14
|
+
{ value: 'justify', label: 'Justify' },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
type AlignmentOption = {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function applyAlignment(option: AlignmentOption) {
|
|
23
|
+
editor?.chain().focus().setTextAlign(option.value).run();
|
|
24
|
+
}
|
|
25
|
+
onMount(() => {
|
|
26
|
+
applyAlignment({ value: 'left', label: 'Left' });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
$: currentAlignment = editor
|
|
30
|
+
? alignments.find(a => editor.isActive({ textAlign: a.value })) || alignments[0]
|
|
31
|
+
: alignments[0];
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
{#if editor}
|
|
36
|
+
<DropdownContainer bind:open>
|
|
37
|
+
{#snippet dropdownTrigger()}
|
|
38
|
+
<button aria-label="Text Align Options" on:click={() => (open = !open)}>
|
|
39
|
+
<i class="fa-solid fa-align-{currentAlignment.value}"></i>
|
|
40
|
+
</button>
|
|
41
|
+
{/snippet}
|
|
42
|
+
{#each alignments as { value, label }}
|
|
43
|
+
<MenuItem
|
|
44
|
+
icon= "fa-align-{value}"
|
|
45
|
+
active={editor.isActive({ textAlign: value })}
|
|
46
|
+
onclick={() => {
|
|
47
|
+
applyAlignment({ value, label });
|
|
48
|
+
open = false;
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{label}
|
|
52
|
+
</MenuItem>
|
|
53
|
+
{/each}
|
|
54
|
+
</DropdownContainer>
|
|
55
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const TextAlign: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type TextAlign = InstanceType<typeof TextAlign>;
|
|
21
|
+
export default TextAlign;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#editor-text-color .text-color-selector-dropdown {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(6, 1fr);
|
|
4
|
+
gap: 5px;
|
|
5
|
+
padding: 5px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#editor-text-color .color-swatch {
|
|
9
|
+
width: 20px;
|
|
10
|
+
height: 20px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
border-radius: 50%;
|
|
13
|
+
transition: transform 0.1s ease-in-out;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#editor-text-color .color-swatch:hover {
|
|
17
|
+
transform: scale(1.1);
|
|
18
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import './styles.css';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import {theme, DropdownContainer} from '../../../../../index.js';
|
|
5
|
+
import colors from '../../colors.js';
|
|
6
|
+
|
|
7
|
+
import type { Editor } from "@tiptap/core";
|
|
8
|
+
export let editor: Editor;
|
|
9
|
+
|
|
10
|
+
let textColor: HTMLDivElement;
|
|
11
|
+
let highlightColor = '#ffe066';
|
|
12
|
+
let textColorDropdown = false;
|
|
13
|
+
let highlightDropdown = false;
|
|
14
|
+
|
|
15
|
+
onMount(() => {
|
|
16
|
+
if (!editor) return;
|
|
17
|
+
const value = $theme === 'dark' ? '#ffffff' : '#000000';
|
|
18
|
+
editor.chain().focus().setColor(value).run();
|
|
19
|
+
textColor.style.backgroundColor = value;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function applyColor(color: string) {
|
|
23
|
+
editor.chain().focus().setColor(color).run();
|
|
24
|
+
textColor.style.backgroundColor = color;
|
|
25
|
+
textColorDropdown = false;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if editor}
|
|
30
|
+
|
|
31
|
+
<main id="editor-text-color" style="display: flex; gap: 0.5rem; align-items: center;">
|
|
32
|
+
<DropdownContainer bind:open={textColorDropdown}>
|
|
33
|
+
{#snippet dropdownTrigger()}
|
|
34
|
+
<button aria-label="Text Color" title="Color" on:click={() => textColorDropdown = !textColorDropdown}>
|
|
35
|
+
<i class="fa fa-font"></i>
|
|
36
|
+
<div bind:this={textColor} style="height: 3px; border-radius: 0.3125rem;"></div>
|
|
37
|
+
</button>
|
|
38
|
+
{/snippet}
|
|
39
|
+
{#if textColorDropdown}
|
|
40
|
+
<div class="text-color-selector-dropdown ">
|
|
41
|
+
{#each colors as color}
|
|
42
|
+
<div
|
|
43
|
+
role="none"
|
|
44
|
+
class="color-swatch"
|
|
45
|
+
style="background-color: {color};"
|
|
46
|
+
on:click={() => applyColor(color)}
|
|
47
|
+
></div>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
</DropdownContainer>
|
|
52
|
+
|
|
53
|
+
<div style="display: flex;">
|
|
54
|
+
<button
|
|
55
|
+
aria-label="Highlight"
|
|
56
|
+
title="Highlight"
|
|
57
|
+
class="{editor.isActive('highlight') ? 'active' : ''}"
|
|
58
|
+
on:click={() => editor.chain().focus().toggleHighlight().run()}
|
|
59
|
+
style={editor.isActive('highlight') ? `background-color: ${highlightColor};` : ''}
|
|
60
|
+
>
|
|
61
|
+
<i class="fa fa-font"></i>
|
|
62
|
+
</button>
|
|
63
|
+
<DropdownContainer bind:open={highlightDropdown}>
|
|
64
|
+
{#snippet dropdownTrigger()}
|
|
65
|
+
<button aria-label="Highlight Color" on:click={() => highlightDropdown = !highlightDropdown}>
|
|
66
|
+
<i class="fa fa-chevron-down {highlightDropdown ? 'active' : ''}"></i>
|
|
67
|
+
</button>
|
|
68
|
+
{/snippet}
|
|
69
|
+
{#if highlightDropdown}
|
|
70
|
+
<div class="text-color-selector-dropdown">
|
|
71
|
+
{#each colors as color}
|
|
72
|
+
<div
|
|
73
|
+
role="none"
|
|
74
|
+
class="color-swatch"
|
|
75
|
+
style="background-color: {color};"
|
|
76
|
+
on:click={() => {
|
|
77
|
+
editor.chain().focus().setHighlight({ color }).run();
|
|
78
|
+
highlightDropdown = false;
|
|
79
|
+
highlightColor = color;
|
|
80
|
+
}}
|
|
81
|
+
></div>
|
|
82
|
+
{/each}
|
|
83
|
+
</div>
|
|
84
|
+
{/if}
|
|
85
|
+
</DropdownContainer>
|
|
86
|
+
</div>
|
|
87
|
+
</main>
|
|
88
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import './styles.css';
|
|
2
|
+
import type { Editor } from "@tiptap/core";
|
|
3
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
13
|
+
};
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
15
|
+
}
|
|
16
|
+
declare const TextColor: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
editor: Editor;
|
|
18
|
+
}, {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
}, {}, {}, string>;
|
|
21
|
+
type TextColor = InstanceType<typeof TextColor>;
|
|
22
|
+
export default TextColor;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {modalStore, Input} from '../../../../../index.js';
|
|
3
|
+
import {addYoutubeVideo} from '../../tools.js';
|
|
4
|
+
|
|
5
|
+
import type { Editor } from "@tiptap/core";
|
|
6
|
+
export let editor: Editor;
|
|
7
|
+
|
|
8
|
+
let youtubeUrl = '';
|
|
9
|
+
function triggerModal() {
|
|
10
|
+
modalStore.update(m => ({
|
|
11
|
+
...m,
|
|
12
|
+
open: true,
|
|
13
|
+
title: 'Editor',
|
|
14
|
+
onConfirm: () => {
|
|
15
|
+
addYoutubeVideo(editor, youtubeUrl);
|
|
16
|
+
youtubeUrl = '';
|
|
17
|
+
},
|
|
18
|
+
render: addYoutubeContent
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#snippet addYoutubeContent()}
|
|
24
|
+
<Input label="Enter Youtube URL" id="youtube-url" bind:value={youtubeUrl}/>
|
|
25
|
+
{/snippet}
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
aria-label="Youtube URL"
|
|
29
|
+
on:click={() => triggerModal()}
|
|
30
|
+
title="Insert YouTube video">
|
|
31
|
+
<i class="fa fa-youtube-play"></i>
|
|
32
|
+
</button>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Youtube: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
editor: Editor;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Youtube = InstanceType<typeof Youtube>;
|
|
21
|
+
export default Youtube;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const colors = [
|
|
2
|
+
// Grayscale
|
|
3
|
+
'#000000', '#2E2E2E', '#595959', '#7F7F7F', '#A6A6A6', '#D9D9D9',
|
|
4
|
+
|
|
5
|
+
// Reds
|
|
6
|
+
'#7F1D1D', '#991B1B', '#B91C1C', '#DC2626', '#EF4444', '#F87171',
|
|
7
|
+
|
|
8
|
+
// Oranges / Browns
|
|
9
|
+
'#78350F', '#92400E', '#A16207', '#D97706', '#F59E0B', '#FDBA74',
|
|
10
|
+
|
|
11
|
+
// Yellows / Golds
|
|
12
|
+
'#854D0E', '#A16207', '#CA8A04', '#EAB308', '#FACC15', '#FEF08A',
|
|
13
|
+
|
|
14
|
+
// Greens
|
|
15
|
+
'#14532D', '#166534', '#15803D', '#16A34A', '#22C55E', '#86EFAC',
|
|
16
|
+
|
|
17
|
+
// Blues
|
|
18
|
+
'#1E3A8A', '#1D4ED8', '#2563EB', '#3B82F6', '#60A5FA', '#93C5FD',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export default colors;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
TextFormatting, Headings, TextColor, TextAlign, Images, History, Youtube,
|
|
4
|
+
Save, Lists, Links
|
|
5
|
+
} from './tools.js';
|
|
6
|
+
import type { Editor } from "@tiptap/core";
|
|
7
|
+
import './styles/controls.css';
|
|
8
|
+
|
|
9
|
+
export let editor: Editor;
|
|
10
|
+
export let exportText: string;
|
|
11
|
+
export let content: any = {};
|
|
12
|
+
|
|
13
|
+
const menuItems = [
|
|
14
|
+
{
|
|
15
|
+
id: 'home',
|
|
16
|
+
label: 'Home',
|
|
17
|
+
icon: 'fa-home',
|
|
18
|
+
components: [
|
|
19
|
+
TextFormatting,
|
|
20
|
+
History,
|
|
21
|
+
Headings,
|
|
22
|
+
TextColor,
|
|
23
|
+
TextAlign,
|
|
24
|
+
Lists,
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'insert',
|
|
29
|
+
label: 'Insert',
|
|
30
|
+
icon: 'fa-plus',
|
|
31
|
+
components: [
|
|
32
|
+
Images,
|
|
33
|
+
Links,
|
|
34
|
+
Youtube,
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
type MenuItem = typeof menuItems[number];
|
|
40
|
+
type MenuId = MenuItem['id'];
|
|
41
|
+
|
|
42
|
+
let activeTab: MenuId = 'home';
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<main id="controls">
|
|
47
|
+
<div class="controls-menu" style="display: flex; gap: 0.5rem;"
|
|
48
|
+
>
|
|
49
|
+
<Save bind:content {exportText} {editor} />
|
|
50
|
+
{#each menuItems as item, index (item.id)}
|
|
51
|
+
<button
|
|
52
|
+
class={` ${activeTab === item.id ? 'active' : ''}`}
|
|
53
|
+
on:click={() => {activeTab = item.id}}
|
|
54
|
+
>
|
|
55
|
+
<i class="fa {item.icon}"></i>
|
|
56
|
+
<span>{item.label}</span>
|
|
57
|
+
</button>
|
|
58
|
+
{/each}
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="controls">
|
|
62
|
+
{#each menuItems as item, index (item.id)}
|
|
63
|
+
<div class={`controls-buttons
|
|
64
|
+
${activeTab === item.id ? 'active' : ''}
|
|
65
|
+
`}>
|
|
66
|
+
{#each item.components as Component}
|
|
67
|
+
<Component {editor} />
|
|
68
|
+
{/each}
|
|
69
|
+
</div>
|
|
70
|
+
{/each}
|
|
71
|
+
</div>
|
|
72
|
+
</main>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import './styles/controls.css';
|
|
3
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
13
|
+
};
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
15
|
+
}
|
|
16
|
+
declare const Controls: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
editor: Editor;
|
|
18
|
+
exportText: string;
|
|
19
|
+
content?: any;
|
|
20
|
+
}, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type Controls = InstanceType<typeof Controls>;
|
|
24
|
+
export default Controls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const extensions: (import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-style").ColorOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-align").TextAlignOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-heading").HeadingOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-youtube").YoutubeOptions, any>)[];
|