MrHesam commited on
Commit
aeab2ff
·
verified ·
1 Parent(s): 9ee1b82

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +371 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ckeditor
3
- emoji:
4
- colorFrom: blue
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ckeditor
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,371 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fa" dir="rtl">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ویرایشگر متن پیشرفته با CKEditor</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');
11
+
12
+ body {
13
+ font-family: 'Vazirmatn', sans-serif;
14
+ }
15
+
16
+ .ck.ck-editor__editable:not(.ck-editor__nested-editable) {
17
+ min-height: 500px;
18
+ }
19
+
20
+ .dark-mode {
21
+ background-color: #1a202c;
22
+ color: #f7fafc;
23
+ }
24
+
25
+ .dark-mode .ck.ck-toolbar {
26
+ background-color: #2d3748 !important;
27
+ border-color: #4a5568 !important;
28
+ }
29
+
30
+ .dark-mode .ck.ck-editor__main>.ck-editor__editable {
31
+ background-color: #2d3748 !important;
32
+ border-color: #4a5568 !important;
33
+ color: #f7fafc !important;
34
+ }
35
+
36
+ .dark-mode .ck.ck-button:not(.ck-disabled):hover,
37
+ .dark-mode .ck.ck-button.ck-on,
38
+ .dark-mode a.ck.ck-button.ck-on,
39
+ .dark-mode .ck.ck-button.ck-on:hover {
40
+ background-color: #4a5568 !important;
41
+ }
42
+
43
+ .dark-mode .ck.ck-dropdown__panel {
44
+ background-color: #2d3748 !important;
45
+ border-color: #4a5568 !important;
46
+ }
47
+
48
+ .dark-mode .ck.ck-list__item:hover:not(.ck-disabled) {
49
+ background-color: #4a5568 !important;
50
+ }
51
+
52
+ .dark-mode .ck.ck-input-text {
53
+ background-color: #2d3748 !important;
54
+ border-color: #4a5568 !important;
55
+ color: #f7fafc !important;
56
+ }
57
+
58
+ .dark-mode .ck.ck-label {
59
+ color: #f7fafc !important;
60
+ }
61
+
62
+ .fullscreen {
63
+ position: fixed !important;
64
+ top: 0 !important;
65
+ left: 0 !important;
66
+ right: 0 !important;
67
+ bottom: 0 !important;
68
+ z-index: 1000 !important;
69
+ background: white;
70
+ padding: 1rem;
71
+ }
72
+
73
+ .dark-mode .fullscreen {
74
+ background: #2d3748;
75
+ }
76
+
77
+ .fullscreen .ck.ck-editor__main>.ck-editor__editable {
78
+ min-height: calc(100vh - 100px) !important;
79
+ }
80
+ </style>
81
+ </head>
82
+ <body class="bg-gray-100">
83
+ <div class="container mx-auto p-4 max-w-6xl">
84
+ <h1 class="text-3xl font-bold text-center mb-6 text-blue-600">ویرایشگر متن پیشرفته با CKEditor</h1>
85
+
86
+ <div class="flex justify-between items-center mb-4">
87
+ <div class="flex space-x-2 space-x-reverse">
88
+ <button id="dark-mode-toggle" class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700" title="حالت تاریک/روشن">
89
+ <i class="fas fa-moon"></i>
90
+ </button>
91
+ <button id="fullscreen-toggle" class="p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700" title="حالت تمام صفحه">
92
+ <i class="fas fa-expand"></i>
93
+ </button>
94
+ </div>
95
+
96
+ <div class="flex space-x-2 space-x-reverse">
97
+ <button id="save-html" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
98
+ <i class="fas fa-save ml-1"></i> ذخیره به عنوان HTML
99
+ </button>
100
+ <button id="save-pdf" class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600">
101
+ <i class="fas fa-file-pdf ml-1"></i> ذخیره به عنوان PDF
102
+ </button>
103
+ </div>
104
+ </div>
105
+
106
+ <div id="editor-container">
107
+ <!-- CKEditor will be inserted here -->
108
+ </div>
109
+
110
+ <div class="mt-6 flex justify-between items-center">
111
+ <div class="text-sm text-gray-500 dark:text-gray-400">
112
+ <span id="word-count">کلمات: 0</span> |
113
+ <span id="character-count">کاراکترها: 0</span>
114
+ </div>
115
+ <div class="text-sm text-gray-500 dark:text-gray-400" id="current-time">
116
+ <!-- Time will be inserted here -->
117
+ </div>
118
+ </div>
119
+
120
+ <div class="mt-4 text-center text-gray-500 dark:text-gray-400 text-sm">
121
+ ویرایشگر متن پیشرفته با CKEditor - تمام حقوق محفوظ است © 2023
122
+ </div>
123
+ </div>
124
+
125
+ <!-- CKEditor Scripts -->
126
+ <script src="https://cdn.ckeditor.com/ckeditor5/36.0.1/super-build/ckeditor.js"></script>
127
+
128
+ <!-- PDF Library -->
129
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
130
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
131
+
132
+ <script>
133
+ // Initialize CKEditor
134
+ CKEDITOR.ClassicEditor.create(document.getElementById("editor-container"), {
135
+ toolbar: {
136
+ items: [
137
+ 'undo', 'redo',
138
+ '|', 'heading',
139
+ '|', 'fontfamily', 'fontsize', 'fontColor', 'fontBackgroundColor',
140
+ '|', 'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript',
141
+ '|', 'alignment',
142
+ '|', 'bulletedList', 'numberedList', 'outdent', 'indent',
143
+ '|', 'link', 'uploadImage', 'blockQuote', 'insertTable',
144
+ '|', 'code', 'codeBlock', 'htmlEmbed',
145
+ '|', 'horizontalLine', 'pageBreak', 'specialCharacters',
146
+ '|', 'sourceEditing'
147
+ ],
148
+ shouldNotGroupWhenFull: true
149
+ },
150
+ language: 'fa',
151
+ list: {
152
+ properties: {
153
+ styles: true,
154
+ startIndex: true,
155
+ reversed: true
156
+ }
157
+ },
158
+ heading: {
159
+ options: [
160
+ { model: 'paragraph', title: 'پاراگراف', class: 'ck-heading_paragraph' },
161
+ { model: 'heading1', view: 'h1', title: 'سرتیتر 1', class: 'ck-heading_heading1' },
162
+ { model: 'heading2', view: 'h2', title: 'سرتیتر 2', class: 'ck-heading_heading2' },
163
+ { model: 'heading3', view: 'h3', title: 'سرتیتر 3', class: 'ck-heading_heading3' },
164
+ { model: 'heading4', view: 'h4', title: 'سرتیتر 4', class: 'ck-heading_heading4' },
165
+ { model: 'heading5', view: 'h5', title: 'سرتیتر 5', class: 'ck-heading_heading5' },
166
+ { model: 'heading6', view: 'h6', title: 'سرتیتر 6', class: 'ck-heading_heading6' }
167
+ ]
168
+ },
169
+ fontFamily: {
170
+ options: [
171
+ 'Vazirmatn, sans-serif',
172
+ 'Arial, Helvetica, sans-serif',
173
+ 'Courier New, Courier, monospace',
174
+ 'Georgia, serif',
175
+ 'Times New Roman, Times, serif',
176
+ 'Trebuchet MS, Helvetica, sans-serif',
177
+ 'Verdana, Geneva, sans-serif',
178
+ 'default'
179
+ ],
180
+ supportAllValues: true
181
+ },
182
+ fontSize: {
183
+ options: [ 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 ],
184
+ supportAllValues: true
185
+ },
186
+ htmlSupport: {
187
+ allow: [
188
+ {
189
+ name: /.*/,
190
+ attributes: true,
191
+ classes: true,
192
+ styles: true
193
+ }
194
+ ]
195
+ },
196
+ htmlEmbed: {
197
+ showPreviews: true
198
+ },
199
+ link: {
200
+ decorators: {
201
+ addTargetToExternalLinks: true,
202
+ defaultProtocol: 'https://',
203
+ toggleDownloadable: {
204
+ mode: 'manual',
205
+ label: 'قابل دانلود',
206
+ attributes: {
207
+ download: 'file'
208
+ }
209
+ }
210
+ }
211
+ },
212
+ mention: {
213
+ feeds: [
214
+ {
215
+ marker: '@',
216
+ feed: [
217
+ '@apple', '@bears', '@brownie', '@cake', '@cake', '@candy', '@canes', '@chocolate', '@cookie', '@cotton', '@cream',
218
+ '@cupcake', '@danish', '@donut', '@dragée', '@fruitcake', '@gingerbread', '@gummi', '@ice', '@jelly-o',
219
+ '@liquorice', '@macaroon', '@marzipan', '@oat', '@pie', '@plum', '@pudding', '@sesame', '@snaps', '@soufflé',
220
+ '@sugar', '@sweet', '@topping', '@wafer'
221
+ ],
222
+ minimumCharacters: 1
223
+ }
224
+ ]
225
+ },
226
+ removePlugins: [
227
+ 'CKBox',
228
+ 'CKFinder',
229
+ 'EasyImage',
230
+ 'RealTimeCollaborativeComments',
231
+ 'RealTimeCollaborativeTrackChanges',
232
+ 'RealTimeCollaborativeRevisionHistory',
233
+ 'PresenceList',
234
+ 'Comments',
235
+ 'TrackChanges',
236
+ 'TrackChangesData',
237
+ 'RevisionHistory',
238
+ 'Pagination',
239
+ 'WProofreader',
240
+ 'MathType'
241
+ ]
242
+ }).then(editor => {
243
+ window.editor = editor;
244
+
245
+ // Update word and character count
246
+ editor.model.document.on('change:data', () => {
247
+ updateCounts();
248
+ });
249
+
250
+ // Set initial content with RTL direction
251
+ editor.setData('<p style="text-align: right;">متن خود را اینجا بنویسید...</p>');
252
+ }).catch(error => {
253
+ console.error(error);
254
+ });
255
+
256
+ // Update word and character count
257
+ function updateCounts() {
258
+ if (!window.editor) return;
259
+
260
+ const text = window.editor.getData().replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
261
+ const words = text ? text.split(/\s+/).filter(word => word.length > 0).length : 0;
262
+ const characters = text.length;
263
+
264
+ document.getElementById('word-count').textContent = `کلمات: ${words}`;
265
+ document.getElementById('character-count').textContent = `کاراکترها: ${characters}`;
266
+ }
267
+
268
+ // Update current time
269
+ function updateTime() {
270
+ const now = new Date();
271
+ const hours = now.getHours().toString().padStart(2, '0');
272
+ const minutes = now.getMinutes().toString().padStart(2, '0');
273
+ document.getElementById('current-time').textContent = `زمان: ${hours}:${minutes}`;
274
+ }
275
+
276
+ // Initialize time and update every minute
277
+ updateTime();
278
+ setInterval(updateTime, 60000);
279
+
280
+ // Dark mode toggle
281
+ document.getElementById('dark-mode-toggle').addEventListener('click', function() {
282
+ document.body.classList.toggle('dark-mode');
283
+ const icon = this.querySelector('i');
284
+ if (document.body.classList.contains('dark-mode')) {
285
+ icon.classList.replace('fa-moon', 'fa-sun');
286
+ } else {
287
+ icon.classList.replace('fa-sun', 'fa-moon');
288
+ }
289
+ });
290
+
291
+ // Fullscreen toggle
292
+ document.getElementById('fullscreen-toggle').addEventListener('click', function() {
293
+ const container = document.getElementById('editor-container');
294
+ container.classList.toggle('fullscreen');
295
+
296
+ const icon = this.querySelector('i');
297
+ if (container.classList.contains('fullscreen')) {
298
+ icon.classList.replace('fa-expand', 'fa-compress');
299
+ } else {
300
+ icon.classList.replace('fa-compress', 'fa-expand');
301
+ }
302
+ });
303
+
304
+ // Save as HTML
305
+ document.getElementById('save-html').addEventListener('click', function() {
306
+ if (!window.editor) return;
307
+
308
+ const content = window.editor.getData();
309
+ const blob = new Blob([content], { type: 'text/html' });
310
+ const url = URL.createObjectURL(blob);
311
+
312
+ const a = document.createElement('a');
313
+ a.href = url;
314
+ a.download = 'document.html';
315
+ a.click();
316
+
317
+ URL.revokeObjectURL(url);
318
+ });
319
+
320
+ // Save as PDF
321
+ document.getElementById('save-pdf').addEventListener('click', function() {
322
+ if (!window.editor) return;
323
+
324
+ // Use html2canvas and jsPDF to create PDF
325
+ const editorContent = document.querySelector('.ck.ck-editor__main .ck-editor__editable');
326
+
327
+ html2canvas(editorContent).then(canvas => {
328
+ const imgData = canvas.toDataURL('image/png');
329
+ const pdf = new jspdf.jsPDF({
330
+ orientation: 'portrait',
331
+ unit: 'mm'
332
+ });
333
+
334
+ // Calculate the PDF dimensions to maintain aspect ratio
335
+ const imgWidth = 210; // A4 width in mm
336
+ const imgHeight = canvas.height * imgWidth / canvas.width;
337
+
338
+ pdf.addImage(imgData, 'PNG', 0, 0, imgWidth, imgHeight);
339
+ pdf.save('document.pdf');
340
+ });
341
+ });
342
+
343
+ // Keyboard shortcuts
344
+ document.addEventListener('keydown', function(e) {
345
+ // Ctrl+S for save
346
+ if (e.ctrlKey && e.key === 's') {
347
+ e.preventDefault();
348
+ document.getElementById('save-html').click();
349
+ }
350
+
351
+ // Ctrl+P for print (save as PDF)
352
+ if (e.ctrlKey && e.key === 'p') {
353
+ e.preventDefault();
354
+ document.getElementById('save-pdf').click();
355
+ }
356
+
357
+ // Ctrl+D for dark mode
358
+ if (e.ctrlKey && e.key === 'd') {
359
+ e.preventDefault();
360
+ document.getElementById('dark-mode-toggle').click();
361
+ }
362
+
363
+ // F11 for fullscreen
364
+ if (e.key === 'F11') {
365
+ e.preventDefault();
366
+ document.getElementById('fullscreen-toggle').click();
367
+ }
368
+ });
369
+ </script>
370
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MrHesam/ckeditor" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
371
+ </html>
prompts.txt ADDED
File without changes