@podlite/editor-react 0.0.32 → 0.0.33

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,428 @@
1
+ .EditorApp {
2
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
3
+ -webkit-font-smoothing: antialiased;
4
+ -moz-osx-font-smoothing: grayscale;
5
+ }
6
+
7
+ .App-logo {
8
+ height: 40vmin;
9
+ pointer-events: none;
10
+ }
11
+
12
+ @media (prefers-reduced-motion: no-preference) {
13
+ .App-logo {
14
+ animation: App-logo-spin infinite 20s linear;
15
+ }
16
+ }
17
+
18
+ .App-header {
19
+ background-color: #282c34;
20
+ min-height: 100vh;
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ justify-content: center;
25
+ font-size: calc(10px + 2vmin);
26
+ color: white;
27
+ }
28
+
29
+ .App-link {
30
+ color: #61dafb;
31
+ }
32
+ .layout {
33
+ position: absolute;
34
+ width: 100%;
35
+ /* height: 100%; */
36
+ }
37
+ .layoutFocusWrite {
38
+ position: absolute;
39
+ width: 100%;
40
+ /* height: 100%; */
41
+ }
42
+ .Editor {
43
+ text-align: left;
44
+ white-space: pre-wrap;
45
+ word-break: break-word;
46
+ word-wrap: break-word;
47
+ }
48
+
49
+ [contenteditable]:focus {
50
+ outline: 0px solid transparent;
51
+ }
52
+ .layout__panel {
53
+ position: relative;
54
+ width: 100%;
55
+ height: 100%;
56
+ flex: none;
57
+ overflow: hidden;
58
+ }
59
+
60
+ .flex--row {
61
+ flex-direction: row;
62
+ }
63
+ .flex {
64
+ display: flex;
65
+ }
66
+
67
+ .CodeMirror {
68
+ height: auto;
69
+ font-family: inherit;
70
+ }
71
+
72
+ pre {
73
+ overflow-x: auto;
74
+ white-space: pre-wrap;
75
+ white-space: -moz-pre-wrap;
76
+ white-space: -pre-wrap;
77
+ white-space: -o-pre-wrap;
78
+ word-wrap: break-word;
79
+ }
80
+ .title {
81
+ margin:0em;
82
+ }
83
+ .Editorleft {
84
+ border-right: 1px dotted lightgrey;
85
+ white-space: pre-wrap;
86
+ word-break: break-word;
87
+ word-wrap: break-word;
88
+ width: 50%;
89
+ font-size: 15px;
90
+ text-align: left;
91
+ }
92
+
93
+ /* .Editorright {
94
+ text-align: left;
95
+ word-break: break-word;
96
+ word-wrap: break-word;
97
+ margin : 0 1em;
98
+ font-size: 15px;
99
+ } */
100
+
101
+ /* Start podlite */
102
+ body {
103
+ margin: 0;
104
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
105
+ -webkit-font-smoothing: antialiased;
106
+ -moz-osx-font-smoothing: grayscale;
107
+ }
108
+
109
+ code {
110
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
111
+ monospace;
112
+ }
113
+
114
+
115
+ pre {
116
+ padding: 9.5px;
117
+ display: block;
118
+ word-break: break-all;
119
+ word-wrap: break-word;
120
+ background-color: #f8f8f8;
121
+ border-radius: 4px;
122
+ }
123
+
124
+ code {
125
+ padding: 0;
126
+ font-size: inherit;
127
+ color: inherit;
128
+ white-space: pre-wrap;
129
+ background-color: transparent;
130
+ border-radius: 0;
131
+ }
132
+
133
+ img {
134
+ max-width: 1024px;
135
+ }
136
+
137
+ table {
138
+ word-break: normal;
139
+ min-width: 70%;
140
+ max-width: 100%;
141
+ margin: 1em auto;
142
+ border-spacing: 0;
143
+ border-collapse: collapse;
144
+ text-align: center;
145
+ margin-top: 2em;
146
+ }
147
+ table caption {
148
+ margin-bottom: 0.8em;
149
+ caption-side: bottom;
150
+ }
151
+
152
+ table tbody tr:hover {
153
+ background-color: #eee;
154
+ -webkit-transition: .5s;
155
+ transition: .5s
156
+ }
157
+
158
+ tr th {
159
+ vertical-align: bottom;
160
+ border-bottom: 2px solid #eee;
161
+ }
162
+
163
+ td {
164
+ padding: 8px;
165
+ border: 1px solid #eee;
166
+ }
167
+
168
+ .footnote a {
169
+ text-decoration: none;
170
+ }
171
+ .footnotes {
172
+ border-top-style: solid;
173
+ border-top-width: 1px;
174
+ border-top-color: #eee;
175
+ }
176
+
177
+ img {
178
+ display: block;
179
+ margin: 0 auto;
180
+ max-width: 100%;
181
+ }
182
+
183
+ .shadow {
184
+ -webkit-box-shadow: 3px 3px 5px 6px #ccc; /* Safari 3-4, iOS 4.0.2 - 4.2, Android 2.3+ */
185
+ -moz-box-shadow: 3px 3px 5px 6px #ccc; /* Firefox 3.5 - 3.6 */
186
+ box-shadow: 3px 3px 5px 6px #ccc; /* Opera 10.5, IE 9, Firefox 4+, Chrome 6+, iOS 5 */
187
+ }
188
+ .box {
189
+ box-shadow:
190
+ 0 2.8px 2.2px rgba(0, 0, 0, 0.034),
191
+ 0 6.7px 5.3px rgba(0, 0, 0, 0.048),
192
+ 0 12.5px 10px rgba(0, 0, 0, 0.06),
193
+ 0 22.3px 17.9px rgba(0, 0, 0, 0.072),
194
+ 0 41.8px 33.4px rgba(0, 0, 0, 0.086),
195
+ 0 100px 80px rgba(0, 0, 0, 0.12)
196
+ ;
197
+ margin: 100px auto;
198
+ background: white;
199
+ border-radius: 5px;
200
+ }
201
+
202
+ .image_block video {
203
+ max-width: 100%;
204
+ /* margin: 0 auto; */
205
+ margin-bottom: 1em;
206
+ }
207
+
208
+ .image_block video{
209
+ width: 100%;
210
+ outline: none;
211
+ border: none;
212
+ }
213
+
214
+ /* plugins */
215
+ .mermaid svg {
216
+ display: block;
217
+ margin: auto;
218
+ }
219
+
220
+ .toc {
221
+ padding: 1rem;
222
+ }
223
+
224
+ .toc-list {
225
+ list-style: none;
226
+ font-size: .8rem;
227
+ }
228
+
229
+ .caption {
230
+ text-align: center;
231
+ font-size: 0.9rem;
232
+ }
233
+
234
+ aside.notify {
235
+ border-left: .25em solid;
236
+ padding-left: 1rem ;
237
+ }
238
+
239
+ aside.notify>:first-child {
240
+ margin-top: 0
241
+ }
242
+
243
+ aside.notify>:last-child {
244
+ margin-bottom: 0
245
+ }
246
+
247
+ aside.notify.note {
248
+ border-left-color: #0085f2
249
+ }
250
+
251
+ aside.notify.note .notify-title {
252
+ color: #0085f2
253
+ }
254
+
255
+ aside.notify.tip {
256
+ border-left-color: #007936;
257
+ }
258
+
259
+ aside.notify.tip .notify-title {
260
+ color: #007936;
261
+ }
262
+
263
+
264
+ aside.notify.important {
265
+ border-left-color: #8250df
266
+ }
267
+
268
+ aside.notify.important .notify-title {
269
+ color: #8250df
270
+ }
271
+
272
+ aside.notify.warning {
273
+ border-left-color: #9a6700;;
274
+ }
275
+
276
+ aside.notify.warning .notify-title {
277
+ color: #9a6700;;
278
+ }
279
+
280
+ aside.notify.caution {
281
+ border-left-color: #d30038;
282
+ }
283
+
284
+ aside.notify.caution .notify-title {
285
+ color: #d30038;
286
+ }
287
+ /* End of podlite */
288
+
289
+
290
+ .CodeMirror {
291
+ height: auto;
292
+ font-family: inherit;
293
+ }
294
+
295
+ .title {
296
+ margin:0em;
297
+ }
298
+
299
+
300
+ .Editorleft {
301
+ border-right: 1px dotted lightgrey;
302
+ white-space: pre-wrap;
303
+ word-break: break-word;
304
+ word-wrap: break-word;
305
+ width: 50%;
306
+ font-size: 15px;
307
+ text-align: left;
308
+ float: left;
309
+ height: 100%;
310
+ padding-left: 10px;
311
+ visibility:visible;
312
+ opacity: 1;
313
+ transition: all 0.2s ease-out;
314
+ }
315
+
316
+ .editorApp,.CodeMirror {
317
+ height: 100%;
318
+ }
319
+
320
+ .Editorright {
321
+ text-align: left;
322
+ word-break: break-word;
323
+ word-wrap: break-word;
324
+ margin-right : 0;
325
+ height: 100%;
326
+ font-size: 15px;
327
+ padding-left: 10px;
328
+ overflow-y: scroll;
329
+ overflow-x: hidden;
330
+ background-color: white;
331
+ }
332
+
333
+ .Editorright .error {
334
+ opacity: 0.5;
335
+ }
336
+ /* restore after reset*/
337
+ .Editorright * {
338
+ /* all: revert */
339
+ }
340
+
341
+
342
+ .Editorright img {
343
+ display: block;
344
+ margin: 0 auto;
345
+ max-width: 100%;
346
+ }
347
+
348
+ .content {
349
+ height: 100%;
350
+ }
351
+
352
+ .layoutPreview .Editorright {
353
+ position: absolute;
354
+ width: 48%;
355
+ /* z-index: -999999; */
356
+ float: right;
357
+ top: 0;
358
+ right: 0;
359
+ width: 100%;
360
+ background-color: white;
361
+ }
362
+ .layoutPreview .Editorleft {
363
+ visibility: hidden;
364
+ opacity: 0;
365
+ }
366
+
367
+ .layoutPreview .content {
368
+ width: 75%;
369
+ margin: 0 auto;
370
+ height: 100%;
371
+ overflow-y: initial;
372
+ }
373
+ @keyframes App-logo-spin {
374
+ from {
375
+ transform: rotate(0deg);
376
+ }
377
+ to {
378
+ transform: rotate(360deg);
379
+ }
380
+ }
381
+
382
+ /* scrollbars */
383
+
384
+ .CodeMirror-vscrollbar {
385
+ user-select: none;
386
+ outline: none !important;
387
+ }
388
+
389
+ ::-webkit-scrollbar-thumb {
390
+ background-color: rgba(0, 0, 0, 0.1);
391
+ }
392
+ ::-webkit-scrollbar {
393
+ background-color: (0, 0, 0, 0.05);
394
+ }
395
+ ::-webkit-scrollbar-thumb:active {
396
+ background-color: rgba(0, 0, 0, 0.1);
397
+ }
398
+ ::-webkit-scrollbar {
399
+ width: 10px;
400
+ height: 10px;
401
+ -webkit-border-radius: 100px;
402
+ }
403
+ ::-webkit-scrollbar-thumb {
404
+ -webkit-border-radius: 100px;
405
+ }
406
+ ::-webkit-scrollbar-thumb:active {
407
+ -webkit-border-radius: 100px;
408
+ }
409
+ ::-webkit-scrollbar-corner {
410
+ background: transparent;
411
+ }
412
+
413
+ .CodeMirror-hints {
414
+ z-index: 1000;
415
+ border: none;
416
+ }
417
+ .editorApp .cm-header {
418
+ color: #000;
419
+ }
420
+ .editorApp .cm-header-1 {
421
+ font-size: 150%;
422
+ }
423
+ .cm-header-2 {
424
+ font-size: 130%;
425
+ }
426
+ .cm-header-3 {
427
+ font-size: 110%;
428
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const WindowWrapper: ({ children, title }: {
3
+ children: any;
4
+ title?: string;
5
+ }) => React.JSX.Element;
6
+ export default WindowWrapper;
package/esm/Wrapper.js ADDED
@@ -0,0 +1,146 @@
1
+ import React, { useRef } from 'react';
2
+ const WindowWrapper = ({ children, title = '' }) => {
3
+ const wrapperRef = useRef(null);
4
+ const handleCopy = async () => {
5
+ if (!wrapperRef.current)
6
+ return;
7
+ const html = wrapperRef.current.outerHTML;
8
+ try {
9
+ const svg = `
10
+ <svg xmlns="http://www.w3.org/2000/svg" width="800" height="600">
11
+ <foreignObject width="100%" height="100%">
12
+ <div xmlns="http://www.w3.org/1999/xhtml">
13
+ ${html}
14
+ </div>
15
+ </foreignObject>
16
+ </svg>
17
+ `.trim();
18
+ const dataURL = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(svg)))}`;
19
+ await navigator.clipboard.writeText(dataURL);
20
+ }
21
+ catch (err) {
22
+ console.error('Copy failed:', err);
23
+ }
24
+ };
25
+ const copyElementToClipboard = async () => {
26
+ if (!wrapperRef.current)
27
+ return;
28
+ try {
29
+ // setIsLoading(true);
30
+ const canvas = document.createElement('canvas');
31
+ const context = canvas.getContext('2d');
32
+ const element = wrapperRef.current;
33
+ const rect = element.getBoundingClientRect();
34
+ canvas.width = rect.width * 2;
35
+ canvas.height = rect.height * 2;
36
+ const svgData = `
37
+ <svg xmlns="http://www.w3.org/2000/svg" width="${rect.width}" height="${rect.height}">
38
+ <foreignObject width="100%" height="100%">
39
+ <div xmlns="http://www.w3.org/1999/xhtml">
40
+ ${element.outerHTML}
41
+ </div>
42
+ </foreignObject>
43
+ </svg>
44
+ `;
45
+ console.log('1');
46
+ const base64Data = btoa(unescape(encodeURIComponent(svgData)));
47
+ // const base64Data = btoa(encodeURIComponent(svgData));
48
+ const dataUrl = `data:image/svg+xml;base64,${base64Data}`;
49
+ console.log(dataUrl);
50
+ const image = new Image();
51
+ image.crossOrigin = 'anonymous';
52
+ console.log('2');
53
+ await new Promise((resolve, reject) => {
54
+ image.onload = resolve;
55
+ image.onerror = e => {
56
+ console.error('Image load error:', e);
57
+ reject(e);
58
+ };
59
+ image.src = dataUrl;
60
+ });
61
+ console.log('3');
62
+ if (context) {
63
+ context.scale(2, 2);
64
+ context.drawImage(image, 0, 0);
65
+ }
66
+ console.log('4');
67
+ const imageBlob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
68
+ if (imageBlob) {
69
+ await navigator.clipboard.write([new ClipboardItem({ 'image/png': imageBlob })]);
70
+ }
71
+ }
72
+ catch (err) {
73
+ console.error('Screenshot failed:', err);
74
+ }
75
+ finally {
76
+ // setIsLoading(false);
77
+ }
78
+ };
79
+ return (React.createElement("div", { className: "window", ref: wrapperRef },
80
+ React.createElement("div", { className: "titlebar" },
81
+ React.createElement("div", { className: "buttons" }),
82
+ title && React.createElement("span", { className: "title" }, title)),
83
+ React.createElement("div", { className: "content" }, children),
84
+ React.createElement("style", null, `
85
+ .window {
86
+ position: relative;
87
+ margin: 2rem;
88
+ border-radius: 6px;
89
+ background: white;
90
+ box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.2);
91
+ border: 1px solid #ccc;
92
+ }
93
+
94
+ .titlebar {
95
+ background: linear-gradient(to bottom, #f7f7f7, #e6e6e6);
96
+ padding: 8px 12px;
97
+ border-top-left-radius: 6px;
98
+ border-top-right-radius: 6px;
99
+ border-bottom: 1px solid #ccc;
100
+ display: flex;
101
+ align-items: center;
102
+ }
103
+
104
+ .buttons {
105
+ display: flex;
106
+ gap: 6px;
107
+ margin-right: 8px;
108
+ }
109
+
110
+ .buttons button {
111
+ width: 12px;
112
+ height: 12px;
113
+ border-radius: 50%;
114
+ border: none;
115
+ padding: 0;
116
+ cursor: pointer;
117
+ }
118
+
119
+ .close {
120
+ background: #ff5f56;
121
+ border: 1px solid #e0443e;
122
+ }
123
+
124
+ .minimize {
125
+ background: #ffbd2e;
126
+ border: 1px solid #dea123;
127
+ }
128
+
129
+ .maximize {
130
+ background: #27c93f;
131
+ border: 1px solid #1aab29;
132
+ }
133
+
134
+ .title {
135
+ color: #4d4d4d;
136
+ font-size: 13px;
137
+ margin-left: 4px;
138
+ }
139
+
140
+ .content {
141
+ padding: 16px;
142
+ }
143
+ `)));
144
+ };
145
+ export default WindowWrapper;
146
+ //# sourceMappingURL=Wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wrapper.js","sourceRoot":"","sources":["../src/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAErC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC/C,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;QAC5B,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAM;QAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAA;QAEzC,IAAI;YACF,MAAM,GAAG,GAAG;;;;oBAIE,IAAI;;;;WAIb,CAAC,IAAI,EAAE,CAAA;YAEZ,MAAM,OAAO,GAAG,6BAA6B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;YACtF,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;SAC7C;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;SACnC;IACH,CAAC,CAAA;IAED,MAAM,sBAAsB,GAAG,KAAK,IAAI,EAAE;QACxC,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAM;QAE/B,IAAI;YACF,wBAAwB;YAExB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;YAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;YACvC,MAAM,OAAO,GAA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