lakelib 0.0.6 → 0.1.0
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 +14 -62
- package/dist/lake.css +65 -34
- package/dist/lake.min.js +9 -9
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +65 -34
- package/lib/lake.js +60 -21
- package/lib/lake.js.map +1 -1
- package/package.json +28 -42
- package/dist/codemirror.min.js +0 -1
package/README.md
CHANGED
|
@@ -1,82 +1,34 @@
|
|
|
1
|
-
> This project is not complete yet, please DO NOT integrate it into your production.
|
|
2
|
-
|
|
3
1
|
# Lake
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#### Downloading Lake from CDN
|
|
10
|
-
|
|
11
|
-
Compressed copies of Lake files are available, you can download them from jsDelivr or UNPKG.
|
|
3
|
+
[](https://github.com/lakejs/lake/actions)
|
|
4
|
+
[](https://npmjs.org/package/lakelib)
|
|
5
|
+
[](https://bundlephobia.com/package/lakelib)
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
* UNPKG: https://unpkg.com/browse/lakelib@latest/dist/
|
|
15
|
-
|
|
16
|
-
Note: `lake.min.js` is not built with CodeMirror, so if you need the code block feature, addtioanaly including `codemirror.min.js` to your page is needed. But if you do not need it, there is no need to include external CodeMirror file. To find out more, take a look at the [IIFE example](https://github.com/lakejs/lake/blob/master/examples/iife.html) and [Rollup configuration](https://github.com/lakejs/lake/blob/master/rollup.config.mjs).
|
|
17
|
-
|
|
18
|
-
#### Downloading Lake using npm
|
|
19
|
-
|
|
20
|
-
Lake is registered as a package on npm. You can install the latest version of Lake with the following npm command.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install lakelib
|
|
24
|
-
```
|
|
7
|
+
---
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
First, add the following lines of code in the `<head>` of an HTML page.
|
|
29
|
-
|
|
30
|
-
```html
|
|
31
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lakelib@latest/dist/lake.css" />
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/npm/lakelib@latest/dist/lake.min.js"></script>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Then, in the HTML page add the following HTML code that will serve as a placeholder for an editor instance.
|
|
36
|
-
|
|
37
|
-
```html
|
|
38
|
-
<div class="lake-editor">
|
|
39
|
-
<div class="lake-toolbar-root"></div>
|
|
40
|
-
<div class="lake-root"></div>
|
|
41
|
-
</div>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Finally, call the following JavaScript code to render the editor.
|
|
9
|
+
Lake is a rich text editor for the web. It has a good user experience and provides easy-to-use programming interface to allow further extension.
|
|
45
10
|
|
|
46
|
-
|
|
47
|
-
const toolbar = new Lake.Toolbar({
|
|
48
|
-
root: '.lake-toolbar-root',
|
|
49
|
-
});
|
|
50
|
-
const editor = new Lake.Editor({
|
|
51
|
-
root: '.lake-root',
|
|
52
|
-
toolbar,
|
|
53
|
-
});
|
|
54
|
-
editor.render();
|
|
55
|
-
```
|
|
11
|
+
[Examples](https://lakejs.org/examples/) · [Getting started](https://lakejs.org/guide/getting-started.html) · [Reference](https://lakejs.org/reference/)
|
|
56
12
|
|
|
57
|
-
|
|
13
|
+
## Development
|
|
58
14
|
|
|
59
15
|
To build Lake or change source code, you need to download the repository and start a development server that contains an HTTP service and real-time bundling.
|
|
60
16
|
|
|
61
17
|
``` bash
|
|
62
|
-
#
|
|
18
|
+
# Clone the repository
|
|
63
19
|
git clone https://github.com/lakejs/lake.git
|
|
64
|
-
#
|
|
65
|
-
cd lake
|
|
66
|
-
# install all dependencies
|
|
20
|
+
# Install dependencies
|
|
67
21
|
pnpm install
|
|
68
|
-
#
|
|
69
|
-
pnpm build:codemirror
|
|
70
|
-
# start a local server
|
|
22
|
+
# Start a local server
|
|
71
23
|
pnpm dev
|
|
72
24
|
```
|
|
73
25
|
|
|
74
26
|
You can now view all demos by visiting `http://localhost:8080/examples/`.
|
|
75
27
|
|
|
76
|
-
|
|
28
|
+
## Running tests
|
|
77
29
|
|
|
78
|
-
Lake uses a lot of browser APIs and therefore it requires a real browser environment to run the tests. You can open `http://localhost:8080/tests/` to run all test cases visibly, or execute `pnpm test` command in your console to run the tests in headless mode.
|
|
30
|
+
Lake uses a lot of browser APIs and therefore it requires a real browser environment to run the tests. You can open `http://localhost:8080/tests/` to run all test cases visibly, or execute `pnpm test` command in your console to run the tests in headless mode.
|
|
79
31
|
|
|
80
|
-
|
|
32
|
+
## License
|
|
81
33
|
|
|
82
|
-
[MIT](https://github.com/lakejs/lake/blob/
|
|
34
|
+
[MIT](https://github.com/lakejs/lake/blob/main/LICENSE)
|
package/dist/lake.css
CHANGED
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.lake-container {
|
|
36
|
+
box-sizing: content-box;
|
|
36
37
|
font-family: var(--font-family);
|
|
37
38
|
font-size: 16px;
|
|
38
|
-
|
|
39
|
+
font-weight: normal;
|
|
40
|
+
line-height: normal;
|
|
39
41
|
padding: 16px 24px;
|
|
40
42
|
}
|
|
41
43
|
.lake-container:focus {
|
|
@@ -91,10 +93,11 @@
|
|
|
91
93
|
background-color: #0000000a;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
.lake-button {
|
|
96
|
+
button.lake-button {
|
|
97
|
+
box-sizing: content-box;
|
|
95
98
|
border-radius: 5px;
|
|
96
99
|
border: 0;
|
|
97
|
-
font-family:
|
|
100
|
+
font-family: Arial;
|
|
98
101
|
font-size: 14px;
|
|
99
102
|
color: var(--text-color);
|
|
100
103
|
background-color: #fff;
|
|
@@ -104,41 +107,42 @@
|
|
|
104
107
|
cursor: pointer;
|
|
105
108
|
user-select: none;
|
|
106
109
|
}
|
|
107
|
-
.lake-button:focus-visible {
|
|
110
|
+
button.lake-button:focus-visible {
|
|
108
111
|
outline: var(--button-outline);
|
|
109
112
|
}
|
|
110
|
-
.lake-button[disabled] {
|
|
113
|
+
button.lake-button[disabled] {
|
|
111
114
|
opacity: 0.25;
|
|
112
115
|
cursor: default;
|
|
113
116
|
}
|
|
114
|
-
.lake-button svg {
|
|
117
|
+
button.lake-button svg {
|
|
118
|
+
display: inline-block;
|
|
115
119
|
width: 16px;
|
|
116
120
|
height: 16px;
|
|
117
121
|
margin: 6px;
|
|
118
122
|
}
|
|
119
|
-
.lake-icon-button.lake-button-hovered {
|
|
123
|
+
button.lake-icon-button.lake-button-hovered {
|
|
120
124
|
background-color: var(--background-hover-color);
|
|
121
125
|
}
|
|
122
|
-
.lake-icon-button.lake-button-selected {
|
|
126
|
+
button.lake-icon-button.lake-button-selected {
|
|
123
127
|
background-color: var(--background-active-color);
|
|
124
128
|
}
|
|
125
|
-
.lake-text-button {
|
|
129
|
+
button.lake-text-button {
|
|
126
130
|
background-color: transparent;
|
|
127
131
|
border: 1px solid var(--border-color);
|
|
128
132
|
padding: 8px 16px;
|
|
129
133
|
}
|
|
130
|
-
.lake-text-button.lake-button-hovered {
|
|
134
|
+
button.lake-text-button.lake-button-hovered {
|
|
131
135
|
background-color: var(--background-hover-color);
|
|
132
136
|
}
|
|
133
|
-
.lake-text-button.lake-button-selected {
|
|
137
|
+
button.lake-text-button.lake-button-selected {
|
|
134
138
|
background-color: var(--background-active-color);
|
|
135
139
|
}
|
|
136
|
-
.lake-text-button svg {
|
|
140
|
+
button.lake-text-button svg {
|
|
137
141
|
background-color: transparent;
|
|
138
142
|
margin: 0 6px 0 0;
|
|
139
143
|
vertical-align: middle;
|
|
140
144
|
}
|
|
141
|
-
.lake-text-button span {
|
|
145
|
+
button.lake-text-button span {
|
|
142
146
|
display: inline-block;
|
|
143
147
|
line-height: 16px;
|
|
144
148
|
vertical-align: middle;
|
|
@@ -151,30 +155,34 @@
|
|
|
151
155
|
font-size: 14px;
|
|
152
156
|
user-select: none;
|
|
153
157
|
}
|
|
154
|
-
.lake-dropdown .lake-dropdown-title {
|
|
155
|
-
|
|
156
|
-
align-items: center;
|
|
157
|
-
justify-content: space-between;
|
|
158
|
-
padding: 0;
|
|
159
|
-
margin-right: 4px;
|
|
158
|
+
.lake-dropdown button.lake-dropdown-title {
|
|
159
|
+
box-sizing: content-box;
|
|
160
160
|
border-radius: 5px;
|
|
161
161
|
border: 0;
|
|
162
|
+
font-family: Arial;
|
|
162
163
|
font-size: 14px;
|
|
164
|
+
color: var(--text-color);
|
|
163
165
|
background-color: #fff;
|
|
166
|
+
padding: 0;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
margin-right: 4px;
|
|
164
171
|
cursor: pointer;
|
|
165
172
|
}
|
|
166
|
-
.lake-dropdown[disabled] .lake-dropdown-title {
|
|
173
|
+
.lake-dropdown[disabled] button.lake-dropdown-title {
|
|
167
174
|
opacity: 0.25;
|
|
168
175
|
cursor: default;
|
|
169
176
|
}
|
|
170
|
-
.lake-dropdown.lake-list-dropdown .lake-dropdown-title-hovered {
|
|
177
|
+
.lake-dropdown.lake-list-dropdown button.lake-dropdown-title-hovered {
|
|
171
178
|
background-color: var(--background-hover-color);
|
|
172
179
|
}
|
|
173
|
-
.lake-dropdown .lake-dropdown-title.lake-dropdown-title-no-down {
|
|
180
|
+
.lake-dropdown button.lake-dropdown-title.lake-dropdown-title-no-down {
|
|
174
181
|
margin-right: 0;
|
|
175
182
|
}
|
|
176
183
|
.lake-dropdown .lake-dropdown-text {
|
|
177
184
|
height: 16px;
|
|
185
|
+
line-height: normal;
|
|
178
186
|
margin: 6px;
|
|
179
187
|
overflow: hidden;
|
|
180
188
|
white-space: nowrap;
|
|
@@ -199,8 +207,8 @@
|
|
|
199
207
|
left: 0;
|
|
200
208
|
bottom: 0;
|
|
201
209
|
}
|
|
202
|
-
.lake-dropdown .lake-dropdown-title-no-down .lake-dropdown-icon svg,
|
|
203
|
-
.lake-dropdown .lake-dropdown-title-no-down .lake-dropdown-icon img {
|
|
210
|
+
.lake-dropdown button.lake-dropdown-title-no-down .lake-dropdown-icon svg,
|
|
211
|
+
.lake-dropdown button.lake-dropdown-title-no-down .lake-dropdown-icon img {
|
|
204
212
|
margin: 6px;
|
|
205
213
|
}
|
|
206
214
|
.lake-dropdown .lake-dropdown-down-icon {
|
|
@@ -217,6 +225,7 @@
|
|
|
217
225
|
fill: var(--secondary-text-color);
|
|
218
226
|
}
|
|
219
227
|
.lake-dropdown .lake-dropdown-menu {
|
|
228
|
+
box-sizing: content-box;
|
|
220
229
|
position: absolute;
|
|
221
230
|
top: 30px;
|
|
222
231
|
left: 0;
|
|
@@ -235,9 +244,9 @@
|
|
|
235
244
|
display: flex;
|
|
236
245
|
align-items: center;
|
|
237
246
|
cursor: pointer;
|
|
247
|
+
margin: 0;
|
|
238
248
|
}
|
|
239
249
|
.lake-dropdown .lake-list-dropdown-menu li {
|
|
240
|
-
margin: 0;
|
|
241
250
|
padding: 6px 24px 6px 10px;
|
|
242
251
|
}
|
|
243
252
|
.lake-dropdown .lake-list-dropdown-menu li.lake-dropdown-item-hovered {
|
|
@@ -308,6 +317,7 @@
|
|
|
308
317
|
}
|
|
309
318
|
.lake-dropdown .lake-color-dropdown-menu li .lake-dropdown-menu-text {
|
|
310
319
|
font-size: 0;
|
|
320
|
+
box-sizing: content-box;
|
|
311
321
|
border: 1px solid var(--background-hover-color);
|
|
312
322
|
border-radius: 2px;
|
|
313
323
|
width: 16px;
|
|
@@ -330,11 +340,18 @@
|
|
|
330
340
|
height: auto;
|
|
331
341
|
}
|
|
332
342
|
|
|
343
|
+
.lake-popup {
|
|
344
|
+
font-family: var(--font-family);
|
|
345
|
+
font-size: 14px;
|
|
346
|
+
font-weight: normal;
|
|
347
|
+
line-height: normal;
|
|
348
|
+
color: var(--text-color);
|
|
349
|
+
}
|
|
333
350
|
.lake-popup input[type="text"] {
|
|
351
|
+
box-sizing: content-box;
|
|
334
352
|
font-family: var(--font-family);
|
|
335
353
|
font-size: 14px;
|
|
336
354
|
color: var(--text-color);
|
|
337
|
-
width: 200px;
|
|
338
355
|
border-radius: 5px;
|
|
339
356
|
border: 1px solid var(--input-border-color);
|
|
340
357
|
padding: 4px 10px;
|
|
@@ -361,8 +378,9 @@
|
|
|
361
378
|
.lake-container h4,
|
|
362
379
|
.lake-container h5,
|
|
363
380
|
.lake-container h6 {
|
|
364
|
-
color: #000000e0;
|
|
365
381
|
font-weight: bold;
|
|
382
|
+
line-height: normal;
|
|
383
|
+
border: 0;
|
|
366
384
|
margin: 0;
|
|
367
385
|
padding: 0;
|
|
368
386
|
}
|
|
@@ -478,6 +496,7 @@
|
|
|
478
496
|
padding-left: 24px;
|
|
479
497
|
}
|
|
480
498
|
.lake-container ul[type="checklist"] li::before {
|
|
499
|
+
box-sizing: content-box;
|
|
481
500
|
content: '';
|
|
482
501
|
position: absolute;
|
|
483
502
|
top: 3px;
|
|
@@ -495,6 +514,7 @@
|
|
|
495
514
|
background-color: #fff;
|
|
496
515
|
}
|
|
497
516
|
.lake-container ul[type="checklist"] li::after {
|
|
517
|
+
box-sizing: content-box;
|
|
498
518
|
content: '';
|
|
499
519
|
position: absolute;
|
|
500
520
|
top: 3px;
|
|
@@ -516,6 +536,7 @@
|
|
|
516
536
|
}
|
|
517
537
|
|
|
518
538
|
.lake-container blockquote {
|
|
539
|
+
box-sizing: content-box;
|
|
519
540
|
margin: 0;
|
|
520
541
|
margin-bottom: 8px;
|
|
521
542
|
padding: 8px 12px;
|
|
@@ -526,24 +547,27 @@
|
|
|
526
547
|
color: var(--text-color);
|
|
527
548
|
border-radius: 8px;
|
|
528
549
|
}
|
|
550
|
+
.lake-container blockquote[type="info"],
|
|
551
|
+
.lake-container blockquote[type="tip"] {
|
|
552
|
+
background-color: #e6f4ff;
|
|
553
|
+
border: 1px solid #91caff;
|
|
554
|
+
}
|
|
529
555
|
.lake-container blockquote[type="success"] {
|
|
530
556
|
background-color: #f6ffed;
|
|
531
557
|
border: 1px solid #b7eb8f;
|
|
532
558
|
}
|
|
533
|
-
.lake-container blockquote[type="info"] {
|
|
534
|
-
background-color: #e6f4ff;
|
|
535
|
-
border: 1px solid #91caff;
|
|
536
|
-
}
|
|
537
559
|
.lake-container blockquote[type="warning"] {
|
|
538
560
|
background-color: #fffbe6;
|
|
539
561
|
border: 1px solid #ffe58f;
|
|
540
562
|
}
|
|
541
|
-
.lake-container blockquote[type="error"]
|
|
563
|
+
.lake-container blockquote[type="error"],
|
|
564
|
+
.lake-container blockquote[type="danger"] {
|
|
542
565
|
background-color: #fff2f0;
|
|
543
566
|
border: 1px solid #ffccc7;
|
|
544
567
|
}
|
|
545
568
|
|
|
546
569
|
.lake-container table {
|
|
570
|
+
box-sizing: content-box;
|
|
547
571
|
border-collapse: collapse;
|
|
548
572
|
border: 1px solid var(--border-color);
|
|
549
573
|
margin-bottom: 8px;
|
|
@@ -639,11 +663,11 @@ lake-box[name="hr"] .lake-box-focused .lake-hr {
|
|
|
639
663
|
.lake-image {
|
|
640
664
|
position: relative;
|
|
641
665
|
line-height: 0;
|
|
666
|
+
box-sizing: content-box;
|
|
642
667
|
border: 1px solid transparent;
|
|
643
668
|
border-radius: 4px;
|
|
644
669
|
}
|
|
645
670
|
.lake-image .lake-image-img {
|
|
646
|
-
box-sizing: border-box;
|
|
647
671
|
border: 0;
|
|
648
672
|
border-radius: 4px;
|
|
649
673
|
width: 100%;
|
|
@@ -862,6 +886,8 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
|
|
|
862
886
|
}
|
|
863
887
|
.lake-code-block .lake-dropdown .lake-dropdown-menu {
|
|
864
888
|
top: 24px;
|
|
889
|
+
left: auto;
|
|
890
|
+
right: 0;
|
|
865
891
|
overflow-y: scroll;
|
|
866
892
|
scrollbar-width: thin;
|
|
867
893
|
height: 200px;
|
|
@@ -879,6 +905,7 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
|
|
|
879
905
|
top: 0;
|
|
880
906
|
left: 0;
|
|
881
907
|
z-index: 1;
|
|
908
|
+
box-sizing: content-box;
|
|
882
909
|
border: 1px solid var(--border-color);
|
|
883
910
|
border-radius: 5px;
|
|
884
911
|
padding: 16px;
|
|
@@ -917,13 +944,17 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
|
|
|
917
944
|
}
|
|
918
945
|
|
|
919
946
|
.lake-toolbar {
|
|
920
|
-
|
|
947
|
+
font-family: var(--font-family);
|
|
948
|
+
font-size: 14px;
|
|
949
|
+
font-weight: normal;
|
|
950
|
+
line-height: normal;
|
|
921
951
|
padding: 4px;
|
|
922
952
|
display: flex;
|
|
923
953
|
flex-wrap: wrap;
|
|
924
954
|
align-items: center;
|
|
925
955
|
}
|
|
926
956
|
.lake-toolbar .lake-toolbar-divider {
|
|
957
|
+
box-sizing: content-box;
|
|
927
958
|
width: 1px;
|
|
928
959
|
height: 20px;
|
|
929
960
|
margin: 0 4px;
|