markmap-view 0.15.0 → 0.15.3
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/dist/browser/index.js +19 -14
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! markmap-view v0.15.
|
|
1
|
+
/*! markmap-view v0.15.3 | MIT License */
|
|
2
2
|
(function (exports, d3) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! markmap-common v0.15.
|
|
5
|
+
/*! markmap-common v0.15.3 | MIT License */
|
|
6
6
|
function _extends$1() {
|
|
7
7
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
8
8
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -27,18 +27,23 @@ class UrlBuilder {
|
|
|
27
27
|
this.providers = _extends$1({}, defaultProviders);
|
|
28
28
|
this.provider = "jsdelivr";
|
|
29
29
|
}
|
|
30
|
-
getFastestProvider(path = testPath) {
|
|
31
|
-
return Promise
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
getFastestProvider(timeout = 5e3, path = testPath) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
Promise.all(Object.entries(this.providers).map(async ([name, factory]) => {
|
|
33
|
+
try {
|
|
34
|
+
const res = await fetch(factory(path));
|
|
35
|
+
if (!res.ok) {
|
|
36
|
+
throw res;
|
|
37
|
+
}
|
|
38
|
+
await res.text();
|
|
39
|
+
resolve(name);
|
|
40
|
+
} catch (_unused) {}
|
|
41
|
+
})).then(() => reject(new Error("All providers failed")));
|
|
42
|
+
setTimeout(reject, timeout, new Error("Timed out"));
|
|
43
|
+
});
|
|
39
44
|
}
|
|
40
|
-
async findFastestProvider() {
|
|
41
|
-
this.provider = await this.getFastestProvider();
|
|
45
|
+
async findFastestProvider(timeout) {
|
|
46
|
+
this.provider = await this.getFastestProvider(timeout);
|
|
42
47
|
return this.provider;
|
|
43
48
|
}
|
|
44
49
|
setProvider(name, factory) {
|
|
@@ -1230,7 +1235,7 @@ class Markmap {
|
|
|
1230
1235
|
};
|
|
1231
1236
|
this.handleClick = (e, d) => {
|
|
1232
1237
|
let recursive = this.options.toggleRecursively;
|
|
1233
|
-
if (e.ctrlKey) recursive = !recursive;
|
|
1238
|
+
if (isMacintosh ? e.metaKey : e.ctrlKey) recursive = !recursive;
|
|
1234
1239
|
this.toggleNode(d.data, recursive);
|
|
1235
1240
|
};
|
|
1236
1241
|
this.viewHooks = createViewHooks();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-view v0.15.
|
|
1
|
+
/*! markmap-view v0.15.3 | MIT License */
|
|
2
2
|
import { Hook, getId, addClass, walkTree, childSelector, noop } from 'markmap-common';
|
|
3
3
|
export { loadCSS, loadJS } from 'markmap-common';
|
|
4
4
|
import { scaleOrdinal, schemeCategory10, zoomTransform, select, zoom, linkHorizontal, min, max, zoomIdentity, minIndex } from 'd3';
|
|
@@ -870,7 +870,7 @@ class Markmap {
|
|
|
870
870
|
};
|
|
871
871
|
this.handleClick = (e, d) => {
|
|
872
872
|
let recursive = this.options.toggleRecursively;
|
|
873
|
-
if (e.ctrlKey) recursive = !recursive;
|
|
873
|
+
if (isMacintosh ? e.metaKey : e.ctrlKey) recursive = !recursive;
|
|
874
874
|
this.toggleNode(d.data, recursive);
|
|
875
875
|
};
|
|
876
876
|
this.viewHooks = createViewHooks();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-view",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "View markmaps in browser",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/d3-flextree": "^2.1.1",
|
|
49
|
-
"markmap-common": "0.15.
|
|
49
|
+
"markmap-common": "0.15.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"markmap-common": "*"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "428254f2f36d56a89a3e161658f079d74dd16d15"
|
|
55
55
|
}
|