markmap-view-plus 0.0.6 → 0.0.7
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/action.d.ts +1 -1
- package/dist/browser/index.js +12 -17
- package/dist/index.js +17 -21
- package/package.json +1 -1
package/dist/action.d.ts
CHANGED
package/dist/browser/index.js
CHANGED
|
@@ -1229,10 +1229,13 @@
|
|
|
1229
1229
|
const svgEl = this.ctx.svg.node();
|
|
1230
1230
|
const scale = svgEl ? (0, d3.zoomTransform)(svgEl).k : 1;
|
|
1231
1231
|
const btnSize = Math.round(16 * scale);
|
|
1232
|
-
const fontSize = Math.round(14 * scale);
|
|
1233
1232
|
this.addUI.btn.style.width = `${btnSize}px`;
|
|
1234
1233
|
this.addUI.btn.style.height = `${btnSize}px`;
|
|
1235
|
-
this.addUI.btn.
|
|
1234
|
+
const svg = this.addUI.btn.querySelector("svg");
|
|
1235
|
+
if (svg) {
|
|
1236
|
+
svg.setAttribute("width", `${btnSize}`);
|
|
1237
|
+
svg.setAttribute("height", `${btnSize}`);
|
|
1238
|
+
}
|
|
1236
1239
|
this._positionOverlayToEl(this.addUI.wrap, contentEl, {
|
|
1237
1240
|
anchor: "br",
|
|
1238
1241
|
dx: Math.round(14 * scale),
|
|
@@ -1301,29 +1304,21 @@
|
|
|
1301
1304
|
const svgEl = this.ctx.svg.node();
|
|
1302
1305
|
const scale = svgEl ? (0, d3.zoomTransform)(svgEl).k : 1;
|
|
1303
1306
|
const btnSize = Math.round(16 * scale);
|
|
1304
|
-
const
|
|
1305
|
-
const btn = document.createElement("button");
|
|
1306
|
-
btn.type = "button";
|
|
1307
|
+
const btn = document.createElement("div");
|
|
1307
1308
|
btn.className = "markmap-add-btn";
|
|
1308
|
-
btn.
|
|
1309
|
+
btn.innerHTML = `<svg width="${btnSize}" height="${btnSize}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1310
|
+
<circle cx="8" cy="8" r="8" fill="#b4b4b4"/>
|
|
1311
|
+
<path d="M8 4.5V11.5M4.5 8H11.5" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1312
|
+
</svg>`;
|
|
1309
1313
|
btn.style.cssText = `
|
|
1310
1314
|
width: ${btnSize}px;
|
|
1311
1315
|
height: ${btnSize}px;
|
|
1312
|
-
border-radius: 50%;
|
|
1313
|
-
background: #b4b4b4;
|
|
1314
|
-
color: #fff;
|
|
1315
|
-
font-weight: 600;
|
|
1316
|
-
font-size: ${fontSize}px;
|
|
1317
|
-
line-height: 1;
|
|
1318
|
-
padding: 0;
|
|
1319
1316
|
cursor: pointer;
|
|
1320
|
-
|
|
1321
|
-
outline: none;
|
|
1322
|
-
border: none;
|
|
1323
|
-
user-select: none;
|
|
1317
|
+
padding: 0;
|
|
1324
1318
|
display: flex;
|
|
1325
1319
|
align-items: center;
|
|
1326
1320
|
justify-content: center;
|
|
1321
|
+
user-select: none;
|
|
1327
1322
|
`;
|
|
1328
1323
|
btn.addEventListener("click", (e) => {
|
|
1329
1324
|
e.preventDefault();
|
package/dist/index.js
CHANGED
|
@@ -899,8 +899,10 @@ var Re = (e, t = 0) => (e.y = t, (e.children || []).reduce((t, n) => {
|
|
|
899
899
|
if (this.addUI) {
|
|
900
900
|
let e = this._getNodeContentEl(this.addUI.node);
|
|
901
901
|
if (e) {
|
|
902
|
-
let t = this.ctx.svg.node(), n = t ? l(t).k : 1, r = Math.round(16 * n)
|
|
903
|
-
this.addUI.btn.style.width = `${r}px`, this.addUI.btn.style.height = `${r}px
|
|
902
|
+
let t = this.ctx.svg.node(), n = t ? l(t).k : 1, r = Math.round(16 * n);
|
|
903
|
+
this.addUI.btn.style.width = `${r}px`, this.addUI.btn.style.height = `${r}px`;
|
|
904
|
+
let i = this.addUI.btn.querySelector("svg");
|
|
905
|
+
i && (i.setAttribute("width", `${r}`), i.setAttribute("height", `${r}`)), this._positionOverlayToEl(this.addUI.wrap, e, {
|
|
904
906
|
anchor: "br",
|
|
905
907
|
dx: Math.round(14 * n),
|
|
906
908
|
dy: 0
|
|
@@ -944,43 +946,37 @@ var Re = (e, t = 0) => (e.y = t, (e.children || []).reduce((t, n) => {
|
|
|
944
946
|
this.hideAddUI();
|
|
945
947
|
let n = this._getOverlayRoot(), r = document.createElement("div");
|
|
946
948
|
r.style.cssText = "\n position: absolute;\n z-index: 9999;\n pointer-events: auto;\n ";
|
|
947
|
-
let i = this.ctx.svg.node(), a = i ? l(i).k : 1, o = Math.round(16 * a), s =
|
|
948
|
-
|
|
949
|
+
let i = this.ctx.svg.node(), a = i ? l(i).k : 1, o = Math.round(16 * a), s = document.createElement("div");
|
|
950
|
+
s.className = "markmap-add-btn", s.innerHTML = `<svg width="${o}" height="${o}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
951
|
+
<circle cx="8" cy="8" r="8" fill="#b4b4b4"/>
|
|
952
|
+
<path d="M8 4.5V11.5M4.5 8H11.5" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
953
|
+
</svg>`, s.style.cssText = `
|
|
949
954
|
width: ${o}px;
|
|
950
955
|
height: ${o}px;
|
|
951
|
-
border-radius: 50%;
|
|
952
|
-
background: #b4b4b4;
|
|
953
|
-
color: #fff;
|
|
954
|
-
font-weight: 600;
|
|
955
|
-
font-size: ${s}px;
|
|
956
|
-
line-height: 1;
|
|
957
|
-
padding: 0;
|
|
958
956
|
cursor: pointer;
|
|
959
|
-
|
|
960
|
-
outline: none;
|
|
961
|
-
border: none;
|
|
962
|
-
user-select: none;
|
|
957
|
+
padding: 0;
|
|
963
958
|
display: flex;
|
|
964
959
|
align-items: center;
|
|
965
960
|
justify-content: center;
|
|
966
|
-
|
|
961
|
+
user-select: none;
|
|
962
|
+
`, s.addEventListener("click", (t) => {
|
|
967
963
|
t.preventDefault(), t.stopPropagation(), this.showAddInput(e);
|
|
968
|
-
}), r.style.transform = "translate(-50%, -50%)", r.appendChild(
|
|
964
|
+
}), r.style.transform = "translate(-50%, -50%)", r.appendChild(s), n.appendChild(r), this._positionOverlayToEl(r, t, {
|
|
969
965
|
anchor: "br",
|
|
970
966
|
dx: Math.round(14 * a),
|
|
971
967
|
dy: 0
|
|
972
968
|
});
|
|
973
|
-
let
|
|
969
|
+
let c = (t) => {
|
|
974
970
|
let n = t.target;
|
|
975
971
|
if (!n || r.contains(n) || this.addInputUI?.wrap.contains(n)) return;
|
|
976
972
|
let i = this._getNodeContentEl(e);
|
|
977
973
|
i && i.contains(n) || this.hideAddUI();
|
|
978
974
|
};
|
|
979
|
-
document.addEventListener("click",
|
|
975
|
+
document.addEventListener("click", c, !0), this.addUI = {
|
|
980
976
|
node: e,
|
|
981
|
-
btn:
|
|
977
|
+
btn: s,
|
|
982
978
|
wrap: r,
|
|
983
|
-
cleanupDoc: () => document.removeEventListener("click",
|
|
979
|
+
cleanupDoc: () => document.removeEventListener("click", c, !0)
|
|
984
980
|
};
|
|
985
981
|
}
|
|
986
982
|
/** Delete `node` from the tree and re-render. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-view-plus",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "markmap-plus is an enhanced version of markmap-view with node creation, editing, and deletion capabilities",
|
|
5
5
|
"author": "Lin Jiman <temman_lin@qq.com>",
|
|
6
6
|
"license": "MIT",
|