px-react-ui-components 1.1.9 → 1.1.11

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.
@@ -0,0 +1,277 @@
1
+ .myEditorContainer {
2
+ &.fullscreen {
3
+ position: fixed;
4
+ z-index: 9999;
5
+ background: white;
6
+ left: 0;
7
+ top: 0;
8
+ width: 100%;
9
+ height: 100%;
10
+ background-color: #091624c0;
11
+
12
+ .myEditorContainerContent {
13
+ position: absolute;
14
+ top: 50%;
15
+ left: 50%;
16
+ transform: translate(-50%, -50%);
17
+ height: 90vh;
18
+ width: 95%;
19
+ background: #fff;
20
+ border-radius: 10px;
21
+ padding: 10px;
22
+
23
+ .myEditorContainerFullscreenButton{
24
+ right: 15px;
25
+ top: 15px;
26
+ background: #7096b1;
27
+ }
28
+
29
+ .quill {
30
+ height: calc(100% - 45px) !important;
31
+ }
32
+ }
33
+ }
34
+
35
+ .myEditorContainerContent {
36
+ position: relative;
37
+ height: 100%;
38
+ width: 100%;
39
+
40
+ .myEditorContainerFullscreenButton{
41
+ position: absolute;
42
+ right: 5px;
43
+ top: 5px;
44
+ z-index: 10000;
45
+ background: #b8c1cf;
46
+ border: none;
47
+ cursor: pointer;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ width: 33px;
52
+ height: 33px;
53
+ padding: 7px;
54
+ border-radius: 5px;
55
+
56
+ svg{
57
+ width: 100%;
58
+ height: 100%;
59
+ }
60
+ }
61
+
62
+ .quill {
63
+ display: inline-block;
64
+ width: 100%;
65
+
66
+ .ql-toolbar {
67
+ border-radius: 10px;
68
+ background: #eaebec;
69
+ // -webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
70
+ // -moz-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
71
+ box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.1);
72
+ padding: 3px !important;
73
+
74
+ .ql-formats {
75
+ margin: 4px;
76
+ background: #d9dce1;
77
+ padding: 2px;
78
+ border-radius: 5px;
79
+ }
80
+ }
81
+
82
+ .ql-container {
83
+ border-radius: 0 0 10px 10px;
84
+ padding-right: 2px;
85
+ }
86
+
87
+ .ql-editor {
88
+ &::-webkit-scrollbar {
89
+ width: 8px;
90
+ height: 8px;
91
+ }
92
+
93
+ &::-webkit-scrollbar-track {
94
+ background: #f1f1f1;
95
+ border-radius: 4px;
96
+ }
97
+
98
+ &::-webkit-scrollbar-thumb {
99
+ background: #888;
100
+ border-radius: 4px;
101
+
102
+ &:hover {
103
+ background: #555;
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ .quill-editor-container .ql-formula {
110
+ display: inline-block;
111
+ vertical-align: middle;
112
+ padding: 0 2px;
113
+ }
114
+
115
+ .quill-editor-container .katex {
116
+ display: inline-block;
117
+ font-size: 1.1em;
118
+ }
119
+
120
+ .ql-snow .ql-picker.ql-font .ql-picker-label::before,
121
+ .ql-snow .ql-picker.ql-font .ql-picker-item::before {
122
+ content: "";
123
+ }
124
+
125
+ .ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
126
+ overflow: auto;
127
+ max-height: 300px;
128
+ }
129
+
130
+ .ql-font-arial {
131
+ font-family: Arial, sans-serif !important;
132
+ }
133
+
134
+ .ql-font-comic-sans {
135
+ font-family: "Comic Sans MS", cursive, sans-serif !important;
136
+ }
137
+
138
+ .ql-font-courier-new {
139
+ font-family: "Courier New", Courier, monospace !important;
140
+ }
141
+
142
+ .ql-font-georgia {
143
+ font-family: Georgia, serif !important;
144
+ }
145
+
146
+ .ql-font-helvetica {
147
+ font-family: Helvetica, sans-serif !important;
148
+ }
149
+
150
+ .ql-font-times-new-roman {
151
+ font-family: "Times New Roman", Times, serif !important;
152
+ }
153
+
154
+ .ql-font-verdana {
155
+ font-family: Verdana, sans-serif !important;
156
+ }
157
+
158
+ .ql-font-trebuchet-ms {
159
+ font-family: "Trebuchet MS", sans-serif !important;
160
+ }
161
+
162
+ .ql-font-garamond {
163
+ font-family: Garamond, serif !important;
164
+ }
165
+
166
+ .ql-font-palatino-linotype {
167
+ font-family: "Palatino Linotype", serif !important;
168
+ }
169
+
170
+ .ql-font-consolas {
171
+ font-family: Consolas, monospace !important;
172
+ }
173
+
174
+ .ql-font-lucida-console {
175
+ font-family: "Lucida Console", monospace !important;
176
+ }
177
+
178
+ .ql-font-impact {
179
+ font-family: Impact, sans-serif !important;
180
+ }
181
+
182
+ .ql-font-brush-script-mt {
183
+ font-family: "Brush Script MT", cursive !important;
184
+ }
185
+
186
+ .ql-font-tahoma {
187
+ font-family: Tahoma, sans-serif !important;
188
+ }
189
+
190
+ .ql-font-gill-sans {
191
+ font-family: "Gill Sans", sans-serif !important;
192
+ }
193
+
194
+ .ql-font-franklin-gothic-medium {
195
+ font-family: "Franklin Gothic Medium", sans-serif !important;
196
+ }
197
+
198
+ .ql-font-century-gothic {
199
+ font-family: "Century Gothic", sans-serif !important;
200
+ }
201
+
202
+ .ql-font-bookman-old-style {
203
+ font-family: "Bookman Old Style", serif !important;
204
+ }
205
+
206
+ .ql-font-candara {
207
+ font-family: Candara, sans-serif !important;
208
+ }
209
+
210
+ .ql-font-didot {
211
+ font-family: Didot, serif !important;
212
+ }
213
+
214
+ .ql-font-futura {
215
+ font-family: Futura, sans-serif !important;
216
+ }
217
+
218
+ .ql-font-rockwell {
219
+ font-family: Rockwell, serif !important;
220
+ }
221
+
222
+ .ql-font-baskerville {
223
+ font-family: Baskerville, serif !important;
224
+ }
225
+
226
+ .ql-font-bodoni-mt {
227
+ font-family: "Bodoni MT", serif !important;
228
+ }
229
+
230
+ .ql-font-copperplate {
231
+ font-family: Copperplate, serif !important;
232
+ }
233
+
234
+ .ql-font-perpetua {
235
+ font-family: Perpetua, serif !important;
236
+ }
237
+
238
+ .ql-font-monaco {
239
+ font-family: Monaco, monospace !important;
240
+ }
241
+
242
+ .ql-font-century-schoolbook {
243
+ font-family: "Century Schoolbook", serif !important;
244
+ }
245
+
246
+ .ql-font-segoe-ui {
247
+ font-family: "Segoe UI", sans-serif !important;
248
+ }
249
+
250
+ .ql-snow .ql-toolbar button.ql-fullscreen {
251
+ &:hover .ql-stroke {
252
+ stroke: #06c;
253
+ }
254
+
255
+ .ql-stroke {
256
+ stroke: #444;
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+
263
+ .ql-editor table {
264
+ width: 100%;
265
+ border-collapse: collapse;
266
+ }
267
+
268
+ .ql-editor table td,
269
+ .ql-editor table th {
270
+ border: 1px solid #ddd;
271
+ padding: 8px;
272
+ }
273
+
274
+ .ql-editor table th {
275
+ background-color: #f2f2f2;
276
+ text-align: left;
277
+ }
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ require("./MyEditor.scss");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ // Opsiyonel bağımlılıkları kontrol et
12
+ let ReactQuill, Quill, ImageResize, QuillTable, katex;
13
+ let hasQuillDependencies = false;
14
+ try {
15
+ ReactQuill = require("react-quill");
16
+ require("react-quill/dist/quill.snow.css");
17
+ Quill = require("quill");
18
+ ImageResize = require("quill-image-resize");
19
+ QuillTable = require("quill-table");
20
+ katex = require("katex");
21
+ require("katex/dist/katex.min.css");
22
+ hasQuillDependencies = true;
23
+ } catch (error) {
24
+ console.warn("MyEditor: Quill bağımlılıkları bulunamadı. MyEditor bileşenini kullanmak için aşağıdaki paketleri yükleyin:", {
25
+ "react-quill": "^2.0.0",
26
+ "quill": "^1.3.7",
27
+ "quill-image-resize-module-react": "^3.0.0",
28
+ "quill-table-ui": "^1.0.7",
29
+ "katex": "^0.16.21"
30
+ });
31
+ }
32
+
33
+ // Özel font listesini tanımla
34
+ const fonts = [{
35
+ label: "Arial",
36
+ value: "arial"
37
+ }, {
38
+ label: "Comic Sans MS",
39
+ value: "comic-sans"
40
+ }, {
41
+ label: "Courier New",
42
+ value: "courier-new"
43
+ }, {
44
+ label: "Georgia",
45
+ value: "georgia"
46
+ }, {
47
+ label: "Helvetica",
48
+ value: "helvetica"
49
+ }, {
50
+ label: "Times New Roman",
51
+ value: "times-new-roman"
52
+ }, {
53
+ label: "Verdana",
54
+ value: "verdana"
55
+ }, {
56
+ label: "Trebuchet MS",
57
+ value: "trebuchet-ms"
58
+ }, {
59
+ label: "Garamond",
60
+ value: "garamond"
61
+ }, {
62
+ label: "Palatino Linotype",
63
+ value: "palatino-linotype"
64
+ }, {
65
+ label: "Consolas",
66
+ value: "consolas"
67
+ }, {
68
+ label: "Lucida Console",
69
+ value: "lucida-console"
70
+ }, {
71
+ label: "Impact",
72
+ value: "impact"
73
+ }, {
74
+ label: "Brush Script MT",
75
+ value: "brush-script-mt"
76
+ }, {
77
+ label: "Tahoma",
78
+ value: "tahoma"
79
+ }, {
80
+ label: "Gill Sans",
81
+ value: "gill-sans"
82
+ }, {
83
+ label: "Franklin Gothic Medium",
84
+ value: "franklin-gothic-medium"
85
+ }, {
86
+ label: "Century Gothic",
87
+ value: "century-gothic"
88
+ }, {
89
+ label: "Bookman Old Style",
90
+ value: "bookman-old-style"
91
+ }, {
92
+ label: "Candara",
93
+ value: "candara"
94
+ }, {
95
+ label: "Didot",
96
+ value: "didot"
97
+ }, {
98
+ label: "Futura",
99
+ value: "futura"
100
+ }, {
101
+ label: "Rockwell",
102
+ value: "rockwell"
103
+ }, {
104
+ label: "Baskerville",
105
+ value: "baskerville"
106
+ }, {
107
+ label: "Bodoni MT",
108
+ value: "bodoni-mt"
109
+ }, {
110
+ label: "Copperplate",
111
+ value: "copperplate"
112
+ }, {
113
+ label: "Perpetua",
114
+ value: "perpetua"
115
+ }, {
116
+ label: "Monaco",
117
+ value: "monaco"
118
+ }, {
119
+ label: "Century Schoolbook",
120
+ value: "century-schoolbook"
121
+ }, {
122
+ label: "Segoe UI",
123
+ value: "segoe-ui"
124
+ }];
125
+
126
+ // Quill bağımlılıkları varsa konfigürasyonu yap
127
+ if (hasQuillDependencies) {
128
+ // KaTeX'i global hale getir
129
+ if (katex) {
130
+ window.katex = katex;
131
+ }
132
+
133
+ // Quill font formatını genişlet
134
+ const Font = Quill.import("formats/font");
135
+ Font.whitelist = fonts.map(f => f.value);
136
+ Quill.register(Font, true);
137
+
138
+ // Quill modüllerini kaydet
139
+ if (ImageResize) {
140
+ Quill.register("modules/imageResize", ImageResize);
141
+ }
142
+ if (QuillTable) {
143
+ Quill.register(QuillTable.TableCell);
144
+ Quill.register(QuillTable.TableRow);
145
+ Quill.register(QuillTable.Table);
146
+ Quill.register(QuillTable.Contain);
147
+ Quill.register("modules/table", QuillTable.TableModule);
148
+ }
149
+
150
+ // Formula Embed için düzeltme
151
+ if (katex) {
152
+ const Embed = Quill.import("blots/embed");
153
+ class FormulaEmbed extends Embed {
154
+ static create(value) {
155
+ let node = super.create();
156
+ if (value) {
157
+ node.setAttribute("data-value", value);
158
+ try {
159
+ window.katex.render(value, node, {
160
+ throwOnError: false
161
+ });
162
+ } catch (err) {
163
+ console.error("KaTeX render error:", err);
164
+ }
165
+ }
166
+ return node;
167
+ }
168
+ static value(node) {
169
+ return node.getAttribute("data-value");
170
+ }
171
+ }
172
+ FormulaEmbed.blotName = "formula";
173
+ FormulaEmbed.tagName = "SPAN";
174
+ FormulaEmbed.className = "ql-formula";
175
+ Quill.register("formats/formula", FormulaEmbed);
176
+ }
177
+ }
178
+ function MyEditor({
179
+ value,
180
+ onChange,
181
+ style = {
182
+ height: "300px"
183
+ }
184
+ }) {
185
+ const [editorValue, setEditorValue] = (0, _react.useState)("");
186
+ const [isFullscreen, setIsFullscreen] = (0, _react.useState)(false);
187
+ const editorRef = (0, _react.useRef)(null);
188
+ const timeoutRef = (0, _react.useRef)(null);
189
+ const isFirstRender = (0, _react.useRef)(true);
190
+
191
+ // Bağımlılıklar yoksa uyarı göster
192
+ if (!hasQuillDependencies) {
193
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
194
+ style: {
195
+ padding: "20px",
196
+ border: "2px dashed #ff6b6b",
197
+ borderRadius: "8px",
198
+ backgroundColor: "#fff5f5",
199
+ color: "#d63031",
200
+ textAlign: "center",
201
+ ...style
202
+ },
203
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
204
+ children: "MyEditor Bile\u015Feni Kullan\u0131lam\u0131yor"
205
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
206
+ children: "Bu bile\u015Feni kullanmak i\xE7in a\u015Fa\u011F\u0131daki paketleri y\xFCklemeniz gerekiyor:"
207
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
208
+ style: {
209
+ backgroundColor: "#f8f9fa",
210
+ padding: "10px",
211
+ borderRadius: "4px",
212
+ fontSize: "12px",
213
+ textAlign: "left",
214
+ overflow: "auto"
215
+ },
216
+ children: `npm install react-quill quill quill-image-resize-module-react quill-table-ui katex`
217
+ })]
218
+ });
219
+ }
220
+ const handleFullscreen = () => {
221
+ setIsFullscreen(!isFullscreen);
222
+ };
223
+
224
+ // Custom buton tanımı
225
+ (0, _react.useEffect)(() => {
226
+ const icons = Quill.import('ui/icons');
227
+ icons['fullscreen'] = `<svg viewbox="0 0 18 18">
228
+ <path d="M4,4H0v2h6V0H4V4z M14,4V0h-2v6h6V4H14z M6,14H0v2h4v4h2V14z M14,18h2v-4h4v-2h-6V18z"/>
229
+ </svg>`;
230
+ }, []);
231
+ (0, _react.useEffect)(() => {
232
+ if (isFirstRender.current) {
233
+ isFirstRender.current = false;
234
+ setEditorValue(value || "");
235
+ } else if (value !== editorValue) {
236
+ const editor = editorRef.current?.getEditor();
237
+ if (editor) {
238
+ editor.setContents(editor.clipboard.convert(value || ""));
239
+ }
240
+ }
241
+ }, [value]);
242
+ const handleChange = (content, delta, source, editor) => {
243
+ const html = editor.getHTML();
244
+ setEditorValue(html);
245
+ if (timeoutRef.current) {
246
+ clearTimeout(timeoutRef.current);
247
+ }
248
+ timeoutRef.current = setTimeout(() => {
249
+ if (onChange) onChange({
250
+ value: html,
251
+ target: {
252
+ value: html
253
+ }
254
+ });
255
+ }, 500);
256
+ };
257
+ const formats = ["header", "font", "size", "bold", "italic", "underline", "strike", "blockquote", "list", "bullet", "indent", "link", "image", "color", "background", "align", "script", "table", "table-cell", "table-row", "table-header", "table-body", "formula"];
258
+ const maxRows = 10;
259
+ const maxCols = 5;
260
+ const tableOptions = [];
261
+ for (let r = 1; r <= maxRows; r++) {
262
+ for (let c = 1; c <= maxCols; c++) {
263
+ tableOptions.push("newtable_" + r + "_" + c);
264
+ }
265
+ }
266
+ const modules = {
267
+ toolbar: {
268
+ container: [[{
269
+ font: fonts.map(f => f.value)
270
+ }], [{
271
+ header: [1, 2, 3, 4, 5, 6, false]
272
+ }], [{
273
+ size: ["small", "normal", "large", "huge"]
274
+ }], [{
275
+ list: "ordered"
276
+ }, {
277
+ list: "bullet"
278
+ }], ["bold", "italic", "underline", "strike"], [{
279
+ align: []
280
+ }], [{
281
+ color: []
282
+ }, {
283
+ background: []
284
+ }], [{
285
+ script: "sub"
286
+ }, {
287
+ script: "super"
288
+ }], ["image"], [{
289
+ table: tableOptions
290
+ }, {
291
+ table: "append-row"
292
+ }, {
293
+ table: "append-col"
294
+ }]
295
+ // ["formula"]
296
+ ]
297
+ },
298
+ table: {
299
+ operationMenu: true,
300
+ resizable: true,
301
+ tableCellMinWidth: 50,
302
+ tableHeaderRows: 1
303
+ },
304
+ clipboard: {
305
+ matchVisual: false
306
+ },
307
+ imageResize: {
308
+ modules: ["Resize", "DisplaySize"],
309
+ displaySize: true,
310
+ handleStyles: {
311
+ backgroundColor: '#000',
312
+ border: 'none',
313
+ color: '#fff'
314
+ }
315
+ }
316
+ };
317
+
318
+ // Font adlarını gerçek isimleriyle göstermek için toolbar'ı güncelle
319
+ const fontPicker = document.querySelector(".ql-font");
320
+ if (fontPicker) {
321
+ const items = fontPicker.querySelectorAll(".ql-picker-item");
322
+ items.forEach((item, index) => {
323
+ if (fonts[index]) {
324
+ item.innerText = fonts[index].label; // Gerçek font adını göster
325
+ }
326
+ });
327
+ const pickerLabel = fontPicker.querySelector(".ql-picker-label");
328
+ if (pickerLabel) {
329
+ pickerLabel.innerText = fonts[0].label; // Varsayılan font ismi
330
+ }
331
+ }
332
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
333
+ className: 'myEditorContainer ' + (isFullscreen ? 'fullscreen' : ''),
334
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
335
+ className: "myEditorContainerContent",
336
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
337
+ onClick: handleFullscreen,
338
+ className: "myEditorContainerFullscreenButton",
339
+ title: isFullscreen ? "Minimize" : "Maximize",
340
+ children: isFullscreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
341
+ viewBox: "0 0 18 18",
342
+ width: "18",
343
+ height: "18",
344
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
345
+ d: "M4,4h2v6H0V8h4V4z M14,4v4h4v2h-6V4H14z M6,14H4v-4H0v-2h6V14z M14,14h-2v-6h6v2h-4V14z"
346
+ })
347
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
348
+ viewBox: "0 0 18 18",
349
+ width: "18",
350
+ height: "18",
351
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
352
+ d: "M4,4H0v2h6V0H4V4z M14,4V0h-2v6h6V4H14z M6,14H0v2h4v4h2V14z M14,18h2v-4h4v-2h-6V18z"
353
+ })
354
+ })
355
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ReactQuill, {
356
+ ref: editorRef,
357
+ theme: "snow",
358
+ value: editorValue,
359
+ onChange: handleChange,
360
+ modules: modules,
361
+ formats: formats,
362
+ style: style,
363
+ preserveWhitespace: true
364
+ })]
365
+ })
366
+ });
367
+ }
368
+ var _default = exports.default = MyEditor;