lakelib 0.3.4 → 0.3.6
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 +4 -4
- package/dist/lake.min.css +15 -15
- package/dist/lake.min.js +19 -19
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +408 -38
- package/lib/lake.d.ts +17 -13
- package/lib/lake.js +165 -204
- package/lib/lake.js.map +1 -1
- package/package.json +9 -9
package/lib/lake.js
CHANGED
|
@@ -37,7 +37,7 @@ var checkCircle = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height
|
|
|
37
37
|
|
|
38
38
|
var warningCircle = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z\"></path></svg>";
|
|
39
39
|
|
|
40
|
-
var open = "<svg width=\"24\" height=\"24\" fill=\"
|
|
40
|
+
var open = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z\"/></svg>";
|
|
41
41
|
|
|
42
42
|
var download = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z\"></path></svg>";
|
|
43
43
|
|
|
@@ -109,9 +109,9 @@ var underline$1 = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height
|
|
|
109
109
|
|
|
110
110
|
var strikethrough$1 = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z\"></path></svg>";
|
|
111
111
|
|
|
112
|
-
var superscript$1 = "<svg width=\"24\" height=\"24\" fill=\"
|
|
112
|
+
var superscript$1 = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z\"/><path d=\"M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z\"/></svg>";
|
|
113
113
|
|
|
114
|
-
var subscript$1 = "<svg width=\"24\" height=\"24\" fill=\"
|
|
114
|
+
var subscript$1 = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z\"/></svg>";
|
|
115
115
|
|
|
116
116
|
var code$1 = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z\"></path></svg>";
|
|
117
117
|
|
|
@@ -123,13 +123,13 @@ var fontColor$1 = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 2
|
|
|
123
123
|
|
|
124
124
|
var fontColorAccent = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><rect width=\"256\" height=\"256\" fill=\"none\"/><line x1=\"40\" y1=\"216\" x2=\"216\" y2=\"216\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"16\"/></svg>";
|
|
125
125
|
|
|
126
|
-
var highlight$1 = "<svg width=\"24\" height=\"24\" fill=\"
|
|
126
|
+
var highlight$1 = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z\"/><path d=\"M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z\"/></svg>";
|
|
127
127
|
|
|
128
|
-
var highlightAccent = "<svg width=\"24\" height=\"24\" fill=\"
|
|
128
|
+
var highlightAccent = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z\"/></svg>";
|
|
129
129
|
|
|
130
|
-
var backgroundColor = "<svg width=\"24\" height=\"24\" fill=\"
|
|
130
|
+
var backgroundColor = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 12.414V17.5A2.5 2.5 0 0 0 4.5 20h15a2.5 2.5 0 0 0 2.5-2.5v-11A2.5 2.5 0 0 0 19.5 4h-8.944l1.5 1.5H19.5a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3.586l-1.5-1.5Z\"/><path d=\"M6 1.75a.75.75 0 1 1 1.5 0v1.265c.45.04.89.233 1.235.578l3.536 3.536a2 2 0 0 1 0 2.828L8.027 14.2a2 2 0 0 1-2.829 0l-3.535-3.536a2 2 0 0 1 0-2.828l4.243-4.243c.03-.03.061-.06.093-.087V1.75Zm0 4.5v-.629l-2.89 2.89h8.245a.498.498 0 0 0-.145-.322L7.674 4.654A.498.498 0 0 0 7.5 4.54v1.71a.75.75 0 0 1-1.5 0Zm-2.868 3.76 3.128 3.13a.5.5 0 0 0 .707 0l3.129-3.13H3.132ZM11 13.375c0-.493.154-.972.342-1.381.19-.416.438-.806.673-1.134.238-.331.474-.613.65-.812.085-.097.24-.261.299-.323l.005-.005a.75.75 0 0 1 1.061 0l.305.328c.176.199.412.48.649.812.236.328.483.718.674 1.134.188.409.342.888.342 1.381C16 14.765 14.97 16 13.5 16c-1.471 0-2.5-1.235-2.5-2.625Zm2.234-1.64c-.202.28-.392.585-.53.885-.14.305-.204.56-.204.755 0 .691.48 1.125 1 1.125.519 0 1-.434 1-1.125 0-.194-.065-.45-.205-.755a5.494 5.494 0 0 0-.53-.886 8.417 8.417 0 0 0-.265-.35 8.33 8.33 0 0 0-.266.35Z\"/></svg>";
|
|
131
131
|
|
|
132
|
-
var backgroundColorAccent = "<svg width=\"24\" height=\"24\" fill=\"
|
|
132
|
+
var backgroundColorAccent = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.978 6.422a2.99 2.99 0 0 1 .878 2.115c.323.066.63.225.881.476l.013.013.326.35.008.01c.192.216.45.525.712.89.26.36.545.808.77 1.3.22.478.434 1.106.434 1.799C17 15.232 15.606 17 13.5 17c-2.008 0-3.37-1.608-3.491-3.367l-1.274 1.274a3 3 0 0 1-4.243 0L3 13.415V17.5A1.5 1.5 0 0 0 4.5 19h15a1.5 1.5 0 0 0 1.5-1.5v-11A1.5 1.5 0 0 0 19.5 5h-7.944l1.422 1.422Z\"/></svg>";
|
|
133
133
|
|
|
134
134
|
var link$1 = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z\"></path></svg>";
|
|
135
135
|
|
|
@@ -167,9 +167,9 @@ var tableColumn = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height
|
|
|
167
167
|
|
|
168
168
|
var tableRow = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M208,136H48a16,16,0,0,0-16,16v40a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V152A16,16,0,0,0,208,136Zm0,56H48V152H208v40Zm0-144H48A16,16,0,0,0,32,64v40a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V64A16,16,0,0,0,208,48Zm0,56H48V64H208v40Z\"></path></svg>";
|
|
169
169
|
|
|
170
|
-
var tableMerge = "<svg width=\"24\" height=\"24\" fill=\"
|
|
170
|
+
var tableMerge = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.25 3A3.25 3.25 0 0 0 3 6.25v11.5A3.25 3.25 0 0 0 6.25 21h11.5A3.25 3.25 0 0 0 21 17.75V6.25A3.25 3.25 0 0 0 17.75 3H6.25ZM4.5 6.25c0-.966.784-1.75 1.75-1.75H11v3H4.5V6.25Zm8 10.25h7v1.25a1.75 1.75 0 0 1-1.75 1.75H12.5v-3Zm7-9h-7v-3h5.25c.966 0 1.75.784 1.75 1.75V7.5Zm-8.5 9v3H6.25a1.75 1.75 0 0 1-1.75-1.75V16.5H11ZM4.5 9h15v6h-15V9Z\"/></svg>";
|
|
171
171
|
|
|
172
|
-
var tableSplit = "<svg width=\"24\" height=\"24\" fill=\"
|
|
172
|
+
var tableSplit = "<svg width=\"24\" height=\"24\" fill=\"#000000\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.5 10H11v4h1.5v-4Z\" fill=\"#212121\"/><path d=\"M3 6.25A3.25 3.25 0 0 1 6.25 3h11.5A3.25 3.25 0 0 1 21 6.25v11.5A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25ZM6.25 4.5A1.75 1.75 0 0 0 4.5 6.25V7.5H11v-3H6.25Zm13.25 12h-7v3h5.25a1.75 1.75 0 0 0 1.75-1.75V16.5Zm0-10.25a1.75 1.75 0 0 0-1.75-1.75H12.5v3h7V6.25ZM4.5 16.5v1.25c0 .966.784 1.75 1.75 1.75H11v-3H4.5Zm0-1.5h15V9h-15v6Z\"/></svg>";
|
|
173
173
|
|
|
174
174
|
var info = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"#000000\" viewBox=\"0 0 256 256\"><path d=\"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z\"></path></svg>";
|
|
175
175
|
|
|
@@ -194,8 +194,6 @@ var danger = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32
|
|
|
194
194
|
//
|
|
195
195
|
// Phosphor Icons (https://phosphoricons.com/).
|
|
196
196
|
// - other icons
|
|
197
|
-
// eslint-disable-next-line ts/ban-ts-comment
|
|
198
|
-
// @ts-nocheck
|
|
199
197
|
// common
|
|
200
198
|
const icons = new Map([
|
|
201
199
|
// common
|
|
@@ -280,7 +278,7 @@ const icons = new Map([
|
|
|
280
278
|
['tableRow', tableRow],
|
|
281
279
|
['tableMerge', tableMerge],
|
|
282
280
|
['tableSplit', tableSplit],
|
|
283
|
-
//
|
|
281
|
+
// alert
|
|
284
282
|
['info', info],
|
|
285
283
|
['tip', tip],
|
|
286
284
|
['warning', warning],
|
|
@@ -2460,7 +2458,7 @@ const moreStyleMenuItems = [
|
|
|
2460
2458
|
},
|
|
2461
2459
|
];
|
|
2462
2460
|
// These colors are sourced from Ant Design (https://ant.design/docs/spec/colors)
|
|
2463
|
-
const colors = [
|
|
2461
|
+
const colors$1 = [
|
|
2464
2462
|
// Dust Red, Volcano, Sunset Orange, Calendula Gold, Sunrise Yellow, Lime, Polar Green, Cyan, Daybreak Blue, Geek Blue, Golden Purple, Magenta
|
|
2465
2463
|
'#f5222d', '#fa541c', '#fa8c16', '#faad14', '#fadb14', '#a0d911', '#52c41a', '#13c2c2', '#1677ff', '#2f54eb', '#722ed1', '#eb2f96', // color 6
|
|
2466
2464
|
'#fff1f0', '#fff2e8', '#fff7e6', '#fffbe6', '#feffe6', '#fcffe6', '#f6ffed', '#e6fffb', '#e6f4ff', '#f0f5ff', '#f9f0ff', '#fff0f6', // color 1
|
|
@@ -2482,7 +2480,7 @@ const colorMenuItems = [
|
|
|
2482
2480
|
text: locale => locale.toolbar.removeColor(),
|
|
2483
2481
|
},
|
|
2484
2482
|
];
|
|
2485
|
-
for (const color of colors) {
|
|
2483
|
+
for (const color of colors$1) {
|
|
2486
2484
|
colorMenuItems.push({
|
|
2487
2485
|
value: color.toLowerCase(),
|
|
2488
2486
|
text: color.toUpperCase(),
|
|
@@ -6275,7 +6273,7 @@ function removeBox(range) {
|
|
|
6275
6273
|
return box;
|
|
6276
6274
|
}
|
|
6277
6275
|
|
|
6278
|
-
var version = "0.3.
|
|
6276
|
+
var version = "0.3.6";
|
|
6279
6277
|
|
|
6280
6278
|
// Converts the custom HTML tags to the special tags that can not be parsed by browser.
|
|
6281
6279
|
function denormalizeValue(value) {
|
|
@@ -6667,7 +6665,7 @@ Repository: https://github.com/bigskysoftware/idiomorph
|
|
|
6667
6665
|
*/
|
|
6668
6666
|
const EMPTY_SET = new Set();
|
|
6669
6667
|
function noOp() { }
|
|
6670
|
-
//
|
|
6668
|
+
// Default configuration values, updatable by users now.
|
|
6671
6669
|
const defaults = {
|
|
6672
6670
|
morphStyle: 'outerHTML',
|
|
6673
6671
|
callbacks: {
|
|
@@ -6689,9 +6687,9 @@ const defaults = {
|
|
|
6689
6687
|
afterHeadMorphed: noOp,
|
|
6690
6688
|
},
|
|
6691
6689
|
};
|
|
6692
|
-
|
|
6690
|
+
/**
|
|
6693
6691
|
Deep merges the config object and the Idiomoroph.defaults object to
|
|
6694
|
-
produce a final configuration object
|
|
6692
|
+
produce a final configuration object.
|
|
6695
6693
|
*/
|
|
6696
6694
|
function mergeDefaults(config) {
|
|
6697
6695
|
const finalConfig = {};
|
|
@@ -6728,21 +6726,18 @@ function getIdIntersectionCount(ctx, node1, node2) {
|
|
|
6728
6726
|
const sourceSet = ctx.idMap.get(node1) || EMPTY_SET;
|
|
6729
6727
|
let matchCount = 0;
|
|
6730
6728
|
for (const id of sourceSet) {
|
|
6731
|
-
//
|
|
6732
|
-
// that has not already been merged into the DOM
|
|
6729
|
+
// A potential match is an id in the source and potentialIdsSet, but
|
|
6730
|
+
// that has not already been merged into the DOM.
|
|
6733
6731
|
if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {
|
|
6734
6732
|
++matchCount;
|
|
6735
6733
|
}
|
|
6736
6734
|
}
|
|
6737
6735
|
return matchCount;
|
|
6738
6736
|
}
|
|
6739
|
-
|
|
6737
|
+
/**
|
|
6740
6738
|
* A bottom up algorithm that finds all elements with ids inside of the node
|
|
6741
6739
|
* argument and populates id sets for those nodes and all their parents, generating
|
|
6742
|
-
* a set of ids contained within all nodes for the entire hierarchy in the DOM
|
|
6743
|
-
*
|
|
6744
|
-
* @param node {Element}
|
|
6745
|
-
* @param {Map<Node, Set<String>>} idMap
|
|
6740
|
+
* a set of ids contained within all nodes for the entire hierarchy in the DOM.
|
|
6746
6741
|
*/
|
|
6747
6742
|
function populateIdMapForNode(node, idMap) {
|
|
6748
6743
|
const nodeParent = node.parentElement;
|
|
@@ -6764,15 +6759,15 @@ function populateIdMapForNode(node, idMap) {
|
|
|
6764
6759
|
}
|
|
6765
6760
|
}
|
|
6766
6761
|
}
|
|
6767
|
-
|
|
6762
|
+
/**
|
|
6768
6763
|
* This function computes a map of nodes to all ids contained within that node (inclusive of the
|
|
6769
6764
|
* node). This map can be used to ask if two nodes have intersecting sets of ids, which allows
|
|
6770
6765
|
* for a looser definition of "matching" than tradition id matching, and allows child nodes
|
|
6771
6766
|
* to contribute to a parent nodes matching.
|
|
6772
6767
|
*
|
|
6773
|
-
* @param
|
|
6774
|
-
* @param
|
|
6775
|
-
* @returns
|
|
6768
|
+
* @param oldContent The old content that will be morphed.
|
|
6769
|
+
* @param newContent The new content to morph to.
|
|
6770
|
+
* @returns A map of nodes to id sets.
|
|
6776
6771
|
*/
|
|
6777
6772
|
function createIdMap(oldContent, newContent) {
|
|
6778
6773
|
const idMap = new Map();
|
|
@@ -6815,8 +6810,9 @@ function isSoftMatch(node1, node2) {
|
|
|
6815
6810
|
}
|
|
6816
6811
|
function removeNode(tempNode, ctx) {
|
|
6817
6812
|
removeIdsFromConsideration(ctx, tempNode);
|
|
6818
|
-
if (ctx.callbacks.beforeNodeRemoved(tempNode) === false)
|
|
6813
|
+
if (ctx.callbacks.beforeNodeRemoved(tempNode) === false) {
|
|
6819
6814
|
return;
|
|
6815
|
+
}
|
|
6820
6816
|
tempNode.remove();
|
|
6821
6817
|
ctx.callbacks.afterNodeRemoved(tempNode);
|
|
6822
6818
|
}
|
|
@@ -6830,12 +6826,12 @@ function removeNodesBetween(startInclusive, endExclusive, ctx) {
|
|
|
6830
6826
|
removeIdsFromConsideration(ctx, endExclusive);
|
|
6831
6827
|
return endExclusive.nextSibling;
|
|
6832
6828
|
}
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6829
|
+
/**
|
|
6830
|
+
* Scans forward from the insertionPoint in the old parent looking for a potential id match
|
|
6831
|
+
* for the newChild. We stop if we find a potential id match for the new child OR
|
|
6832
|
+
* if the number of potential id matches we are discarding is greater than the
|
|
6833
|
+
* potential id matches for the new child.
|
|
6834
|
+
*/
|
|
6839
6835
|
function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
|
|
6840
6836
|
// max id matches we are willing to discard in our search
|
|
6841
6837
|
const newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);
|
|
@@ -6866,12 +6862,12 @@ function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
|
|
|
6866
6862
|
}
|
|
6867
6863
|
return potentialMatch;
|
|
6868
6864
|
}
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6865
|
+
/**
|
|
6866
|
+
* Scans forward from the insertionPoint in the old parent looking for a potential soft match
|
|
6867
|
+
* for the newChild. We stop if we find a potential soft match for the new child OR
|
|
6868
|
+
* if we find a potential id match in the old parents children OR if we find two
|
|
6869
|
+
* potential soft matches for the next two pieces of new content.
|
|
6870
|
+
*/
|
|
6875
6871
|
function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {
|
|
6876
6872
|
let potentialSoftMatch = insertionPoint;
|
|
6877
6873
|
let nextSibling = newChild.nextSibling;
|
|
@@ -6981,12 +6977,12 @@ function findBestNodeMatch(newContent, oldNode, ctx) {
|
|
|
6981
6977
|
// =============================================================================
|
|
6982
6978
|
// Attribute Syncing Code
|
|
6983
6979
|
// =============================================================================
|
|
6984
|
-
|
|
6985
|
-
* @param attr
|
|
6986
|
-
* @param to
|
|
6987
|
-
* @param updateType
|
|
6988
|
-
* @param ctx
|
|
6989
|
-
* @returns
|
|
6980
|
+
/**
|
|
6981
|
+
* @param attr The attribute to be mutated.
|
|
6982
|
+
* @param to The element that is going to be updated.
|
|
6983
|
+
* @param updateType 'update' or 'remove'
|
|
6984
|
+
* @param ctx The merge context.
|
|
6985
|
+
* @returns True if the attribute should be ignored, false otherwise.
|
|
6990
6986
|
*/
|
|
6991
6987
|
function ignoreAttribute(attr, to, updateType, ctx) {
|
|
6992
6988
|
if (attr === 'value' && ctx.ignoreActiveValue && to === document.activeElement) {
|
|
@@ -6994,21 +6990,20 @@ function ignoreAttribute(attr, to, updateType, ctx) {
|
|
|
6994
6990
|
}
|
|
6995
6991
|
return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;
|
|
6996
6992
|
}
|
|
6997
|
-
|
|
6993
|
+
/**
|
|
6998
6994
|
* @param possibleActiveElement
|
|
6999
6995
|
* @param ctx
|
|
7000
|
-
* @returns {boolean}
|
|
7001
6996
|
*/
|
|
7002
6997
|
function ignoreValueOfActiveElement(possibleActiveElement, ctx) {
|
|
7003
6998
|
return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement;
|
|
7004
6999
|
}
|
|
7005
|
-
|
|
7006
|
-
*
|
|
7007
|
-
* inner element state from the 'from' node to the 'to' node
|
|
7000
|
+
/**
|
|
7001
|
+
* Syncs a given node with another node, copying over all attributes and
|
|
7002
|
+
* inner element state from the 'from' node to the 'to' node.
|
|
7008
7003
|
*
|
|
7009
|
-
* @param
|
|
7010
|
-
* @param
|
|
7011
|
-
* @param ctx
|
|
7004
|
+
* @param from The element to copy attributes & state from.
|
|
7005
|
+
* @param to The element to copy attributes & state to.
|
|
7006
|
+
* @param ctx The merge context.
|
|
7012
7007
|
*/
|
|
7013
7008
|
function syncNodeFrom(from, to, ctx) {
|
|
7014
7009
|
const type = from.nodeType;
|
|
@@ -7045,11 +7040,11 @@ function syncNodeFrom(from, to, ctx) {
|
|
|
7045
7040
|
}
|
|
7046
7041
|
}
|
|
7047
7042
|
}
|
|
7048
|
-
|
|
7049
|
-
* @param oldNode
|
|
7050
|
-
* @param newContent
|
|
7051
|
-
* @param ctx
|
|
7052
|
-
* @returns
|
|
7043
|
+
/**
|
|
7044
|
+
* @param oldNode Root node to merge content into.
|
|
7045
|
+
* @param newContent New content to merge.
|
|
7046
|
+
* @param ctx The merge context.
|
|
7047
|
+
* @returns The element that ended up in the DOM.
|
|
7053
7048
|
*/
|
|
7054
7049
|
function morphOldNodeTo(oldNode, newContent, ctx) {
|
|
7055
7050
|
var _a;
|
|
@@ -7082,27 +7077,27 @@ function morphOldNodeTo(oldNode, newContent, ctx) {
|
|
|
7082
7077
|
return oldNode;
|
|
7083
7078
|
}
|
|
7084
7079
|
}
|
|
7085
|
-
|
|
7086
|
-
* This is the core algorithm for matching up children.
|
|
7087
|
-
* nodes as faithfully as possible.
|
|
7080
|
+
/**
|
|
7081
|
+
* This is the core algorithm for matching up children. The idea is to use id sets to try to match up
|
|
7082
|
+
* nodes as faithfully as possible. We greedily match, which allows us to keep the algorithm fast, but
|
|
7088
7083
|
* by using id sets, we are able to better match up with content deeper in the DOM.
|
|
7089
7084
|
*
|
|
7090
7085
|
* Basic algorithm is, for each node in the new content:
|
|
7091
7086
|
*
|
|
7092
|
-
* -
|
|
7093
|
-
* -
|
|
7094
|
-
* -
|
|
7095
|
-
* -
|
|
7096
|
-
* -
|
|
7097
|
-
* -
|
|
7098
|
-
* -
|
|
7087
|
+
* - If we have reached the end of the old parent, append the new content.
|
|
7088
|
+
* - If the new content has an id set match with the current insertion point, morph.
|
|
7089
|
+
* - Search for an id set match.
|
|
7090
|
+
* - If id set match found, morph.
|
|
7091
|
+
* - Otherwise search for a "soft" match.
|
|
7092
|
+
* - If a soft match is found, morph.
|
|
7093
|
+
* - Otherwise, prepend the new node before the current insertion point.
|
|
7099
7094
|
*
|
|
7100
7095
|
* The two search algorithms terminate if competing node matches appear to outweigh what can be achieved
|
|
7101
|
-
* with the current node.
|
|
7096
|
+
* with the current node. See findIdSetMatch() and findSoftMatch() for details.
|
|
7102
7097
|
*
|
|
7103
|
-
* @param
|
|
7104
|
-
* @param
|
|
7105
|
-
* @param ctx
|
|
7098
|
+
* @param newParent The parent element of the new content.
|
|
7099
|
+
* @param oldParent The old content that we are merging the new content into.
|
|
7100
|
+
* @param ctx The merge context.
|
|
7106
7101
|
*/
|
|
7107
7102
|
function morphChildren(newParent, oldParent, ctx) {
|
|
7108
7103
|
let nextNewChild = newParent.firstChild;
|
|
@@ -7167,28 +7162,25 @@ function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {
|
|
|
7167
7162
|
morphChildren(normalizedNewContent, oldNode, ctx);
|
|
7168
7163
|
return oldNode.children;
|
|
7169
7164
|
}
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
if
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
return [];
|
|
7186
|
-
}
|
|
7187
|
-
throw `Do not understand how to morph style ${ctx.morphStyle}`;
|
|
7165
|
+
// otherwise find the best element match in the new content, morph that, and merge its siblings
|
|
7166
|
+
// into either side of the best match
|
|
7167
|
+
const bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);
|
|
7168
|
+
// stash the siblings that will need to be inserted on either side of the best match
|
|
7169
|
+
const previousSibling = bestMatch === null || bestMatch === void 0 ? void 0 : bestMatch.previousSibling;
|
|
7170
|
+
const nextSibling = bestMatch === null || bestMatch === void 0 ? void 0 : bestMatch.nextSibling;
|
|
7171
|
+
// morph it
|
|
7172
|
+
const morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);
|
|
7173
|
+
if (bestMatch) {
|
|
7174
|
+
// if there was a best match, merge the siblings in too and return the
|
|
7175
|
+
// whole bunch
|
|
7176
|
+
return insertSiblings(previousSibling, morphedNode, nextSibling);
|
|
7177
|
+
}
|
|
7178
|
+
// otherwise nothing was added to the DOM
|
|
7179
|
+
return [];
|
|
7188
7180
|
}
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7181
|
+
/**
|
|
7182
|
+
* Morphs one DOM tree to another.
|
|
7183
|
+
*/
|
|
7192
7184
|
function morph(node, otherNode, config = {}) {
|
|
7193
7185
|
const normalizedContent = normalizeContent(otherNode.get(0));
|
|
7194
7186
|
const ctx = createMorphContext(node.get(0), normalizedContent, config);
|
|
@@ -7732,37 +7724,7 @@ class Editor {
|
|
|
7732
7724
|
* Triggers the statechange event when the current selection is changed.
|
|
7733
7725
|
*/
|
|
7734
7726
|
this.emitStateChangeEvent = debounce(() => {
|
|
7735
|
-
const
|
|
7736
|
-
let activeItems = this.selection.getActiveItems();
|
|
7737
|
-
if (activeItems.length > 0 && !this.container.contains(activeItems[0].node)) {
|
|
7738
|
-
activeItems = [];
|
|
7739
|
-
}
|
|
7740
|
-
const disabledNameMap = new Map();
|
|
7741
|
-
const selectedNameMap = new Map();
|
|
7742
|
-
const selectedValuesMap = new Map();
|
|
7743
|
-
if (activeItems.length > 0) {
|
|
7744
|
-
for (const name of commandNames) {
|
|
7745
|
-
const commandItem = this.command.getItem(name);
|
|
7746
|
-
if (commandItem.isDisabled && commandItem.isDisabled(activeItems)) {
|
|
7747
|
-
disabledNameMap.set(name, true);
|
|
7748
|
-
}
|
|
7749
|
-
if (commandItem.isSelected && commandItem.isSelected(activeItems)) {
|
|
7750
|
-
selectedNameMap.set(name, true);
|
|
7751
|
-
}
|
|
7752
|
-
if (commandItem.selectedValues) {
|
|
7753
|
-
const values = commandItem.selectedValues(activeItems);
|
|
7754
|
-
if (values.length > 0) {
|
|
7755
|
-
selectedValuesMap.set(name, values);
|
|
7756
|
-
}
|
|
7757
|
-
}
|
|
7758
|
-
}
|
|
7759
|
-
}
|
|
7760
|
-
const state = {
|
|
7761
|
-
activeItems,
|
|
7762
|
-
disabledNameMap,
|
|
7763
|
-
selectedNameMap,
|
|
7764
|
-
selectedValuesMap,
|
|
7765
|
-
};
|
|
7727
|
+
const state = this.getState();
|
|
7766
7728
|
if (isEqual(state, this.state)) {
|
|
7767
7729
|
return;
|
|
7768
7730
|
}
|
|
@@ -8103,6 +8065,40 @@ class Editor {
|
|
|
8103
8065
|
blur() {
|
|
8104
8066
|
this.container.blur();
|
|
8105
8067
|
}
|
|
8068
|
+
/**
|
|
8069
|
+
* Returns the state of the current selection.
|
|
8070
|
+
*/
|
|
8071
|
+
getState() {
|
|
8072
|
+
const commandNames = this.command.getNames();
|
|
8073
|
+
let activeItems = this.selection.getActiveItems();
|
|
8074
|
+
if (activeItems.length > 0 && !this.container.contains(activeItems[0].node)) {
|
|
8075
|
+
activeItems = [];
|
|
8076
|
+
}
|
|
8077
|
+
const disabledNameMap = new Map();
|
|
8078
|
+
const selectedNameMap = new Map();
|
|
8079
|
+
const selectedValuesMap = new Map();
|
|
8080
|
+
for (const name of commandNames) {
|
|
8081
|
+
const commandItem = this.command.getItem(name);
|
|
8082
|
+
if (commandItem.isDisabled && commandItem.isDisabled(activeItems)) {
|
|
8083
|
+
disabledNameMap.set(name, true);
|
|
8084
|
+
}
|
|
8085
|
+
if (commandItem.isSelected && commandItem.isSelected(activeItems)) {
|
|
8086
|
+
selectedNameMap.set(name, true);
|
|
8087
|
+
}
|
|
8088
|
+
if (activeItems.length > 0 && commandItem.selectedValues) {
|
|
8089
|
+
const values = commandItem.selectedValues(activeItems);
|
|
8090
|
+
if (values.length > 0) {
|
|
8091
|
+
selectedValuesMap.set(name, values);
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
}
|
|
8095
|
+
return {
|
|
8096
|
+
activeItems,
|
|
8097
|
+
disabledNameMap,
|
|
8098
|
+
selectedNameMap,
|
|
8099
|
+
selectedValuesMap,
|
|
8100
|
+
};
|
|
8101
|
+
}
|
|
8106
8102
|
/**
|
|
8107
8103
|
* Sets the specified content to the editor.
|
|
8108
8104
|
*/
|
|
@@ -8148,6 +8144,8 @@ class Editor {
|
|
|
8148
8144
|
this.renderBoxes();
|
|
8149
8145
|
if (this.toolbar) {
|
|
8150
8146
|
this.toolbar.render(this);
|
|
8147
|
+
const state = this.getState();
|
|
8148
|
+
this.toolbar.updateState(state);
|
|
8151
8149
|
}
|
|
8152
8150
|
document.addEventListener('copy', this.copyListener);
|
|
8153
8151
|
if (!this.readonly) {
|
|
@@ -10460,81 +10458,27 @@ var hr = (editor) => {
|
|
|
10460
10458
|
});
|
|
10461
10459
|
};
|
|
10462
10460
|
|
|
10463
|
-
const config = {
|
|
10464
|
-
comment: '#57606a',
|
|
10465
|
-
name: '#444d56',
|
|
10466
|
-
variableName: '#953800',
|
|
10467
|
-
typeName: '#0550ae',
|
|
10468
|
-
propertyName: '#444d56',
|
|
10469
|
-
className: '#24292e',
|
|
10470
|
-
labelName: '#005cc5',
|
|
10471
|
-
namespace: '#0550ae',
|
|
10472
|
-
macroName: '#444d56',
|
|
10473
|
-
literal: '#444d56',
|
|
10474
|
-
string: '#0a3069',
|
|
10475
|
-
number: '#0550ae',
|
|
10476
|
-
bool: '#0550ae',
|
|
10477
|
-
regexp: '#116329',
|
|
10478
|
-
color: '#0550ae',
|
|
10479
|
-
keyword: '#cf222e',
|
|
10480
|
-
modifier: '#24292f',
|
|
10481
|
-
operator: '#cf222e',
|
|
10482
|
-
bracket: '#57606a',
|
|
10483
|
-
content: '#57606a',
|
|
10484
|
-
meta: '#8250df',
|
|
10485
|
-
heading: '#0550ae',
|
|
10486
|
-
invalid: '#f6f8fa',
|
|
10487
|
-
definition: '#cf222e',
|
|
10488
|
-
constant: '#0550ae',
|
|
10489
|
-
function: '#005cc5',
|
|
10490
|
-
standard: '#444d56',
|
|
10491
|
-
special: '#444d56',
|
|
10492
|
-
};
|
|
10493
10461
|
// https://lezer.codemirror.net/docs/ref/#highlight.tags
|
|
10494
|
-
function getHighlightStyle(CodeMirror) {
|
|
10462
|
+
function getHighlightStyle(CodeMirror, colors) {
|
|
10495
10463
|
const { HighlightStyle, tags } = CodeMirror;
|
|
10496
10464
|
return HighlightStyle.define([
|
|
10497
|
-
{ tag: [tags.
|
|
10498
|
-
{ tag: [tags.name], color:
|
|
10499
|
-
{ tag: [tags.variableName, tags.
|
|
10500
|
-
{ tag: [tags.
|
|
10501
|
-
{ tag: [tags.
|
|
10502
|
-
{ tag: [tags.className], color:
|
|
10503
|
-
{ tag: [tags.
|
|
10504
|
-
{ tag: [tags.
|
|
10505
|
-
{ tag: [tags.
|
|
10506
|
-
{ tag: [tags.
|
|
10507
|
-
{ tag: [tags.
|
|
10508
|
-
{ tag: [tags.
|
|
10509
|
-
{ tag: [tags.
|
|
10510
|
-
{ tag: [tags.
|
|
10511
|
-
{ tag: [tags.
|
|
10512
|
-
{ tag: [
|
|
10513
|
-
|
|
10514
|
-
tags.definitionKeyword, tags.moduleKeyword,
|
|
10515
|
-
], color: config.keyword },
|
|
10516
|
-
{ tag: [tags.modifier], color: config.modifier },
|
|
10517
|
-
{ tag: [
|
|
10518
|
-
tags.operator, tags.derefOperator, tags.arithmeticOperator, tags.logicOperator, tags.bitwiseOperator,
|
|
10519
|
-
tags.compareOperator, tags.updateOperator, tags.definitionOperator, tags.typeOperator, tags.controlOperator,
|
|
10520
|
-
], color: config.operator },
|
|
10521
|
-
{ tag: [
|
|
10522
|
-
tags.punctuation, tags.separator, tags.bracket, tags.angleBracket, tags.squareBracket,
|
|
10523
|
-
tags.paren, tags.brace, tags.contentSeparator,
|
|
10524
|
-
], color: config.bracket },
|
|
10525
|
-
{ tag: [tags.content], color: config.content },
|
|
10526
|
-
{ tag: [tags.meta, tags.documentMeta, tags.annotation, tags.processingInstruction], color: config.meta },
|
|
10527
|
-
{ tag: tags.heading, fontWeight: 'bold', color: config.heading },
|
|
10528
|
-
{ tag: tags.strong, fontWeight: 'bold' },
|
|
10529
|
-
{ tag: tags.emphasis, fontStyle: 'italic' },
|
|
10530
|
-
{ tag: tags.link, textDecoration: 'underline' },
|
|
10531
|
-
{ tag: tags.strikethrough, textDecoration: 'line-through' },
|
|
10532
|
-
{ tag: [tags.invalid, tags.inserted, tags.deleted, tags.changed], color: config.invalid },
|
|
10533
|
-
{ tag: [tags.definition(tags.name)], color: config.definition },
|
|
10534
|
-
{ tag: [tags.constant(tags.name)], color: config.constant },
|
|
10535
|
-
{ tag: [tags.function(tags.variableName)], color: config.function },
|
|
10536
|
-
{ tag: [tags.standard(tags.name)], color: config.standard },
|
|
10537
|
-
{ tag: [tags.special(tags.variableName)], color: config.special },
|
|
10465
|
+
{ tag: [tags.keyword], color: colors.keyword },
|
|
10466
|
+
{ tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName], color: colors.name },
|
|
10467
|
+
{ tag: [tags.function(tags.variableName), tags.labelName], color: colors.function },
|
|
10468
|
+
{ tag: [tags.constant(tags.name), tags.color, tags.standard(tags.name)], color: colors.constant },
|
|
10469
|
+
{ tag: [tags.definition(tags.name), tags.separator], color: colors.definition },
|
|
10470
|
+
{ tag: [tags.typeName, tags.className, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace], color: colors.type },
|
|
10471
|
+
{ tag: [tags.operator, tags.operatorKeyword, tags.url, tags.escape, tags.regexp, tags.link, tags.special(tags.string)], color: colors.operator },
|
|
10472
|
+
{ tag: [tags.comment, tags.meta], color: colors.comment },
|
|
10473
|
+
{ tag: [tags.strong], fontWeight: 'bold' },
|
|
10474
|
+
{ tag: [tags.emphasis], fontStyle: 'italic' },
|
|
10475
|
+
{ tag: [tags.strikethrough], textDecoration: 'line-through' },
|
|
10476
|
+
{ tag: [tags.link], textDecoration: 'underline' },
|
|
10477
|
+
{ tag: [tags.heading], fontWeight: 'bold', color: colors.heading },
|
|
10478
|
+
{ tag: [tags.bool, tags.atom, tags.special(tags.variableName)], color: colors.boolean },
|
|
10479
|
+
{ tag: [tags.string, tags.processingInstruction, tags.inserted], color: colors.string },
|
|
10480
|
+
{ tag: [tags.number], color: colors.number },
|
|
10481
|
+
{ tag: [tags.invalid], color: colors.invalid },
|
|
10538
10482
|
]);
|
|
10539
10483
|
}
|
|
10540
10484
|
var codeBlockBox = {
|
|
@@ -10570,8 +10514,8 @@ var codeBlockBox = {
|
|
|
10570
10514
|
}
|
|
10571
10515
|
const { EditorState, Compartment, EditorView, keymap, history, defaultKeymap, historyKeymap, indentWithTab, syntaxHighlighting, } = CodeMirror;
|
|
10572
10516
|
const defaultLangItems = CodeMirror.langItems;
|
|
10573
|
-
const
|
|
10574
|
-
const langItems = defaultLangItems.filter((item) =>
|
|
10517
|
+
const { langList, defaultLang, colors } = editor.config.codeBlock;
|
|
10518
|
+
const langItems = defaultLangItems.filter((item) => langList.indexOf(item.value) >= 0);
|
|
10575
10519
|
// language menu items
|
|
10576
10520
|
const langItemMap = new Map();
|
|
10577
10521
|
for (const item of langItems) {
|
|
@@ -10608,7 +10552,7 @@ var codeBlockBox = {
|
|
|
10608
10552
|
...historyKeymap,
|
|
10609
10553
|
indentWithTab,
|
|
10610
10554
|
]),
|
|
10611
|
-
syntaxHighlighting(getHighlightStyle(CodeMirror)),
|
|
10555
|
+
syntaxHighlighting(getHighlightStyle(CodeMirror, colors)),
|
|
10612
10556
|
language.of(langItem && langItem.component ? langItem.component() : []),
|
|
10613
10557
|
updateListener,
|
|
10614
10558
|
],
|
|
@@ -10618,7 +10562,7 @@ var codeBlockBox = {
|
|
|
10618
10562
|
root: rootNode,
|
|
10619
10563
|
name: 'langType',
|
|
10620
10564
|
downIcon: icons.get('down'),
|
|
10621
|
-
defaultValue: langItem ? boxValue.lang :
|
|
10565
|
+
defaultValue: langItem ? boxValue.lang : defaultLang,
|
|
10622
10566
|
tooltip: editor.locale.codeBlock.langType(),
|
|
10623
10567
|
location: 'global',
|
|
10624
10568
|
menuType: 'list',
|
|
@@ -10672,6 +10616,21 @@ const langList = [
|
|
|
10672
10616
|
'xml',
|
|
10673
10617
|
'yaml',
|
|
10674
10618
|
];
|
|
10619
|
+
const colors = {
|
|
10620
|
+
keyword: 'var(--lake-code-highlight-keyword)',
|
|
10621
|
+
name: 'var(--lake-code-highlight-name)',
|
|
10622
|
+
function: 'var(--lake-code-highlight-function)',
|
|
10623
|
+
constant: 'var(--lake-code-highlight-constant)',
|
|
10624
|
+
definition: 'var(--lake-code-highlight-definition)',
|
|
10625
|
+
type: 'var(--lake-code-highlight-type)',
|
|
10626
|
+
operator: 'var(--lake-code-highlight-operator)',
|
|
10627
|
+
comment: 'var(--lake-code-highlight-comment)',
|
|
10628
|
+
heading: 'var(--lake-code-highlight-heading)',
|
|
10629
|
+
boolean: 'var(--lake-code-highlight-boolean)',
|
|
10630
|
+
string: 'var(--lake-code-highlight-string)',
|
|
10631
|
+
number: 'var(--lake-code-highlight-number)',
|
|
10632
|
+
invalid: 'var(--lake-code-highlight-invalid)',
|
|
10633
|
+
};
|
|
10675
10634
|
var codeBlock = (editor) => {
|
|
10676
10635
|
if (!window.LakeCodeMirror) {
|
|
10677
10636
|
return;
|
|
@@ -10679,6 +10638,7 @@ var codeBlock = (editor) => {
|
|
|
10679
10638
|
editor.setPluginConfig('codeBlock', {
|
|
10680
10639
|
langList,
|
|
10681
10640
|
defaultLang: 'text',
|
|
10641
|
+
colors,
|
|
10682
10642
|
});
|
|
10683
10643
|
if (editor.readonly) {
|
|
10684
10644
|
return;
|
|
@@ -11407,7 +11367,7 @@ var imageBox = {
|
|
|
11407
11367
|
var image = (editor) => {
|
|
11408
11368
|
editor.setPluginConfig('image', {
|
|
11409
11369
|
requestMethod: 'POST',
|
|
11410
|
-
requestTypes: ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml'],
|
|
11370
|
+
requestTypes: ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml', 'image/webp'],
|
|
11411
11371
|
});
|
|
11412
11372
|
if (editor.readonly) {
|
|
11413
11373
|
return;
|
|
@@ -11718,6 +11678,7 @@ var file = (editor) => {
|
|
|
11718
11678
|
'image/jpeg',
|
|
11719
11679
|
'image/png',
|
|
11720
11680
|
'image/svg+xml',
|
|
11681
|
+
'image/webp',
|
|
11721
11682
|
'text/plain',
|
|
11722
11683
|
'text/html',
|
|
11723
11684
|
'application/pdf',
|