urpanels-ui-pack 0.0.2
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 +37 -0
- package/dist/Button/Button.svelte +76 -0
- package/dist/Button/Button.svelte.d.ts +13 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +1 -0
- package/dist/InfoCard/InfoCard.svelte +227 -0
- package/dist/InfoCard/InfoCard.svelte.d.ts +4 -0
- package/dist/InfoCard/InfoCard.types.d.ts +56 -0
- package/dist/InfoCard/InfoCard.types.js +1 -0
- package/dist/InfoCard/index.d.ts +2 -0
- package/dist/InfoCard/index.js +1 -0
- package/dist/LoadingSpinner/LoadingSpinner.svelte +3 -0
- package/dist/LoadingSpinner/LoadingSpinner.svelte.d.ts +26 -0
- package/dist/LoadingSpinner/index.d.ts +1 -0
- package/dist/LoadingSpinner/index.js +1 -0
- package/dist/Modal/Modal.svelte +122 -0
- package/dist/Modal/Modal.svelte.d.ts +39 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +1 -0
- package/dist/PageLayout/ActionButton.svelte +26 -0
- package/dist/PageLayout/ActionButton.svelte.d.ts +8 -0
- package/dist/PageLayout/PageContent.svelte +19 -0
- package/dist/PageLayout/PageContent.svelte.d.ts +8 -0
- package/dist/PageLayout/PageHeader.svelte +29 -0
- package/dist/PageLayout/PageHeader.svelte.d.ts +9 -0
- package/dist/PageLayout/SearchBar.svelte +25 -0
- package/dist/PageLayout/SearchBar.svelte.d.ts +8 -0
- package/dist/PageLayout/ViewToggle.svelte +53 -0
- package/dist/PageLayout/ViewToggle.svelte.d.ts +8 -0
- package/dist/PageLayout/index.d.ts +5 -0
- package/dist/PageLayout/index.js +5 -0
- package/dist/Pagination/Pagination.svelte +96 -0
- package/dist/Pagination/Pagination.svelte.d.ts +4 -0
- package/dist/Pagination/Pagination.types.d.ts +11 -0
- package/dist/Pagination/Pagination.types.js +1 -0
- package/dist/Pagination/index.d.ts +2 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/RichTextEditor/RichTextEditor.svelte +575 -0
- package/dist/RichTextEditor/RichTextEditor.svelte.d.ts +10 -0
- package/dist/RichTextEditor/index.d.ts +1 -0
- package/dist/RichTextEditor/index.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -0
- package/dist/sections/ArticlesGrid/ArticlesGrid.svelte +201 -0
- package/dist/sections/ArticlesGrid/ArticlesGrid.svelte.d.ts +31 -0
- package/dist/sections/ArticlesGrid/README.md +229 -0
- package/dist/sections/ArticlesGrid/index.d.ts +2 -0
- package/dist/sections/ArticlesGrid/index.js +1 -0
- package/dist/sections/FeaturedGalleryGrid/FeaturedGalleryGrid.svelte +118 -0
- package/dist/sections/FeaturedGalleryGrid/FeaturedGalleryGrid.svelte.d.ts +21 -0
- package/dist/sections/FeaturedGalleryGrid/README.md +270 -0
- package/dist/sections/FeaturedGalleryGrid/index.d.ts +2 -0
- package/dist/sections/FeaturedGalleryGrid/index.js +1 -0
- package/dist/sections/HeroCarousel/HeroCarousel.svelte +318 -0
- package/dist/sections/HeroCarousel/HeroCarousel.svelte.d.ts +23 -0
- package/dist/sections/HeroCarousel/index.d.ts +1 -0
- package/dist/sections/HeroCarousel/index.js +1 -0
- package/dist/sections/index.d.ts +5 -0
- package/dist/sections/index.js +3 -0
- package/dist/utils/translations.svelte.d.ts +37 -0
- package/dist/utils/translations.svelte.js +67 -0
- package/package.json +47 -0
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy } from 'svelte';
|
|
3
|
+
import { Editor } from '@tiptap/core';
|
|
4
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
5
|
+
import { Table } from '@tiptap/extension-table';
|
|
6
|
+
import { TableRow } from '@tiptap/extension-table-row';
|
|
7
|
+
import { TableCell } from '@tiptap/extension-table-cell';
|
|
8
|
+
import { TableHeader } from '@tiptap/extension-table-header';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
content?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
onchange?: (html: string) => void;
|
|
14
|
+
minHeight?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
content = '',
|
|
20
|
+
placeholder = 'İçeriğinizi buraya yazın...',
|
|
21
|
+
onchange,
|
|
22
|
+
minHeight = '200px',
|
|
23
|
+
disabled = false
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
let editorElement: HTMLElement;
|
|
27
|
+
let editor: Editor | null = $state(null);
|
|
28
|
+
|
|
29
|
+
// Toolbar button states
|
|
30
|
+
let isBold = $state(false);
|
|
31
|
+
let isItalic = $state(false);
|
|
32
|
+
let isStrike = $state(false);
|
|
33
|
+
let isBulletList = $state(false);
|
|
34
|
+
let isOrderedList = $state(false);
|
|
35
|
+
let isBlockquote = $state(false);
|
|
36
|
+
let currentHeading = $state(0);
|
|
37
|
+
let isInTable = $state(false);
|
|
38
|
+
|
|
39
|
+
// Word'den gelen kirli HTML'i temizle
|
|
40
|
+
function cleanWordHtml(html: string): string {
|
|
41
|
+
// MSO (Microsoft Office) class ve style'larını temizle
|
|
42
|
+
let cleaned = html
|
|
43
|
+
// MSO specific tags
|
|
44
|
+
.replace(/<o:p[^>]*>[\s\S]*?<\/o:p>/gi, '')
|
|
45
|
+
// MSO class'ları
|
|
46
|
+
.replace(/class="?Mso[^">\s]+"?/gi, '')
|
|
47
|
+
// MSO style'ları
|
|
48
|
+
.replace(/style="[^"]*mso-[^"]*"/gi, '')
|
|
49
|
+
// Inline style'ları temizle (font-family, font-size, color vs.)
|
|
50
|
+
.replace(/style="[^"]*"/gi, '')
|
|
51
|
+
// Boş span'ları temizle
|
|
52
|
+
.replace(/<span[^>]*>\s*<\/span>/gi, '')
|
|
53
|
+
// Gereksiz attribute'ları temizle
|
|
54
|
+
.replace(/\s+(lang|xml:lang|class)="[^"]*"/gi, '')
|
|
55
|
+
// Birden fazla boşluğu tek boşluğa indir
|
|
56
|
+
.replace(/\s+/g, ' ')
|
|
57
|
+
// Boş paragraph'ları temizle
|
|
58
|
+
.replace(/<p[^>]*>\s*( )?\s*<\/p>/gi, '')
|
|
59
|
+
// karakterlerini normal boşluğa çevir (ardışık olanlar hariç)
|
|
60
|
+
.replace(/( )+/g, ' ')
|
|
61
|
+
// Trim
|
|
62
|
+
.trim();
|
|
63
|
+
|
|
64
|
+
return cleaned;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function updateToolbarState() {
|
|
68
|
+
if (!editor) return;
|
|
69
|
+
|
|
70
|
+
isBold = editor.isActive('bold');
|
|
71
|
+
isItalic = editor.isActive('italic');
|
|
72
|
+
isStrike = editor.isActive('strike');
|
|
73
|
+
isBulletList = editor.isActive('bulletList');
|
|
74
|
+
isOrderedList = editor.isActive('orderedList');
|
|
75
|
+
isBlockquote = editor.isActive('blockquote');
|
|
76
|
+
isInTable = editor.isActive('table');
|
|
77
|
+
|
|
78
|
+
if (editor.isActive('heading', { level: 1 })) currentHeading = 1;
|
|
79
|
+
else if (editor.isActive('heading', { level: 2 })) currentHeading = 2;
|
|
80
|
+
else if (editor.isActive('heading', { level: 3 })) currentHeading = 3;
|
|
81
|
+
else currentHeading = 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onMount(() => {
|
|
85
|
+
editor = new Editor({
|
|
86
|
+
element: editorElement,
|
|
87
|
+
extensions: [
|
|
88
|
+
StarterKit.configure({
|
|
89
|
+
heading: {
|
|
90
|
+
levels: [1, 2, 3]
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
Table.configure({
|
|
94
|
+
resizable: true,
|
|
95
|
+
HTMLAttributes: {
|
|
96
|
+
class: 'editor-table'
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
TableRow,
|
|
100
|
+
TableHeader,
|
|
101
|
+
TableCell
|
|
102
|
+
],
|
|
103
|
+
content: content,
|
|
104
|
+
editable: !disabled,
|
|
105
|
+
editorProps: {
|
|
106
|
+
attributes: {
|
|
107
|
+
class: 'prose prose-sm max-w-none focus:outline-none',
|
|
108
|
+
style: `min-height: ${minHeight}; padding: 1rem;`
|
|
109
|
+
},
|
|
110
|
+
// Word paste handler
|
|
111
|
+
transformPastedHTML(html) {
|
|
112
|
+
return cleanWordHtml(html);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onUpdate: ({ editor }) => {
|
|
116
|
+
const html = editor.getHTML();
|
|
117
|
+
onchange?.(html);
|
|
118
|
+
},
|
|
119
|
+
onSelectionUpdate: () => {
|
|
120
|
+
updateToolbarState();
|
|
121
|
+
},
|
|
122
|
+
onTransaction: () => {
|
|
123
|
+
updateToolbarState();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
updateToolbarState();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
onDestroy(() => {
|
|
131
|
+
editor?.destroy();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Content değişirse editörü güncelle
|
|
135
|
+
$effect(() => {
|
|
136
|
+
if (editor && content !== editor.getHTML()) {
|
|
137
|
+
editor.commands.setContent(content);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Toolbar actions
|
|
142
|
+
function toggleBold() {
|
|
143
|
+
editor?.chain().focus().toggleBold().run();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function toggleItalic() {
|
|
147
|
+
editor?.chain().focus().toggleItalic().run();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function toggleStrike() {
|
|
151
|
+
editor?.chain().focus().toggleStrike().run();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function toggleBulletList() {
|
|
155
|
+
editor?.chain().focus().toggleBulletList().run();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function toggleOrderedList() {
|
|
159
|
+
editor?.chain().focus().toggleOrderedList().run();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function toggleBlockquote() {
|
|
163
|
+
editor?.chain().focus().toggleBlockquote().run();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function setHeading(level: 0 | 1 | 2 | 3) {
|
|
167
|
+
if (level === 0) {
|
|
168
|
+
editor?.chain().focus().setParagraph().run();
|
|
169
|
+
} else {
|
|
170
|
+
editor?.chain().focus().toggleHeading({ level }).run();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function clearFormatting() {
|
|
175
|
+
editor?.chain().focus().clearNodes().unsetAllMarks().run();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function undo() {
|
|
179
|
+
editor?.chain().focus().undo().run();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function redo() {
|
|
183
|
+
editor?.chain().focus().redo().run();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Table actions
|
|
187
|
+
function insertTable() {
|
|
188
|
+
editor?.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function addColumnBefore() {
|
|
192
|
+
editor?.chain().focus().addColumnBefore().run();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function addColumnAfter() {
|
|
196
|
+
editor?.chain().focus().addColumnAfter().run();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function deleteColumn() {
|
|
200
|
+
editor?.chain().focus().deleteColumn().run();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function addRowBefore() {
|
|
204
|
+
editor?.chain().focus().addRowBefore().run();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function addRowAfter() {
|
|
208
|
+
editor?.chain().focus().addRowAfter().run();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function deleteRow() {
|
|
212
|
+
editor?.chain().focus().deleteRow().run();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function deleteTable() {
|
|
216
|
+
editor?.chain().focus().deleteTable().run();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function mergeCells() {
|
|
220
|
+
editor?.chain().focus().mergeCells().run();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function splitCell() {
|
|
224
|
+
editor?.chain().focus().splitCell().run();
|
|
225
|
+
}
|
|
226
|
+
</script>
|
|
227
|
+
|
|
228
|
+
<div class="rich-text-editor rounded-lg border border-gray-300 bg-white">
|
|
229
|
+
<!-- Toolbar -->
|
|
230
|
+
{#if !disabled}
|
|
231
|
+
<div class="flex flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 p-2">
|
|
232
|
+
<!-- Undo/Redo -->
|
|
233
|
+
<div class="flex items-center gap-1 border-r border-gray-300 pr-2">
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
onclick={undo}
|
|
237
|
+
class="rounded p-1.5 text-gray-600 hover:bg-gray-200"
|
|
238
|
+
title="Geri Al"
|
|
239
|
+
>
|
|
240
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
241
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" />
|
|
242
|
+
</svg>
|
|
243
|
+
</button>
|
|
244
|
+
<button
|
|
245
|
+
type="button"
|
|
246
|
+
onclick={redo}
|
|
247
|
+
class="rounded p-1.5 text-gray-600 hover:bg-gray-200"
|
|
248
|
+
title="Yinele"
|
|
249
|
+
>
|
|
250
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
251
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 10h-10a8 8 0 00-8 8v2M21 10l-6 6m6-6l-6-6" />
|
|
252
|
+
</svg>
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<!-- Heading Selector -->
|
|
257
|
+
<div class="border-r border-gray-300 pr-2">
|
|
258
|
+
<select
|
|
259
|
+
onchange={(e) => setHeading(parseInt(e.currentTarget.value) as 0 | 1 | 2 | 3)}
|
|
260
|
+
class="rounded border border-gray-300 bg-white px-2 py-1 text-sm"
|
|
261
|
+
value={currentHeading}
|
|
262
|
+
>
|
|
263
|
+
<option value="0">Normal</option>
|
|
264
|
+
<option value="1">Başlık 1</option>
|
|
265
|
+
<option value="2">Başlık 2</option>
|
|
266
|
+
<option value="3">Başlık 3</option>
|
|
267
|
+
</select>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
<!-- Text Formatting -->
|
|
271
|
+
<div class="flex items-center gap-1 border-r border-gray-300 pr-2">
|
|
272
|
+
<button
|
|
273
|
+
type="button"
|
|
274
|
+
onclick={toggleBold}
|
|
275
|
+
class="rounded p-1.5 font-bold {isBold ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
276
|
+
title="Kalın (Ctrl+B)"
|
|
277
|
+
>
|
|
278
|
+
B
|
|
279
|
+
</button>
|
|
280
|
+
<button
|
|
281
|
+
type="button"
|
|
282
|
+
onclick={toggleItalic}
|
|
283
|
+
class="rounded p-1.5 italic {isItalic ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
284
|
+
title="İtalik (Ctrl+I)"
|
|
285
|
+
>
|
|
286
|
+
I
|
|
287
|
+
</button>
|
|
288
|
+
<button
|
|
289
|
+
type="button"
|
|
290
|
+
onclick={toggleStrike}
|
|
291
|
+
class="rounded p-1.5 line-through {isStrike ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
292
|
+
title="Üstü Çizili"
|
|
293
|
+
>
|
|
294
|
+
S
|
|
295
|
+
</button>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<!-- Lists -->
|
|
299
|
+
<div class="flex items-center gap-1 border-r border-gray-300 pr-2">
|
|
300
|
+
<button
|
|
301
|
+
type="button"
|
|
302
|
+
onclick={toggleBulletList}
|
|
303
|
+
class="rounded p-1.5 {isBulletList ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
304
|
+
title="Madde İşaretli Liste"
|
|
305
|
+
>
|
|
306
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
307
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
|
308
|
+
</svg>
|
|
309
|
+
</button>
|
|
310
|
+
<button
|
|
311
|
+
type="button"
|
|
312
|
+
onclick={toggleOrderedList}
|
|
313
|
+
class="rounded p-1.5 {isOrderedList ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
314
|
+
title="Numaralı Liste"
|
|
315
|
+
>
|
|
316
|
+
<svg class="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
|
|
317
|
+
<text x="2" y="8" font-size="8" font-weight="bold">1.</text>
|
|
318
|
+
<text x="2" y="16" font-size="8" font-weight="bold">2.</text>
|
|
319
|
+
<text x="2" y="24" font-size="8" font-weight="bold">3.</text>
|
|
320
|
+
<line x1="12" y1="5" x2="22" y2="5" stroke="currentColor" stroke-width="2"/>
|
|
321
|
+
<line x1="12" y1="12" x2="22" y2="12" stroke="currentColor" stroke-width="2"/>
|
|
322
|
+
<line x1="12" y1="19" x2="22" y2="19" stroke="currentColor" stroke-width="2"/>
|
|
323
|
+
</svg>
|
|
324
|
+
</button>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<!-- Blockquote -->
|
|
328
|
+
<div class="flex items-center gap-1 border-r border-gray-300 pr-2">
|
|
329
|
+
<button
|
|
330
|
+
type="button"
|
|
331
|
+
onclick={toggleBlockquote}
|
|
332
|
+
class="rounded p-1.5 {isBlockquote ? 'bg-blue-100 text-blue-600' : 'text-gray-600 hover:bg-gray-200'}"
|
|
333
|
+
title="Alıntı"
|
|
334
|
+
>
|
|
335
|
+
<svg class="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
|
|
336
|
+
<path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/>
|
|
337
|
+
</svg>
|
|
338
|
+
</button>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<!-- Table -->
|
|
342
|
+
<div class="flex items-center gap-1 border-r border-gray-300 pr-2">
|
|
343
|
+
{#if !isInTable}
|
|
344
|
+
<button
|
|
345
|
+
type="button"
|
|
346
|
+
onclick={insertTable}
|
|
347
|
+
class="rounded p-1.5 text-gray-600 hover:bg-gray-200"
|
|
348
|
+
title="Tablo Ekle"
|
|
349
|
+
>
|
|
350
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
351
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 14h18M10 3v18M14 3v18M3 6a3 3 0 013-3h12a3 3 0 013 3v12a3 3 0 01-3 3H6a3 3 0 01-3-3V6z" />
|
|
352
|
+
</svg>
|
|
353
|
+
</button>
|
|
354
|
+
{:else}
|
|
355
|
+
<!-- Table controls when inside table -->
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
onclick={addColumnBefore}
|
|
359
|
+
class="rounded p-1 text-xs text-gray-600 hover:bg-gray-200"
|
|
360
|
+
title="Sola Sütun Ekle"
|
|
361
|
+
>
|
|
362
|
+
←+
|
|
363
|
+
</button>
|
|
364
|
+
<button
|
|
365
|
+
type="button"
|
|
366
|
+
onclick={addColumnAfter}
|
|
367
|
+
class="rounded p-1 text-xs text-gray-600 hover:bg-gray-200"
|
|
368
|
+
title="Sağa Sütun Ekle"
|
|
369
|
+
>
|
|
370
|
+
+→
|
|
371
|
+
</button>
|
|
372
|
+
<button
|
|
373
|
+
type="button"
|
|
374
|
+
onclick={addRowBefore}
|
|
375
|
+
class="rounded p-1 text-xs text-gray-600 hover:bg-gray-200"
|
|
376
|
+
title="Üste Satır Ekle"
|
|
377
|
+
>
|
|
378
|
+
↑+
|
|
379
|
+
</button>
|
|
380
|
+
<button
|
|
381
|
+
type="button"
|
|
382
|
+
onclick={addRowAfter}
|
|
383
|
+
class="rounded p-1 text-xs text-gray-600 hover:bg-gray-200"
|
|
384
|
+
title="Alta Satır Ekle"
|
|
385
|
+
>
|
|
386
|
+
+↓
|
|
387
|
+
</button>
|
|
388
|
+
<button
|
|
389
|
+
type="button"
|
|
390
|
+
onclick={deleteColumn}
|
|
391
|
+
class="rounded p-1 text-xs text-red-600 hover:bg-red-100"
|
|
392
|
+
title="Sütunu Sil"
|
|
393
|
+
>
|
|
394
|
+
|✕
|
|
395
|
+
</button>
|
|
396
|
+
<button
|
|
397
|
+
type="button"
|
|
398
|
+
onclick={deleteRow}
|
|
399
|
+
class="rounded p-1 text-xs text-red-600 hover:bg-red-100"
|
|
400
|
+
title="Satırı Sil"
|
|
401
|
+
>
|
|
402
|
+
—✕
|
|
403
|
+
</button>
|
|
404
|
+
<button
|
|
405
|
+
type="button"
|
|
406
|
+
onclick={deleteTable}
|
|
407
|
+
class="rounded p-1 text-xs text-red-600 hover:bg-red-100"
|
|
408
|
+
title="Tabloyu Sil"
|
|
409
|
+
>
|
|
410
|
+
🗑️
|
|
411
|
+
</button>
|
|
412
|
+
{/if}
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<!-- Clear Formatting -->
|
|
416
|
+
<div class="flex items-center gap-1">
|
|
417
|
+
<button
|
|
418
|
+
type="button"
|
|
419
|
+
onclick={clearFormatting}
|
|
420
|
+
class="rounded p-1.5 text-gray-600 hover:bg-gray-200"
|
|
421
|
+
title="Formatı Temizle"
|
|
422
|
+
>
|
|
423
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
424
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
425
|
+
</svg>
|
|
426
|
+
</button>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
{/if}
|
|
430
|
+
|
|
431
|
+
<!-- Editor Content -->
|
|
432
|
+
<div
|
|
433
|
+
bind:this={editorElement}
|
|
434
|
+
class="editor-content"
|
|
435
|
+
class:opacity-60={disabled}
|
|
436
|
+
></div>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<style>
|
|
440
|
+
.editor-content :global(.ProseMirror) {
|
|
441
|
+
outline: none;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.editor-content :global(.ProseMirror p) {
|
|
445
|
+
margin: 0.5em 0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.editor-content :global(.ProseMirror h1) {
|
|
449
|
+
font-size: 1.875rem;
|
|
450
|
+
font-weight: 700;
|
|
451
|
+
margin: 1em 0 0.5em;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.editor-content :global(.ProseMirror h2) {
|
|
455
|
+
font-size: 1.5rem;
|
|
456
|
+
font-weight: 600;
|
|
457
|
+
margin: 0.75em 0 0.5em;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.editor-content :global(.ProseMirror h3) {
|
|
461
|
+
font-size: 1.25rem;
|
|
462
|
+
font-weight: 600;
|
|
463
|
+
margin: 0.5em 0 0.25em;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.editor-content :global(.ProseMirror ul) {
|
|
467
|
+
list-style-type: disc;
|
|
468
|
+
padding-left: 1.5em;
|
|
469
|
+
margin: 0.5em 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.editor-content :global(.ProseMirror ol) {
|
|
473
|
+
list-style-type: decimal;
|
|
474
|
+
padding-left: 1.5em;
|
|
475
|
+
margin: 0.5em 0;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.editor-content :global(.ProseMirror li) {
|
|
479
|
+
margin: 0.25em 0;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.editor-content :global(.ProseMirror blockquote) {
|
|
483
|
+
border-left: 3px solid #e5e7eb;
|
|
484
|
+
padding-left: 1em;
|
|
485
|
+
margin: 0.5em 0;
|
|
486
|
+
color: #6b7280;
|
|
487
|
+
font-style: italic;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.editor-content :global(.ProseMirror code) {
|
|
491
|
+
background-color: #f3f4f6;
|
|
492
|
+
padding: 0.125em 0.25em;
|
|
493
|
+
border-radius: 0.25em;
|
|
494
|
+
font-family: monospace;
|
|
495
|
+
font-size: 0.875em;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.editor-content :global(.ProseMirror pre) {
|
|
499
|
+
background-color: #1f2937;
|
|
500
|
+
color: #f9fafb;
|
|
501
|
+
padding: 1em;
|
|
502
|
+
border-radius: 0.5em;
|
|
503
|
+
overflow-x: auto;
|
|
504
|
+
margin: 0.5em 0;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.editor-content :global(.ProseMirror pre code) {
|
|
508
|
+
background: none;
|
|
509
|
+
padding: 0;
|
|
510
|
+
color: inherit;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.editor-content :global(.ProseMirror-focused) {
|
|
514
|
+
outline: none;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/* Placeholder */
|
|
518
|
+
.editor-content :global(.ProseMirror p.is-editor-empty:first-child::before) {
|
|
519
|
+
content: attr(data-placeholder);
|
|
520
|
+
color: #9ca3af;
|
|
521
|
+
pointer-events: none;
|
|
522
|
+
position: absolute;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* Table Styles */
|
|
526
|
+
.editor-content :global(.ProseMirror table) {
|
|
527
|
+
border-collapse: collapse;
|
|
528
|
+
margin: 1em 0;
|
|
529
|
+
overflow: hidden;
|
|
530
|
+
width: 100%;
|
|
531
|
+
table-layout: fixed;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.editor-content :global(.ProseMirror table td),
|
|
535
|
+
.editor-content :global(.ProseMirror table th) {
|
|
536
|
+
border: 1px solid #d1d5db;
|
|
537
|
+
box-sizing: border-box;
|
|
538
|
+
min-width: 1em;
|
|
539
|
+
padding: 0.5em 0.75em;
|
|
540
|
+
position: relative;
|
|
541
|
+
vertical-align: top;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.editor-content :global(.ProseMirror table th) {
|
|
545
|
+
background-color: #f3f4f6;
|
|
546
|
+
font-weight: 600;
|
|
547
|
+
text-align: left;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.editor-content :global(.ProseMirror table .selectedCell:after) {
|
|
551
|
+
background: rgba(59, 130, 246, 0.1);
|
|
552
|
+
content: "";
|
|
553
|
+
left: 0;
|
|
554
|
+
right: 0;
|
|
555
|
+
top: 0;
|
|
556
|
+
bottom: 0;
|
|
557
|
+
pointer-events: none;
|
|
558
|
+
position: absolute;
|
|
559
|
+
z-index: 2;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.editor-content :global(.ProseMirror table .column-resize-handle) {
|
|
563
|
+
background-color: #3b82f6;
|
|
564
|
+
bottom: -2px;
|
|
565
|
+
pointer-events: none;
|
|
566
|
+
position: absolute;
|
|
567
|
+
right: -2px;
|
|
568
|
+
top: 0;
|
|
569
|
+
width: 4px;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.editor-content :global(.ProseMirror.resize-cursor) {
|
|
573
|
+
cursor: col-resize;
|
|
574
|
+
}
|
|
575
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
content?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
onchange?: (html: string) => void;
|
|
5
|
+
minHeight?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const RichTextEditor: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type RichTextEditor = ReturnType<typeof RichTextEditor>;
|
|
10
|
+
export default RichTextEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RichTextEditor } from './RichTextEditor.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RichTextEditor } from './RichTextEditor.svelte';
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Components
|
|
2
|
+
export * from './PageLayout';
|
|
3
|
+
export * from './InfoCard';
|
|
4
|
+
export * from './Pagination';
|
|
5
|
+
export * from './LoadingSpinner';
|
|
6
|
+
export * from './Modal';
|
|
7
|
+
export * from './RichTextEditor';
|
|
8
|
+
export * from './Button';
|
|
9
|
+
// Sections
|
|
10
|
+
export * from './sections';
|
|
11
|
+
// Utils
|
|
12
|
+
export * from './utils/translations.svelte';
|