25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2971 lines
183 KiB

/*!
* ====================================================
* kityminder-editor - v1.0.67 - 2021-01-07
* https://github.com/fex-team/kityminder-editor
* GitHub: https://github.com/fex-team/kityminder-editor
* Copyright (c) 2021 ; Licensed
* ====================================================
*/
!
function() {
var d = {
r: function(e) {
if (d[e].inited) return d[e].value;
if ("function" != typeof d[e].value) return d[e].inited = !0,
d[e].value;
var t = {
exports: {}
},
n = d[e].value(null, t.exports, t);
if (d[e].inited = !0, void 0 !== (d[e].value = n)) return n;
for (var i in t.exports) if (t.exports.hasOwnProperty(i)) return d[e].inited = !0,
d[e].value = t.exports,
t.exports
}
};
d[0] = {
value: function(e, t, n) {
var i = [];
function r(e) {
i.push(e)
}
function o(e) {
this.selector = e;
for (var t = 0; t < i.length; t++)"function" == typeof i[t] && i[t].call(this, this)
}
return (o.assemble = r)(d.r(7)),
r(d.r(9)),
r(d.r(14)),
r(d.r(18)),
r(d.r(11)),
r(d.r(12)),
r(d.r(5)),
r(d.r(6)),
r(d.r(8)),
r(d.r(15)),
r(d.r(10)),
r(d.r(13)),
r(d.r(16)),
r(d.r(17)),
n.exports = o
}
},
d[1] = {
value: function(e, t, n) {
return n.exports = kityminder.Editor = d.r(0)
}
},
d[2] = {
value: function(e, t, n) {
return n.exports = window.HotBox
}
},
d[3] = {
value: function(e, t, n) {}
},
d[4] = {
value: function(e, t, n) {
return n.exports = window.kityminder.Minder
}
},
d[5] = {
value: function(e, t, n) {
function i() {
var n = "\ufeff",
i = {
"application/km": "￿"
},
r = {
"\ufeff": "SPLITOR",
"￿": "application/km"
};
function o(e, t) {
if (!this.isPureText(t)) {
if (!this.whichMimeType(t)) throw new Error("unknow mimetype!");
t = this.getPureText(t)
}
return ! 1 === e ? t: e + n + t
}
this.registMimeTypeProtocol = function(e, t) {
if (t && r[t]) throw new Error("sing has registed!");
if (e && i[e]) throw new Error("mimetype has registed!");
r[t] = e,
i[e] = t
},
this.getMimeTypeProtocol = function(e, t) {
var n = i[e] || !1;
return void 0 === t ? o.bind(this, n) : o(n, t)
},
this.getSpitor = function() {
return n
},
this.getMimeType = function(e) {
return void 0 !== e ? r[e] || null: i
}
}
return i.prototype.isPureText = function(e) {
return ! ~e.indexOf(this.getSpitor())
},
i.prototype.getPureText = function(e) {
return this.isPureText(e) ? e: e.split(this.getSpitor())[1]
},
i.prototype.whichMimeType = function(e) {
return this.isPureText(e) ? null: this.getMimeType(e.split(this.getSpitor())[0])
},
n.exports = function() {
this.minder.supportClipboardEvent && !kity.Browser.gecko && (this.MimeType = new i)
}
}
},
d[6] = {
value: function(e, t, n) {
return n.exports = function() {
var c = this.minder,
r = window.kityminder.data;
if (c.supportClipboardEvent && !kity.Browser.gecko) {
var d = this.fsm,
u = this.receiver,
s = this.MimeType,
o = s.getMimeTypeProtocol("application/km"),
m = r.getRegisterProtocol("json").decode,
p = [];
document.addEventListener("copy",
function(e) {
if (document.activeElement == u.element) {
var t = e;
switch (d.state()) {
case "input":
break;
case "normal":
var n = [].concat(c.getSelectedNodes());
if (n.length) {
var i;
if (1 < n.length && (n.sort(function(e, t) {
return e.getLevel() - t.getLevel()
}), (i = n[0].getLevel()) !== n[n.length - 1].getLevel())) {
var r, o = 0,
a = n.length,
l = a - 1;
for (r = n[l]; r.getLevel() !== i;) {
for (o = 0; o < a && n[o].getLevel() === i;) {
if (n[o].isAncestorOf(r)) {
n.splice(l, 1);
break
}
o++
}
r = n[--l]
}
}
var s = g(n);
t.clipboardData.setData("text/plain", s)
}
e.preventDefault()
}
}
}),
document.addEventListener("cut",
function(e) {
if (document.activeElement == u.element) {
if ("normal" !== c.getStatus()) return void e.preventDefault();
var t = e;
switch (d.state()) {
case "input":
break;
case "normal":
var n = c.getSelectedNodes();
n.length && (t.clipboardData.setData("text/plain", g(n)), c.execCommand("removenode")),
e.preventDefault()
}
}
}),
document.addEventListener("paste",
function(e) {
if (document.activeElement == u.element) {
if ("normal" !== c.getStatus()) return void e.preventDefault();
var t = e,
n = d.state(),
i = t.clipboardData.getData("text/plain");
switch (n) {
case "input":
if (!s.isPureText(i)) return void e.preventDefault();
break;
case "normal":
var r = c.getSelectedNodes();
if ("application/km" === s.whichMimeType(i)) {
var o, a = m(s.getPureText(i));
r.forEach(function(e) {
for (var t = a.length - 1; 0 <= t; t--) o = c.createNode(null, e),
c.importNode(o, a[t]),
p.push(o),
e.appendChild(o)
}),
c.select(p, !0),
p = [],
c.refresh()
} else {
if (t.clipboardData && -1 < t.clipboardData.items[0].type.indexOf("image")) {
var l = t.clipboardData.items[0].getAsFile();
return angular.element(document.body).injector().get("server").uploadImage(l).then(function(e) {
var t = e.data;
0 === t.errno && c.execCommand("image", t.data.url)
})
}
r.forEach(function(e) {
c.Text2Children(e, i)
})
}
e.preventDefault()
}
}
})
}
function g(e) {
for (var t = [], n = 0, i = e.length; n < i; n++) t.push(c.exportNode(e[n]));
return o(r.getRegisterProtocol("json").encode(t))
}
}
}
},
d[7] = {
value: function(e, t, n) {
return n.exports = function() {
var e;
if (! (e = "string" == typeof this.selector ? document.querySelector(this.selector) : this.selector)) throw new Error("Invalid selector: " + this.selector);
e.classList.add("km-editor"),
this.container = e
}
}
},
d[8] = {
value: function(e, t, n) {
var v = d.r(2);
new(d.r(19))("drag");
return n.exports = function() {
var n, i, t = this.fsm,
o = this.minder,
r = this.hotbox;
this.receiver.element,
t.when("* -> drag",
function() {}),
t.when("drag -> *",
function(e, t, n) {});
var a, l, s, c, d, u, m = 1,
p = !1,
g = !1;
function f(e, t) {
if (!e) return p = g = !1,
u && kity.releaseFrame(u),
void(u = null);
var n, i, r;
u || (u = kity.requestFrame((n = e, i = t, r = o,
function(e) {
switch (n) {
case "left":
r._viewDragger.move({
x:
-i,
y: 0
},
0);
break;
case "top":
r._viewDragger.move({
x:
0,
y: -i
},
0);
break;
case "right":
r._viewDragger.move({
x:
i,
y: 0
},
0);
break;
case "bottom":
r._viewDragger.move({
x:
0,
y: i
},
0);
break;
default:
return
}
e.next()
})))
}
o.on("mousedown",
function(e) {
m = 0;
var t = o.getPaper().container.getBoundingClientRect();
n = e.originEvent.clientX,
i = e.originEvent.clientY,
d = t.top,
a = t.width,
l = t.height
}),
o.on("mousemove",
function(e) {
if ("drag" === t.state() && 0 == m && o.getSelectedNode() && (20 < Math.abs(n - e.originEvent.clientX) || 20 < Math.abs(i - e.originEvent.clientY)) && (s = e.originEvent.clientX, c = e.originEvent.clientY - d, s < 20 ? f("right", 20 - s) : a - 20 < s ? f("left", 20 + s - a) : p = !0, c < 20 ? f("bottom", c) : l - 20 < c ? f("top", 20 + c - l) : g = !0, p && g && f(!1)), "drag" !== t.state() && 0 === m && o.getSelectedNode() && (20 < Math.abs(n - e.originEvent.clientX) || 20 < Math.abs(i - e.originEvent.clientY))) return "hotbox" === t.state() && r.active(v.STATE_IDLE),
t.jump("drag", "user-drag")
}),
window.addEventListener("mouseup",
function() {
if (m = 1, "drag" === t.state()) return f(!1),
t.jump("normal", "drag-finish")
},
!1)
}
}
},
d[9] = {
value: function(e, t, n) {
var s = new(d.r(19))("fsm");
function c(e, t, n, i) {
return e.when == t && (("*" == e.enter || e.enter == i) && ("*" == e.exit || e.exit == n || void 0))
}
return n.exports = function() {
this.fsm = new
function(e) {
var a = e,
l = [];
this.jump = function(e, t) {
if (!t) throw new Error("Please tell fsm the reason to jump");
var n, i, r = a,
o = [r, e].concat([].slice.call(arguments, 1));
for (n = 0; n < l.length; n++) if (c((i = l[n]).condition, "before", r, e) && i.apply(null, o)) return;
for (a = e, s.log("[{0}] {1} -> {2}", t, r, e), n = 0; n < l.length; n++) c((i = l[n]).condition, "after", r, e) && i.apply(null, o);
return a
},
this.state = function() {
return a
},
this.when = function(e, t) {
var n, i, r, o;
if (1 == arguments.length && (t = e, e = "* -> *"), 2 == (i = e.split(" - ")).length ? n = "before": 2 == (i = e.split(" -> ")).length && (n = "after"), !n) throw new Error("Illegal fsm condition: " + e);
r = i[0],
o = i[1],
t.condition = {
when: n,
exit: r,
enter: o
},
l.push(t)
}
} ("normal")
}
}
},
d[10] = {
value: function(e, t, n) {
var g = d.r(22);
return window.diff = g,
n.exports = function() {
var n, i, r, o, a = this.minder,
e = this.hotbox,
l = 100;
function t() {
r = [],
o = [],
n = a.exportJson()
}
function s() {
var e = a.exportJson(),
t = g(e, n);
if (t.length) {
for (r.push(t); r.length > l;) r.shift();
return n = e,
!0
}
}
function c() {
i = !0;
var e, t = r.pop();
t && (a.applyPatches(t), e = a.exportJson(), o.push(g(e, n)), n = e),
i = !1
}
function d() {
i = !0;
var e = o.pop();
e && (a.applyPatches(e), s()),
i = !1
}
function u() {
return !! r.length
}
function m() {
return !! o.length
}
this.history = {
reset: t,
undo: c,
redo: d,
hasUndo: u,
hasRedo: m
},
t(),
a.on("contentchange",
function() {
i || s() && (o = [])
}),
a.on("import", t),
a.on("patch",
function(e) {
if (i) {
var t = e.patch;
switch (t.express) {
case "node.add":
a.select(t.node.getChild(t.index), !0);
break;
case "node.remove":
case "data.replace":
case "data.remove":
case "data.add":
a.select(t.node, !0)
}
}
});
var p = e.state("main");
p.button({
position: "top",
label: "撤销",
key: "Ctrl + Z",
enable: u,
action: c,
next: "idle"
}),
p.button({
position: "top",
label: "重做",
key: "Ctrl + Y",
enable: m,
action: d,
next: "idle"
})
}
}
},
d[11] = {
value: function(e, t, n) {
var i = d.r(2);
return n.exports = function() {
var e = this.fsm,
a = this.minder,
r = this.receiver,
t = this.container,
l = new i(t);
l.setParentFSM(e),
e.when("normal -> hotbox",
function(e, t, n) {
var i, r = a.getSelectedNode();
if (r) {
var o = r.getRenderBox();
i = {
x: o.cx,
y: o.cy
}
}
l.active("main", i)
}),
e.when("normal -> normal",
function(e, t, n, i) {
"shortcut-handle" == n && (l.dispatch(i) ? i.preventDefault() : a.dispatchKeyEvent(i))
}),
e.when("modal -> normal",
function(e, t, n, i) {
"import-text-finish" == n && r.element.focus()
}),
this.hotbox = l
}
}
},
d[12] = {
value: function(e, t, n) {
d.r(21);
var s = new(d.r(19))("input");
return n.exports = function() {
var r = this.fsm,
p = this.minder,
e = this.hotbox,
o = this.receiver,
a = o.element,
l = window.kity.Browser.gecko;
function t() {
var e = p.getSelectedNode();
if (e) {
var t = a;
if (a.innerText = "", "bold" === e.getData("font-weight")) {
var n = document.createElement("b");
t.appendChild(n),
t = n
}
if ("italic" === e.getData("font-style")) {
var i = document.createElement("i");
t.appendChild(i),
t = i
}
t.innerText = p.queryCommandValue("text"),
l && o.fixFFCaretDisappeared(),
r.jump("input", "input-request"),
o.selectAll()
}
}
function n() {
var e = p.getSelectedNode();
if (e) {
var t = e.getData("font-size") || e.getStyle("font-size");
a.style.fontSize = t + "px",
a.style.minWidth = 0,
a.style.minWidth = a.clientWidth + "px",
a.style.fontWeight = e.getData("font-weight") || "",
a.style.fontStyle = e.getData("font-style") || "",
a.classList.add("input"),
a.focus()
}
}
function g() {
a.classList.remove("input"),
o.selectAll()
}
function i() {
var t = i,
n = p.getSelectedNode();
n && (t.timer || (t.timer = setTimeout(function() {
var e = n.getRenderBox("TextRenderer");
a.style.left = Math.round(e.x) + "px",
a.style.top = (s.flaged ? Math.round(e.bottom + 30) : Math.round(e.y)) + "px",
t.timer = 0
})))
}
s.flaged && a.classList.add("debug"),
a.onmousedown = function(e) {
e.stopPropagation()
},
p.on("layoutallfinish viewchange viewchanged selectionchange",
function(e) {
"viewchange" == e.type && "input" != r.state() || i()
}),
i(),
r.when("* -> input", n),
r.when("input -> *",
function(e, t, n) {
switch (n) {
case "input-cancel":
return g();
case "input-commit":
default:
return function() {
var e = [].slice.call(a.childNodes);
setTimeout(function() {
a.innerHTML = ""
},
0);
var t = p.getSelectedNode();
if (e = function(e) {
for (var t, n, i, r = "",
o = /\S/,
a = new RegExp("( |" + String.fromCharCode(160) + ")"), l = document.createElement("br"), s = !1, c = !1, d = 0, u = e.length; d < u; d++) switch (t = e[d], Object.prototype.toString.call(t)) {
case "[object HTMLBRElement]":
r += "\n";
break;
case "[object Text]":
if (t = t.textContent.replace("&nbsp;", " "), o.test(t)) r += t;
else for (i = t.length; i--;) a.test(t[i]) ? r += " ": "\t" === t[i] && (r += "\t");
break;
case "[object HTMLElement]":
switch (t.nodeName) {
case "B":
s = !0;
break;
case "I":
c = !0
} [].splice.apply(e, [d, 1].concat([].slice.call(t.childNodes))),
u = e.length,
d--;
break;
case "[object HTMLSpanElement]":
[].splice.apply(e, [d, 1].concat([].slice.call(t.childNodes))),
u = e.length,
d--;
break;
case "[object HTMLImageElement]":
t.src && /http(|s):\/\//.test(t.src) && p.execCommand("Image", t.src, t.alt);
break;
case "[object HTMLDivElement]":
n = [];
for (var m = 0,
u = t.childNodes.length; m < u; m++) n.push(t.childNodes[m]);
n.push(l),
[].splice.apply(e, [d, 1].concat(n)),
u = e.length,
d--;
break;
default:
if (t && t.childNodes.length) {
n = [];
for (var m = 0,
u = t.childNodes.length; m < u; m++) n.push(t.childNodes[m]);
n.push(l),
[].splice.apply(e, [d, 1].concat(n)),
u = e.length,
d--
} else t && void 0 !== t.textContent ? r += t.textContent: r += ""
}
return r = (r = r.replace(/^\n*|\n*$/g, "")).replace(new RegExp("(\n|\r|\n\r)( |" + String.fromCharCode(160) + "){4}", "g"), "$1\t"),
p.getSelectedNode().setText(r),
s ? p.queryCommandState("bold") || p.execCommand("bold") : p.queryCommandState("bold") && p.execCommand("bold"),
c ? p.queryCommandState("italic") || p.execCommand("italic") : p.queryCommandState("italic") && p.execCommand("italic"),
g(),
r
} (e),
function(t, e) {
try {
p.decodeData("text", e).then(function(e) { !
function e(t, n, i) {
var r = n.data;
t.setText(r.text || "");
for (var o = n.children || [], a = 0; a < o.length; a++) {
var l = i.createNode(null, t);
e(l, o[a], i)
}
return t
} (t, e, p),
p.fire("contentchange"),
p.getRoot().renderTree(),
p.layout(300)
})
} catch(e) {
if (p.fire("contentchange"), p.getRoot().renderTree(), "Error: Invalid local format" !== e.toString()) throw e
}
} (t, e), "root" == t.type) {
var n = p.getRoot().getText();
p.fire("initChangeRoot", {
text: n
})
}
} ()
}
}),
o.onblur(function(e) {
"input" == r.state() && r.jump("normal", "input-commit")
}),
p.on("beforemousedown",
function() {
"input" == r.state() && r.jump("normal", "input-commit")
}),
p.on("dblclick",
function() {
p.getSelectedNode() && "readonly" !== p._status && t()
}),
e.state("main").button({
position: "center",
label: "编辑",
key: "F2",
enable: function() {
return - 1 != p.queryCommandState("text")
},
action: t
}),
this.editText = t
}
}
},
d[13] = {
value: function(e, t, n) {
var c = d.r(2);
return n.exports = function() {
var t, n, i = this.fsm,
r = this.minder,
o = this.receiver,
e = this.container,
a = o.element,
l = this.hotbox,
s = !1;
o.listen("normal",
function(e) {
if (o.enable(), e.is("Space")) return e.preventDefault(),
kity.Browser.safari && (a.innerHTML = ""),
i.jump("hotbox", "space-trigger");
switch (e.type) {
case "keydown":
if (r.getSelectedNode()) {
if (! ((t = e).ctrlKey || t.metaKey || t.altKey) && (65 <= t.keyCode && t.keyCode <= 90 || 48 <= t.keyCode && t.keyCode <= 57 || 108 != t.keyCode && 96 <= t.keyCode && t.keyCode <= 111 || 108 != t.keyCode && 96 <= t.keyCode && t.keyCode <= 111 || 229 == t.keyCode || 0 === t.keyCode)) return i.jump("input", "user-input")
} else a.innerHTML = "";
i.jump("normal", "shortcut-handle", e)
}
var t
}), o.listen("hotbox",
function(e) {
if (o.disable(), e.preventDefault(), l.dispatch(e), l.state() == c.STATE_IDLE && "hotbox" == i.state()) return i.jump("normal", "hotbox-idle")
}),
o.listen("input",
function(e) {
if (o.enable(), "keydown" == e.type) {
if (e.is("Enter")) return e.preventDefault(),
i.jump("normal", "input-commit");
if (e.is("Esc")) return e.preventDefault(),
i.jump("normal", "input-cancel"); (e.is("Tab") || e.is("Shift + Tab")) && e.preventDefault()
} else if ("keyup" == e.type && e.is("Esc")) {
if (e.preventDefault(), !s) return i.jump("normal", "input-cancel")
} else "compositionstart" == e.type ? s = !0 : "compositionend" == e.type && setTimeout(function() {
s = !1
})
}),
e.addEventListener("mousedown",
function(e) {
2 == e.button && e.preventDefault(),
"hotbox" == i.state() ? (l.active(c.STATE_IDLE), i.jump("normal", "blur")) : "normal" == i.state() && 2 == e.button && (t = e.clientX, n = e.clientY)
},
!1),
e.addEventListener("mousewheel",
function(e) {
"hotbox" == i.state() && (l.active(c.STATE_IDLE), i.jump("normal", "mousemove-blur"))
},
!1),
e.addEventListener("contextmenu",
function(e) {
e.preventDefault()
}),
e.addEventListener("mouseup",
function(e) {
"normal" == i.state() && 2 == e.button && e.clientX == t && e.clientY == n && r.getSelectedNode() && i.jump("hotbox", "content-menu")
},
!1),
l.$element.addEventListener("mousedown",
function(e) {
e.stopPropagation()
})
}
}
},
d[14] = {
value: function(e, t, n) {
var i = d.r(4);
return n.exports = function() {
var e = new i({
enableKeyReceiver: !1,
enableAnimation: !0
});
e.renderTo(this.selector),
e.setTheme(null),
e.select(e.getRoot(), !0),
e.execCommand("text", "中心主题"),
this.minder = e
}
}
},
d[15] = {
value: function(e, t, n) {
return n.exports = function() {
var o = this,
a = this.minder,
e = this.hotbox,
l = this.fsm,
s = e.state("main"),
c = 0; ["前移:Alt+Up:ArrangeUp", "下级:Tab|Insert:AppendChildNode", "同级:Enter:AppendSiblingNode", "后移:Alt+Down:ArrangeDown", "删除:Delete|Backspace:RemoveNode", "上级:Shift+Tab|Shift+Insert:AppendParentNode"].forEach(function(e) {
var t = e.split(":"),
n = t.shift(),
i = t.shift(),
r = t.shift();
s.button({
position: "ring",
label: n,
key: i,
action: function() {
0 === r.indexOf("Append") ? (c++, a.execCommand(r, "分支主题"), a.on("layoutallfinish",
function e() {--c || o.editText(),
a.off("layoutallfinish", e)
})) : (a.execCommand(r), l.jump("normal", "command-executed"))
},
enable: function() {
return - 1 != a.queryCommandState(r)
}
})
}),
s.button({
position: "bottom",
label: "导入节点",
key: "Alt + V",
enable: function() {
return 1 == a.getSelectedNodes().length
},
action: function() {
a.fire("importNodeData")
},
next: "idle"
}),
s.button({
position: "bottom",
label: "导出节点",
key: "Alt + C",
enable: function() {
return 1 == a.getSelectedNodes().length
},
action: function() {
a.fire("exportNodeData")
},
next: "idle"
})
}
}
},
d[16] = {
value: function(e, t, n) {
return n.exports = function() {
var t = this.minder,
e = this.hotbox;
e.state("main").button({
position: "top",
label: "优先级",
key: "P",
next: "priority",
enable: function() {
return - 1 != t.queryCommandState("priority")
}
});
var n = e.state("priority");
"123456789".replace(/./g,
function(e) {
n.button({
position: "ring",
label: "P" + e,
key: e,
action: function() {
t.execCommand("Priority", e)
}
})
}),
n.button({
position: "center",
label: "移除",
key: "Del",
action: function() {
t.execCommand("Priority", 0)
}
}),
n.button({
position: "top",
label: "返回",
key: "esc",
next: "back"
})
}
}
},
d[17] = {
value: function(e, t, n) {
return n.exports = function() {
var t = this.minder,
e = this.hotbox;
e.state("main").button({
position: "top",
label: "进度",
key: "G",
next: "progress",
enable: function() {
return - 1 != t.queryCommandState("progress")
}
});
var n = e.state("progress");
"012345678".replace(/./g,
function(e) {
n.button({
position: "ring",
label: "G" + e,
key: e,
action: function() {
t.execCommand("Progress", parseInt(e) + 1)
}
})
}),
n.button({
position: "center",
label: "移除",
key: "Del",
action: function() {
t.execCommand("Progress", 0)
}
}),
n.button({
position: "top",
label: "返回",
key: "esc",
next: "back"
})
}
}
},
d[18] = {
value: function(e, t, n) {
var a = d.r(23);
d.r(2);
return n.exports = function() {
var i = this.fsm,
e = this.minder,
n = document.createElement("div");
n.contentEditable = !0,
n.setAttribute("tabindex", -1),
n.classList.add("receiver"),
n.onkeydown = n.onkeypress = n.onkeyup = o,
n.addEventListener("compositionstart", o),
this.container.appendChild(n);
var t = {
element: n,
selectAll: function() {
n.innerHTML || (n.innerHTML = "&nbsp;");
var e = document.createRange(),
t = window.getSelection();
e.selectNodeContents(n),
t.removeAllRanges(),
t.addRange(e),
n.focus()
},
enable: function() {
n.setAttribute("contenteditable", !0)
},
disable: function() {
n.setAttribute("contenteditable", !1)
},
fixFFCaretDisappeared: function() {
n.removeAttribute("contenteditable"),
n.setAttribute("contenteditable", "true"),
n.blur(),
n.focus()
},
onblur: function(e) {
n.onblur = e
}
};
t.selectAll(),
e.on("beforemousedown", t.selectAll),
e.on("receiverfocus", t.selectAll),
e.on("readonly",
function() {
e.disable(),
editor.receiver.element.parentElement.removeChild(editor.receiver.element),
editor.hotbox.$container.removeChild(editor.hotbox.$element)
});
var r = [];
function o(e) {
var t;
e.is = function(e) {
for (var t = e.split("|"), n = 0; n < t.length; n++) if (a.is(this, t[n])) return ! 0;
return ! 1
};
for (var n = 0; n < r.length; n++) if (("*" == (t = r[n]).notifyState || t.notifyState == i.state()) && t.call(null, e)) return
}
t.listen = function(e, t) {
1 == arguments.length && (t = e, e = "*"),
t.notifyState = e,
r.push(t)
},
this.receiver = t
}
}
},
d[19] = {
value: function(e, t, n) {
var i = d.r(20);
function r() {}
return n.exports = function(t) {
if (this.flaged = -1 != window.location.search.indexOf(t)) {
var e = function(e) {
for (var t = 0,
n = 0; n < e.length; n++) t += e.charCodeAt(n);
return t
} (t) % 360,
n = i("background: hsl({0}, 50%, 80%); color: hsl({0}, 100%, 30%); padding: 2px 3px; margin: 1px 3px 0 0;border-radius: 2px;", e);
this.log = function() {
var e = i.apply(null, arguments);
console.log(i("%c{0}%c{1}", t, e), n, "background: none; color: black;")
}
} else this.log = r
}
}
},
d[20] = {
value: function(e, t, n) {
return n.exports = function(e, n) {
return "object" != typeof n && (n = [].slice.call(arguments, 1)),
String(e).replace(/\{(\w+)\}/gi,
function(e, t) {
return n[t] || t
})
}
}
},
d[21] = {
value: function(e, t, n) { ! ("innerText" in document.createElement("a")) && "getSelection" in window && (HTMLElement.prototype.__defineGetter__("innerText",
function() {
var e, t, n = window.getSelection(),
i = [];
for (t = 0; t < n.rangeCount; t++) i[t] = n.getRangeAt(t);
for (n.removeAllRanges(), n.selectAllChildren(this), e = n.toString(), n.removeAllRanges(), t = 0; t < i.length; t++) n.addRange(i[t]);
return e
}), HTMLElement.prototype.__defineSetter__("innerText",
function(e) {
this.innerHTML = (e || "").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>")
}))
}
},
d[22] = {
value: function(e, t, n) {
var m = Object.keys ? Object.keys: function(e) {
var t = [];
for (var n in e) e.hasOwnProperty(n) && t.push(n);
return t
};
function p(e) {
return - 1 === e.indexOf("/") && -1 === e.indexOf("~") ? e: e.replace(/~/g, "~0").replace(/\//g, "~1")
}
function g(e) {
return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
}
return n.exports = function(e, t) {
var n = [];
return function e(t, n, i, r) {
for (var o = m(n), a = m(t), l = !1, s = a.length - 1; 0 <= s; s--) {
var c = t[u = a[s]];
if (n.hasOwnProperty(u)) {
var d = n[u];
"object" == typeof c && null != c && "object" == typeof d && null != d ? e(c, d, i, r + "/" + p(u)) : c != d && i.push({
op: "replace",
path: r + "/" + p(u),
value: g(d)
})
} else i.push({
op: "remove",
path: r + "/" + p(u)
}),
l = !0
}
if (l || o.length != a.length) for (s = 0; s < o.length; s++) {
var u = o[s];
t.hasOwnProperty(u) || i.push({
op: "add",
path: r + "/" + p(u),
value: g(n[u])
})
}
} (e, t, n, ""),
n
}
}
},
d[23] = {
value: function(e, t, n) {
var i = d.r(24),
r = 4096,
o = 8192,
a = 16384;
function l(e) {
return "string" == typeof e ? (t = 0, e.toLowerCase().split(/\s*\+\s*/).forEach(function(e) {
switch (e) {
case "ctrl":
case "cmd":
t |= r;
break;
case "alt":
t |= o;
break;
case "shift":
t |= a;
break;
default:
t |= i[e]
}
}), t) : function(e) {
var t = 0; (e.ctrlKey || e.metaKey) && (t |= r);
e.altKey && (t |= o);
e.shiftKey && (t |= a);
if ( - 1 === [16, 17, 18, 91].indexOf(e.keyCode)) {
if (229 === e.keyCode && e.keyIdentifier) return t |= parseInt(e.keyIdentifier.substr(2), 16);
t |= e.keyCode
}
return t
} (e);
var t
}
t.hash = l,
t.is = function(e, t) {
return e && t && l(e) == l(t)
}
}
},
d[24] = {
value: function(e, t, n) {
var i = {
Shift: 16,
Control: 17,
Alt: 18,
CapsLock: 20,
BackSpace: 8,
Tab: 9,
Enter: 13,
Esc: 27,
Space: 32,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
Insert: 45,
Left: 37,
Up: 38,
Right: 39,
Down: 40,
Direction: {
37 : 1,
38 : 1,
39 : 1,
40 : 1
},
Del: 46,
NumLock: 144,
Cmd: 91,
CmdFF: 224,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
"`": 192,
"=": 187,
"-": 189,
"/": 191,
".": 190
};
for (var r in i) i.hasOwnProperty(r) && (i[r.toLowerCase()] = i[r]);
var o = "a".charCodeAt(0);
"abcdefghijklmnopqrstuvwxyz".split("").forEach(function(e) {
i[e] = e.charCodeAt(0) - o + 65
});
for (var a = 9; i[a.toString()] = a + 48, --a;);
n.exports = i
}
};
var e, t = {
"expose-editor": 1
};
angular.module("kityminderEditor", ["ui.bootstrap", "ui.codemirror", "ui.colorpicker"]).config(["$sceDelegateProvider",
function(e) {
e.resourceUrlWhitelist(["self", "http://agroup.baidu.com:8910/**", "http://cq01-fe-rdtest01.vm.baidu.com:8910/**", "http://agroup.baidu.com:8911/**"])
}]),
angular.module("kityminderEditor").run(["$templateCache",
function(e) {
"use strict";
e.put()
e.put("ui/directive/appendNode/appendNode.html", "<div class=\"km-btn-group append-group\"><div class=\"km-btn-item append-child-node\" ng-disabled=\"minder.queryCommandState('AppendChildNode') === -1\" ng-click=\"minder.queryCommandState('AppendChildNode') === -1 || execCommand('AppendChildNode')\" title=\"{{ 'appendchildnode' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'appendchildnode' | lang:'ui/command' }}</span></div><div class=\"km-btn-item append-parent-node\" ng-disabled=\"minder.queryCommandState('AppendParentNode') === -1\" ng-click=\"minder.queryCommandState('AppendParentNode') === -1 || execCommand('AppendParentNode')\" title=\"{{ 'appendparentnode' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'appendparentnode' | lang:'ui/command' }}</span></div><div class=\"km-btn-item append-sibling-node\" ng-disabled=\"minder.queryCommandState('AppendSiblingNode') === -1\" ng-click=\"minder.queryCommandState('AppendSiblingNode') === -1 ||execCommand('AppendSiblingNode')\" title=\"{{ 'appendsiblingnode' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'appendsiblingnode' | lang:'ui/command' }}</span></div></div>"),
e.put("ui/directive/arrange/arrange.html", "<div class=\"km-btn-group arrange-group\"><div class=\"km-btn-item arrange-up\" ng-disabled=\"minder.queryCommandState('ArrangeUp') === -1\" ng-click=\"minder.queryCommandState('ArrangeUp') === -1 || minder.execCommand('ArrangeUp')\" title=\"{{ 'arrangeup' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'arrangeup' | lang:'ui/command' }}</span></div><div class=\"km-btn-item arrange-down\" ng-disabled=\"minder.queryCommandState('ArrangeDown') === -1\" ng-click=\"minder.queryCommandState('ArrangeDown') === -1 || minder.execCommand('ArrangeDown');\" title=\"{{ 'arrangedown' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'arrangedown' | lang:'ui/command' }}</span></div></div>"),
e.put("ui/directive/colorPanel/colorPanel.html", '<div class="bg-color-wrap"><span class="quick-bg-color" ng-click="minder.queryCommandState(\'background\') === -1 || minder.execCommand(\'background\', bgColor)" ng-disabled="minder.queryCommandState(\'background\') === -1"></span> <span color-picker class="bg-color" set-color="setDefaultBg()" ng-disabled="minder.queryCommandState(\'background\') === -1"><span class="caret"></span></span> <span class="bg-color-preview" ng-style="{ \'background-color\': bgColor }" ng-click="minder.queryCommandState(\'background\') === -1 || minder.execCommand(\'background\', bgColor)" ng-disabled="minder.queryCommandState(\'background\') === -1"></span></div>'),
e.put("ui/directive/expandLevel/expandLevel.html", '<div class="btn-group-vertical" dropdown is-open="isopen"><button type="button" class="btn btn-default expand" title="{{ \'expandtoleaf\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="minder.execCommand(\'ExpandToLevel\', 9999)"></button> <button type="button" class="btn btn-default expand-caption dropdown-toggle" title="{{ \'expandtoleaf\' | lang:\'ui\' }}" dropdown-toggle><span class="caption">{{ \'expandtoleaf\' | lang:\'ui\' }}</span> <span class="caret"></span> <span class="sr-only">{{ \'expandtoleaf\' | lang:\'ui\' }}</span></button><ul class="dropdown-menu" role="menu"><li ng-repeat="level in levels"><a href ng-click="minder.execCommand(\'ExpandToLevel\', level)">{{ \'expandtolevel\' + level | lang:\'ui/command\' }}</a></li></ul></div>'),
e.put("ui/directive/fontOperator/fontOperator.html", '<div class="font-operator"><div class="dropdown font-family-list" dropdown><div class="dropdown-toggle current-font-item" dropdown-toggle ng-disabled="minder.queryCommandState(\'fontfamily\') === -1"><a href class="current-font-family" title="{{ \'fontfamily\' | lang: \'ui\' }}">{{ getFontfamilyName(minder.queryCommandValue(\'fontfamily\')) || \'字体\' }}</a> <span class="caret"></span></div><ul class="dropdown-menu font-list"><li ng-repeat="f in fontFamilyList" class="font-item-wrap"><a ng-click="minder.execCommand(\'fontfamily\', f.val)" class="font-item" ng-class="{ \'font-item-selected\' : f == minder.queryCommandValue(\'fontfamily\') }" ng-style="{\'font-family\': f.val }">{{ f.name }}</a></li></ul></div><div class="dropdown font-size-list" dropdown><div class="dropdown-toggle current-font-item" dropdown-toggle ng-disabled="minder.queryCommandState(\'fontsize\') === -1"><a href class="current-font-size" title="{{ \'fontsize\' | lang: \'ui\' }}">{{ minder.queryCommandValue(\'fontsize\') || \'字号\' }}</a> <span class="caret"></span></div><ul class="dropdown-menu font-list"><li ng-repeat="f in fontSizeList" class="font-item-wrap"><a ng-click="minder.execCommand(\'fontsize\', f)" class="font-item" ng-class="{ \'font-item-selected\' : f == minder.queryCommandValue(\'fontsize\') }" ng-style="{\'font-size\': f + \'px\'}">{{ f }}</a></li></ul></div><span class="s-btn-icon font-bold" ng-click="minder.queryCommandState(\'bold\') === -1 || minder.execCommand(\'bold\')" ng-class="{\'font-bold-selected\' : minder.queryCommandState(\'bold\') == 1}" ng-disabled="minder.queryCommandState(\'bold\') === -1"></span> <span class="s-btn-icon font-italics" ng-click="minder.queryCommandState(\'italic\') === -1 || minder.execCommand(\'italic\')" ng-class="{\'font-italics-selected\' : minder.queryCommandState(\'italic\') == 1}" ng-disabled="minder.queryCommandState(\'italic\') === -1"></span><div class="font-color-wrap"><span class="quick-font-color" ng-click="minder.queryCommandState(\'forecolor\') === -1 || minder.execCommand(\'forecolor\', foreColor)" ng-disabled="minder.queryCommandState(\'forecolor\') === -1">A</span> <span color-picker class="font-color" set-color="setDefaultColor()" ng-disabled="minder.queryCommandState(\'forecolor\') === -1"><span class="caret"></span></span> <span class="font-color-preview" ng-style="{ \'background-color\': foreColor }" ng-click="minder.queryCommandState(\'forecolor\') === -1 || minder.execCommand(\'forecolor\', foreColor)" ng-disabled="minder.queryCommandState(\'forecolor\') === -1"></span></div><color-panel minder="minder" class="inline-directive"></color-panel></div>'),
e.put("ui/directive/hyperLink/hyperLink.html", '<div class="btn-group-vertical" dropdown is-open="isopen"><button type="button" class="btn btn-default hyperlink" title="{{ \'link\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="addHyperlink()" ng-disabled="minder.queryCommandState(\'HyperLink\') === -1"></button> <button type="button" class="btn btn-default hyperlink-caption dropdown-toggle" ng-disabled="minder.queryCommandState(\'HyperLink\') === -1" title="{{ \'link\' | lang:\'ui\' }}" dropdown-toggle><span class="caption">{{ \'link\' | lang:\'ui\' }}</span> <span class="caret"></span> <span class="sr-only">{{ \'link\' | lang:\'ui\' }}</span></button><ul class="dropdown-menu" role="menu"><li><a href ng-click="addHyperlink()">{{ \'insertlink\' | lang:\'ui\' }}</a></li><li><a href ng-click="minder.execCommand(\'HyperLink\', null)">{{ \'removelink\' | lang:\'ui\' }}</a></li></ul></div>'),
//e.put("ui/directive/imageBtn/imageBtn.html", '<div class="btn-group-vertical" dropdown is-open="isopen"><button type="button" class="btn btn-default image-btn" title="{{ \'image\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="addImage()" ng-disabled="minder.queryCommandState(\'Image\') === -1"></button> <button type="button" class="btn btn-default image-btn-caption dropdown-toggle" ng-disabled="minder.queryCommandState(\'Image\') === -1" title="{{ \'image\' | lang:\'ui\' }}" dropdown-toggle><span class="caption">{{ \'image\' | lang:\'ui\' }}</span> <span class="caret"></span> <span class="sr-only">{{ \'image\' | lang:\'ui\' }}</span></button><ul class="dropdown-menu" role="menu"><li><a href ng-click="addImage()">{{ \'insertimage\' | lang:\'ui\' }}</a></li><li><a href ng-click="minder.execCommand(\'Image\', \'\')">{{ \'removeimage\' | lang:\'ui\' }}</a></li></ul></div>'),
e.put("ui/directive/kityminderEditor/kityminderEditor.html", '<div class="minder-editor-container"><div class="top-tab" top-tab="minder" editor="editor" ng-if="minder"></div><div search-box minder="minder" ng-if="minder"></div><div class="minder-editor"></div><div class="km-note" note-editor minder="minder" ng-if="minder"></div><div class="note-previewer" note-previewer ng-if="minder"></div><div class="navigator" navigator minder="minder" ng-if="minder"></div></div>'),
e.put("ui/directive/kityminderViewer/kityminderViewer.html", '<div class="minder-editor-container"><div class="minder-viewer"></div><div class="note-previewer" note-previewer ng-if="minder"></div><div class="navigator" navigator minder="minder" ng-if="minder"></div></div>'),
e.put("ui/directive/layout/layout.html", '<div class="readjust-layout"><a ng-click="minder.queryCommandState(\'resetlayout\') === -1 || minder.execCommand(\'resetlayout\')" class="btn-wrap" ng-disabled="minder.queryCommandState(\'resetlayout\') === -1"><span class="btn-icon reset-layout-icon"></span> <span class="btn-label">{{ \'resetlayout\' | lang: \'ui/command\' }}</span></a></div>'),
e.put("ui/directive/navigator/navigator.html", '<div class="nav-bar"><div class="nav-btn zoom-in" ng-click="minder.execCommand(\'zoomIn\')" title="{{ \'zoom-in\' | lang : \'ui\' }}" ng-class="{ \'active\' : getZoomRadio(zoom) == 0 }"><div class="icon"></div></div><div class="zoom-pan"><div class="origin" ng-style="{\'transform\': \'translate(0, \' + getHeight(100) + \'px)\'}" ng-click="minder.execCommand(\'zoom\', 100);"></div><div class="indicator" ng-style="{\n \'transform\': \'translate(0, \' + getHeight(zoom) + \'px)\',\n \'transition\': \'transform 200ms\'\n }"></div></div><div class="nav-btn zoom-out" ng-click="minder.execCommand(\'zoomOut\')" title="{{ \'zoom-out\' | lang : \'ui\' }}" ng-class="{ \'active\' : getZoomRadio(zoom) == 1 }"><div class="icon"></div></div><div class="nav-btn hand" ng-click="minder.execCommand(\'hand\')" title="{{ \'hand\' | lang : \'ui\' }}" ng-class="{ \'active\' : minder.queryCommandState(\'hand\') == 1 }"><div class="icon"></div></div><div class="nav-btn camera" ng-click="minder.execCommand(\'camera\', minder.getRoot(), 600);" title="{{ \'camera\' | lang : \'ui\' }}"><div class="icon"></div></div><div class="nav-btn nav-trigger" ng-class="{\'active\' : isNavOpen}" ng-click="toggleNavOpen()" title="{{ \'navigator\' | lang : \'ui\' }}"><div class="icon"></div></div></div><div class="nav-previewer" ng-show="isNavOpen"></div>'),
e.put("ui/directive/noteBtn/noteBtn.html", '<div class="btn-group-vertical note-btn-group" dropdown is-open="isopen"><button type="button" class="btn btn-default note-btn" title="{{ \'note\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="addNote()" ng-disabled="minder.queryCommandState(\'note\') === -1"></button> <button type="button" class="btn btn-default note-btn-caption dropdown-toggle" ng-disabled="minder.queryCommandState(\'note\') === -1" title="{{ \'note\' | lang:\'ui\' }}" dropdown-toggle><span class="caption">{{ \'note\' | lang:\'ui\' }}</span> <span class="caret"></span> <span class="sr-only">{{ \'note\' | lang:\'ui\' }}</span></button><ul class="dropdown-menu" role="menu"><li><a href ng-click="addNote()">{{ \'insertnote\' | lang:\'ui\' }}</a></li><li><a href ng-click="minder.execCommand(\'note\', null)">{{ \'removenote\' | lang:\'ui\' }}</a></li></ul></div>'),
e.put("ui/directive/noteEditor/noteEditor.html", '<div class="panel panel-default" ng-init="noteEditorOpen = false" ng-show="noteEditorOpen"><div class="panel-heading"><h3 class="panel-title">备注</h3><span>(<a class="help" href="https://www.zybuluo.com/techird/note/46064" target="_blank">支持 GFM 语法书写</a>)</span> <i class="close-note-editor glyphicon glyphicon-remove" ng-click="closeNoteEditor()"></i></div><div class="panel-body"><div ng-show="noteEnabled" ui-codemirror="{ onLoad: codemirrorLoaded }" ng-model="noteContent" ui-codemirror-opts="{\n gfm: true,\n breaks: true,\n lineWrapping : true,\n mode: \'gfm\',\n dragDrop: false,\n lineNumbers:true\n }"></div><p ng-show="!noteEnabled" class="km-note-tips">请选择节点编辑备注</p></div></div>'),
e.put("ui/directive/notePreviewer/notePreviewer.html", '<div id="previewer-content" ng-show="showNotePreviewer" ng-style="previewerStyle" ng-bind-html="noteContent"></div>'),
e.put("ui/directive/operation/operation.html", "<div class=\"km-btn-group operation-group\"><div class=\"km-btn-item edit-node\" ng-disabled=\"minder.queryCommandState('text') === -1\" ng-click=\"minder.queryCommandState('text') === -1 || editNode()\" title=\"{{ 'editnode' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'editnode' | lang:'ui/command' }}</span></div><div class=\"km-btn-item remove-node\" ng-disabled=\"minder.queryCommandState('RemoveNode') === -1\" ng-click=\"minder.queryCommandState('RemoveNode') === -1 || minder.execCommand('RemoveNode');\" title=\"{{ 'removenode' | lang:'ui/command' }}\"><i class=\"km-btn-icon\"></i> <span class=\"km-btn-caption\">{{ 'removenode' | lang:'ui/command' }}</span></div></div>"),
e.put("ui/directive/priorityEditor/priorityEditor.html", '<ul class="km-priority tool-group" ng-disabled="commandDisabled"><li class="km-priority-item tool-group-item" ng-repeat="p in priorities" ng-click="commandDisabled || minder.execCommand(\'priority\', p)" ng-class="{ active: commandValue == p }" title="{{ getPriorityTitle(p) }}"><div class="km-priority-icon tool-group-icon priority-{{p}}"></div></li></ul>'),
e.put("ui/directive/progressEditor/progressEditor.html", '<ul class="km-progress tool-group" ng-disabled="commandDisabled"><li class="km-progress-item tool-group-item" ng-repeat="p in progresses" ng-click="commandDisabled || minder.execCommand(\'progress\', p)" ng-class="{ active: commandValue == p }" title="{{ getProgressTitle(p) }}"><div class="km-progress-icon tool-group-icon progress-{{p}}"></div></li></ul>'),
//e.put("ui/directive/resourceEditor/resourceEditor.html", '<div class="resource-editor"><div class="input-group"><input class="form-control" type="text" ng-model="newResourceName" ng-required ng-keypress="$event.keyCode == 13 && addResource(newResourceName)" ng-disabled="!enabled"> <span class="input-group-btn"><button class="btn btn-default" ng-click="addResource(newResourceName)" ng-disabled="!enabled">添加</button></span></div><div class="resource-dropdown clearfix" id="resource-dropdown"><ul class="km-resource" ng-init="resourceListOpen = false" ng-class="{\'open\': resourceListOpen}"><li ng-repeat="resource in used" ng-disabled="!enabled" ng-blur="blurCB()"><label style="background: {{resourceColor(resource.name)}}"><input type="checkbox" ng-model="resource.selected" ng-disabled="!enabled"> <span>{{resource.name}}</span></label></li></ul><div class="resource-caret" click-anywhere-but-here="resourceListOpen = false" is-active="resourceListOpen" ng-click="resourceListOpen = !resourceListOpen"><span class="caret"></span></div></div></div>'),
e.put("ui/directive/searchBox/searchBox.html", '<div id="search" class="search-box clearfix" ng-show="showSearch"><div class="input-group input-group-sm search-input-wrap"><input type="text" id="search-input" class="form-control search-input" ng-model="keyword" ng-keydown="handleKeyDown($event)" aria-describedby="basic-addon2"> <span class="input-group-addon search-addon" id="basic-addon2" ng-show="showTip" ng-bind="\'第 \' + curIndex + \' 条,共 \' + resultNum + \' 条\'"></span></div><div class="btn-group btn-group-sm prev-and-next-btn" role="group"><button type="button" class="btn btn-default" ng-click="doSearch(keyword, \'prev\')"><span class="glyphicon glyphicon-chevron-up"></span></button> <button type="button" class="btn btn-default" ng-click="doSearch(keyword, \'next\')"><span class="glyphicon glyphicon-chevron-down"></span></button></div><div class="close-search" ng-click="exitSearch()"><span class="glyphicon glyphicon-remove"></span></div></div>'),
e.put("ui/directive/searchBtn/searchBtn.html", '<div class="btn-group-vertical" dropdown is-open="isopen"><button type="button" class="btn btn-default search" title="{{ \'search\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="enterSearch()"></button> <button type="button" class="btn btn-default search-caption dropdown-toggle" ng-click="enterSearch()" title="{{ \'search\' | lang:\'ui\' }}"><span class="caption">{{ \'search\' | lang:\'ui\' }}</span> <span class="sr-only">{{ \'search\' | lang:\'ui\' }}</span></button></div>'),
e.put("ui/directive/selectAll/selectAll.html", '<div class="btn-group-vertical" dropdown is-open="isopen"><button type="button" class="btn btn-default select" title="{{ \'selectall\' | lang:\'ui\' }}" ng-class="{\'active\': isopen}" ng-click="select[\'all\']()"></button> <button type="button" class="btn btn-default select-caption dropdown-toggle" title="{{ \'selectall\' | lang:\'ui\' }}" dropdown-toggle><span class="caption">{{ \'selectall\' | lang:\'ui\' }}</span> <span class="caret"></span> <span class="sr-only">{{ \'selectall\' | lang:\'ui\' }}</span></button><ul class="dropdown-menu" role="menu"><li ng-repeat="item in items"><a href ng-click="select[item]()">{{ \'select\' + item | lang:\'ui\' }}</a></li></ul></div>'),
e.put("ui/directive/styleOperator/styleOperator.html", '<div class="style-operator"><a ng-click="minder.queryCommandState(\'clearstyle\') === -1 || minder.execCommand(\'clearstyle\')" class="btn-wrap clear-style" ng-disabled="minder.queryCommandState(\'clearstyle\') === -1"><span class="btn-icon clear-style-icon"></span> <span class="btn-label">{{ \'clearstyle\' | lang: \'ui\' }}</span></a><div class="s-btn-group-vertical"><a class="s-btn-wrap" href ng-click="minder.queryCommandState(\'copystyle\') === -1 || minder.execCommand(\'copystyle\')" ng-disabled="minder.queryCommandState(\'copystyle\') === -1"><span class="s-btn-icon copy-style-icon"></span> <span class="s-btn-label">{{ \'copystyle\' | lang: \'ui\' }}</span></a> <a class="s-btn-wrap paste-style-wrap" href ng-click="minder.queryCommandState(\'pastestyle\') === -1 || minder.execCommand(\'pastestyle\')" ng-disabled="minder.queryCommandState(\'pastestyle\') === -1"><span class="s-btn-icon paste-style-icon"></span> <span class="s-btn-label">{{ \'pastestyle\' | lang: \'ui\' }}</span></a></div></div>'),
e.put("ui/directive/templateList/templateList.html", '<div class="dropdown temp-panel" dropdown on-toggle="toggled(open)"><div class="dropdown-toggle current-temp-item" ng-disabled="minder.queryCommandState(\'template\') === -1" dropdown-toggle><a href class="temp-item {{ minder.queryCommandValue(\'template\') }}" title="{{ minder.queryCommandValue(\'template\') | lang: \'template\' }}"></a> <span class="caret"></span></div><ul class="dropdown-menu temp-list"><li ng-repeat="(key, templateObj) in templateList" class="temp-item-wrap"><a ng-click="minder.execCommand(\'template\', key);" class="temp-item {{key}}" ng-class="{ \'temp-item-selected\' : key == minder.queryCommandValue(\'template\') }" title="{{ key | lang: \'template\' }}"></a></li></ul></div>'),
e.put("ui/directive/themeList/themeList.html", '<div class="dropdown theme-panel" dropdown><div class="dropdown-toggle theme-item-selected" dropdown-toggle ng-disabled="minder.queryCommandState(\'theme\') === -1"><a href class="theme-item" ng-style="getThemeThumbStyle(minder.queryCommandValue(\'theme\'))" title="{{ minder.queryCommandValue(\'theme\') | lang: \'theme\'; }}">{{ minder.queryCommandValue(\'theme\') | lang: \'theme\'; }}</a> <span class="caret"></span></div><ul class="dropdown-menu theme-list"><li ng-repeat="key in themeKeyList" class="theme-item-wrap"><a ng-click="minder.execCommand(\'theme\', key);" class="theme-item" ng-style="getThemeThumbStyle(key)" title="{{ key | lang: \'theme\'; }}">{{ key | lang: \'theme\'; }}</a></li></ul></div>'),
e.put("ui/directive/topTab/topTab.html", '<tabset><tab heading="{{ \'idea\' | lang: \'ui/tabs\'; }}" ng-click="toggleTopTab(\'idea\')" select="setCurTab(\'idea\')"><undo-redo editor="editor"></undo-redo><append-node minder="minder"></append-node><arrange minder="minder"></arrange><operation minder="minder"></operation><hyper-link minder="minder"></hyper-link><image-btn minder="minder"></image-btn><note-btn minder="minder"></note-btn><priority-editor minder="minder"></priority-editor><progress-editor minder="minder"></progress-editor><resource-editor minder="minder"></resource-editor></tab><tab heading="{{ \'appearence\' | lang: \'ui/tabs\'; }}" ng-click="toggleTopTab(\'appearance\')" select="setCurTab(\'appearance\')"><template-list minder="minder" class="inline-directive"></template-list><theme-list minder="minder"></theme-list><layout minder="minder" class="inline-directive"></layout><style-operator minder="minder" class="inline-directive"></style-operator><font-operator minder="minder" class="inline-directive"></font-operator></tab><tab heading="{{ \'view\' | lang: \'ui/tabs\'; }}" ng-click="toggleTopTab(\'view\')" select="setCurTab(\'view\')"><expand-level minder="minder"></expand-level><select-all minder="minder"></select-all><search-btn minder="minder"></search-btn></tab></tabset>'),
e.put("ui/directive/undoRedo/undoRedo.html", '<div class="km-btn-group do-group"><div class="km-btn-item undo" ng-disabled="editor.history.hasUndo() == false" ng-click="editor.history.hasUndo() == false || editor.history.undo();" title="{{ \'undo\' | lang:\'ui\' }}"><i class="km-btn-icon"></i></div><div class="km-btn-item redo" ng-disabled="editor.history.hasRedo() == false" ng-click="editor.history.hasRedo() == false || editor.history.redo()" title="{{ \'redo\' | lang:\'ui\' }}"><i class="km-btn-icon"></i></div></div>'),
e.put("ui/dialog/hyperlink/hyperlink.tpl.html", '<div class="modal-header"><h3 class="modal-title">链接</h3></div><div class="modal-body"><form><div class="form-group" id="link-url-wrap" ng-class="{true: \'has-success\', false: \'has-error\'}[urlPassed]"><label for="link-url">链接地址:</label><input type="text" class="form-control" ng-model="url" ng-blur="urlPassed = R_URL.test(url)" ng-focus="this.value = url" ng-keydown="shortCut($event)" id="link-url" placeholder="必填:以 http(s):// 或 ftp:// 开头"></div><div class="form-group" ng-class="{\'has-success\' : titlePassed}"><label for="link-title">提示文本:</label><input type="text" class="form-control" ng-model="title" ng-blur="titlePassed = true" id="link-title" placeholder="选填:鼠标在链接上悬停时提示的文本"></div></form></div><div class="modal-footer"><button class="btn btn-primary" ng-click="ok()">确定</button> <button class="btn btn-warning" ng-click="cancel()">取消</button></div>'),
e.put("ui/dialog/imExportNode/imExportNode.tpl.html", '<div class="modal-header"><h3 class="modal-title">{{ title }}</h3></div><div class="modal-body"><textarea type="text" class="form-control single-input" rows="8" ng-keydown="shortCut($event);" ng-model="value" ng-readonly="type === \'export\'">\n </textarea></div><div class="modal-footer"><button class="btn btn-primary" ng-click="ok()" ng-disabled="type === \'import\' && value == \'\'">OK</button> <button class="btn btn-warning" ng-click="cancel()">Cancel</button></div>'),
e.put("ui/dialog/image/image.tpl.html", '<div class="modal-header"><h3 class="modal-title">图片</h3></div><div class="modal-body"><tabset><tab heading="图片搜索"><form class="form-inline"><div class="form-group"><label for="search-keyword">关键词:</label><input type="text" class="form-control" ng-model="data.searchKeyword2" id="search-keyword" placeholder="请输入搜索的关键词"></div><button class="btn btn-primary" ng-click="searchImage()">百度一下</button></form><div class="search-result" id="search-result"><ul><li ng-repeat="image in list" id="{{ \'img-item\' + $index }}" ng-class="{\'selected\' : isSelected}" ng-click="selectImage($event)"><img id="{{ \'img-\' + $index }}" ng-src="{{ image.src || \'\' }}" alt="{{ image.title }}" onerror="this.parentNode.removeChild(this)"> <span>{{ image.title }}</span></li></ul></div></tab><tab heading="外链图片"><form><div class="form-group" ng-class="{true: \'has-success\', false: \'has-error\'}[urlPassed]"><label for="image-url">链接地址:</label><input type="text" class="form-control" ng-model="data.url" ng-blur="urlPassed = data.R_URL.test(data.url)" ng-focus="this.value = data.url" ng-keydown="shortCut($event)" id="image-url" placeholder="必填:以 http(s):// 开头"></div><div class="form-group" ng-class="{\'has-success\' : titlePassed}"><label for="image-title">提示文本:</label><input type="text" class="form-control" ng-model="data.title" ng-blur="titlePassed = true" id="image-title" placeholder="选填:鼠标在图片上悬停时提示的文本"></div><div class="form-group"><label for="image-preview">图片预览:</label><img class="image-preview" id="image-preview" ng-src="{{ data.url }}" alt="{{ data.title }}"></div></form></tab><tab heading="上传图片" active="true"><form><div class="form-group"><input type="file" name="upload-image" id="upload-image" class="upload-image" accept=".jpg,.JPG,jpeg,JPEG,.png,.PNG,.gif,.GIF" onchange="angular.element(this).scope().uploadImage()"><label for="upload-image" class="btn btn-primary"><span>选择文件&hellip;</span></label></div><div class="form-group" ng-class="{\'has-success\' : titlePassed}"><label for="image-title">提示文本:</label><input type="text" class="form-control" ng-model="data.title" ng-blur="titlePassed = true" id="image-title" placeholder="选填:鼠标在图片上悬停时提示的文本"></div><div class="form-group"><label for="image-preview">图片预览:</label><img class="image-preview" id="image-preview" ng-src="{{ data.url }}" title="{{ data.title }}" alt="{{ data.title }}"></div></form></tab></tabset></div><div class="modal-footer"><button class="btn btn-primary" ng-click="ok()">确定</button> <button class="btn btn-warning" ng-click="cancel()">取消</button></div>')
}]),
angular.module("kityminderEditor").service("commandBinder",
function() {
return {
bind: function(e, t, n) {
e.on("interactchange",
function() {
n.commandDisabled = -1 === e.queryCommandState(t),
n.commandValue = e.queryCommandValue(t),
n.$apply()
})
}
}
}),
angular.module("kityminderEditor").provider("config",
function() {
this.config = {
ctrlPanelMin: 250,
ctrlPanelWidth: parseInt(window.localStorage.__dev_minder_ctrlPanelWidth) || 250,
dividerWidth: 3,
defaultLang: "zh-cn",
zoom: [10, 20, 30, 50, 80, 100, 120, 150, 200],
imageUpload: "server/imageUpload.php"
},
this.set = function(e, t) {
var n = Object.keys(this.config),
i = {};
for (var r in "object" == typeof e ? i = e: i[e] = t, i) {
if (!i.hasOwnProperty(r) || -1 === n.indexOf(r)) return console.error("Unsupported config key: ", e, ", please choose in :", n.join(", ")),
!1;
this.config[r] = i[r]
}
return ! 0
},
this.$get = function() {
var t = this;
return {
get: function(e) {
return 0 === arguments.length ? t.config: t.config.hasOwnProperty(e) ? t.config[e] : (console.warn("Missing config key pair for : ", e), "")
}
}
}
}),
angular.module("kityminderEditor").service("lang.zh-cn",
function() {
return {
"zh-cn": {
template: {
default:
"思维导图",
tianpan: "天盘图",
structure: "组织结构图",
filetree: "目录组织图",
right: "逻辑结构图",
"fish-bone": "鱼骨头图"
},
theme: {
classic: "脑图经典",
"classic-compact": "紧凑经典",
snow: "温柔冷光",
"snow-compact": "紧凑冷光",
fish: "鱼骨图",
wire: "线框",
"fresh-red": "清新红",
"fresh-soil": "泥土黄",
"fresh-green": "文艺绿",
"fresh-blue": "天空蓝",
"fresh-purple": "浪漫紫",
"fresh-pink": "脑残粉",
"fresh-red-compat": "紧凑红",
"fresh-soil-compat": "紧凑黄",
"fresh-green-compat": "紧凑绿",
"fresh-blue-compat": "紧凑蓝",
"fresh-purple-compat": "紧凑紫",
"fresh-pink-compat": "紧凑粉",
tianpan: "经典天盘",
"tianpan-compact": "紧凑天盘"
},
maintopic: "中心主题",
topic: "分支主题",
panels: {
history: "历史",
template: "模板",
theme: "皮肤",
layout: "布局",
style: "样式",
font: "文字",
color: "颜色",
background: "背景",
insert: "插入",
arrange: "调整",
nodeop: "当前",
priority: "优先级",
progress: "进度",
resource: "资源",
note: "备注",
attachment: "附件",
word: "文字"
},
error_message: {
title: "哎呀,脑图出错了",
err_load: "加载脑图失败",
err_save: "保存脑图失败",
err_network: "网络错误",
err_doc_resolve: "文档解析失败",
err_unknown: "发生了奇怪的错误",
err_localfile_read: "文件读取错误",
err_download: "文件下载失败",
err_remove_share: "取消分享失败",
err_create_share: "分享失败",
err_mkdir: "目录创建失败",
err_ls: "读取目录失败",
err_share_data: "加载分享内容出错",
err_share_sync_fail: "分享内容同步失败",
err_move_file: "文件移动失败",
err_rename: "重命名失败",
unknownreason: "可能是外星人篡改了代码...",
pcs_code: {
3 : "不支持此接口",
4 : "没有权限执行此操作",
5 : "IP未授权",
110 : "用户会话已过期,请重新登录",
31001 : "数据库查询错误",
31002 : "数据库连接错误",
31003 : "数据库返回空结果",
31021 : "网络错误",
31022 : "暂时无法连接服务器",
31023 : "输入参数错误",
31024 : "app id为空",
31025 : "后端存储错误",
31041 : "用户的cookie不是合法的百度cookie",
31042 : "用户未登陆",
31043 : "用户未激活",
31044 : "用户未授权",
31045 : "用户不存在",
31046 : "用户已经存在",
31061 : "文件已经存在",
31062 : "文件名非法",
31063 : "文件父目录不存在",
31064 : "无权访问此文件",
31065 : "目录已满",
31066 : "文件不存在",
31067 : "文件处理出错",
31068 : "文件创建失败",
31069 : "文件拷贝失败",
31070 : "文件删除失败",
31071 : "不能读取文件元信息",
31072 : "文件移动失败",
31073 : "文件重命名失败",
31079 : "未找到文件MD5,请使用上传API上传整个文件。",
31081 : "superfile创建失败",
31082 : "superfile 块列表为空",
31083 : "superfile 更新失败",
31101 : "tag系统内部错误",
31102 : "tag参数错误",
31103 : "tag系统错误",
31110 : "未授权设置此目录配额",
31111 : "配额管理只支持两级目录",
31112 : "超出配额",
31113 : "配额不能超出目录祖先的配额",
31114 : "配额不能比子目录配额小",
31141 : "请求缩略图服务失败",
31201 : "签名错误",
31202 : "文件不存在",
31203 : "设置acl失败",
31204 : "请求acl验证失败",
31205 : "获取acl失败",
31206 : "acl不存在",
31207 : "bucket已存在",
31208 : "用户请求错误",
31209 : "服务器错误",
31210 : "服务器不支持",
31211 : "禁止访问",
31212 : "服务不可用",
31213 : "重试出错",
31214 : "上传文件data失败",
31215 : "上传文件meta失败",
31216 : "下载文件data失败",
31217 : "下载文件meta失败",
31218 : "容量超出限额",
31219 : "请求数超出限额",
31220 : "流量超出限额",
31298 : "服务器返回值KEY非法",
31299 : "服务器返回值KEY不存在"
}
},
ui: {
shared_file_title: "[分享的] {0} (只读)",
load_share_for_edit: "正在加载分享的文件...",
share_sync_success: "分享内容已同步",
recycle_clear_confirm: "确认清空回收站么?清空后的文件无法恢复。",
fullscreen_exit_hint: "按 Esc 或 F11 退出全屏",
error_detail: "详细信息",
copy_and_feedback: "复制并反馈",
move_file_confirm: '确定把 "{0}" 移动到 "{1}" 吗?',
rename: "重命名",
rename_success: "{0} 重命名成功",
move_success: "{0} 移动成功到 {1}",
command: {
appendsiblingnode: "插入同级主题",
appendparentnode: "插入上级主题",
appendchildnode: "插入下级主题",
removenode: "删除",
editnode: "编辑",
arrangeup: "上移",
arrangedown: "下移",
resetlayout: "整理布局",
expandtoleaf: "展开全部节点",
expandtolevel1: "展开到一级节点",
expandtolevel2: "展开到二级节点",
expandtolevel3: "展开到三级节点",
expandtolevel4: "展开到四级节点",
expandtolevel5: "展开到五级节点",
expandtolevel6: "展开到六级节点",
fullscreen: "全屏",
outline: "大纲"
},
search: "搜索",
expandtoleaf: "展开",
back: "返回",
undo: "撤销 (Ctrl + Z)",
redo: "重做 (Ctrl + Y)",
tabs: {
idea: "思路",
appearence: "外观",
view: "视图"
},
quickvisit: {
new: "新建 (Ctrl + Alt + N)",
save: "保存 (Ctrl + S)",
share: "分享 (Ctrl + Alt + S)",
feedback: "反馈问题(F1)",
editshare: "编辑"
},
menu: {
mainmenutext: "百度脑图",
newtab: "新建",
opentab: "打开",
savetab: "保存",
sharetab: "分享",
preferencetab: "设置",
helptab: "帮助",
feedbacktab: "反馈",
recenttab: "最近使用",
netdisktab: "百度云存储",
localtab: "本地文件",
drafttab: "草稿箱",
downloadtab: "导出到本地",
createsharetab: "当前脑图",
managesharetab: "已分享",
newheader: "新建脑图",
openheader: "打开",
saveheader: "保存到",
draftheader: "草稿箱",
shareheader: "分享我的脑图",
downloadheader: "导出到指定格式",
preferenceheader: "偏好设置",
helpheader: "帮助",
feedbackheader: "反馈"
},
mydocument: "我的文档",
emptydir: "目录为空!",
pickfile: "选择文件...",
acceptfile: "支持的格式:{0}",
dropfile: "或将文件拖至此处",
unsupportedfile: "不支持的文件格式",
untitleddoc: "未命名文档",
overrideconfirm: "{0} 已存在,确认覆盖吗?",
checklogin: "检查登录状态中...",
loggingin: "正在登录...",
recent: "最近打开",
clearrecent: "清空",
clearrecentconfirm: "确认清空最近文档列表?",
cleardraft: "清空",
cleardraftconfirm: "确认清空草稿箱?",
none_share: "不分享",
public_share: "公开分享",
password_share: "私密分享",
email_share: "邮件邀请",
url_share: "脑图 URL 地址:",
sns_share: "社交网络分享:",
sns_share_text: "“{0}” - 我用百度脑图制作的思维导图,快看看吧!(地址:{1})",
none_share_description: "不分享当前脑图",
public_share_description: "创建任何人可见的分享",
share_button_text: "创建",
password_share_description: "创建需要密码才可见的分享",
email_share_description: "创建指定人可见的分享,您还可以允许他们编辑",
ondev: "敬请期待!",
create_share_failed: "分享失败:{0}",
remove_share_failed: "删除失败:{1}",
copy: "复制",
copied: "已复制",
shared_tip: "当前脑图被 {0} 分享,你可以修改之后保存到自己的网盘上或再次分享",
current_share: "当前脑图",
manage_share: "我的分享",
share_remove_action: "不分享该脑图",
share_view_action: "打开分享地址",
share_edit_action: "编辑分享的文件",
login: "登录",
logout: "注销",
switchuser: "切换账户",
userinfo: "个人信息",
gotonetdisk: "我的网盘",
requirelogin: '请 <a class="login-button">登录</a> 后使用',
saveas: "保存为",
filename: "文件名",
fileformat: "保存格式",
save: "保存",
mkdir: "新建目录",
recycle: "回收站",
newdir: "未命名目录",
bold: "加粗",
italic: "斜体",
forecolor: "字体颜色",
fontfamily: "字体",
fontsize: "字号",
layoutstyle: "主题",
node: "节点操作",
saveto: "另存为",
hand: "允许拖拽",
camera: "定位根节点",
"zoom-in": "放大(Ctrl+)",
"zoom-out": "缩小(Ctrl-)",
markers: "标签",
resource: "资源",
help: "帮助",
preference: "偏好设置",
expandnode: "展开到叶子",
collapsenode: "收起到一级节点",
template: "模板",
theme: "皮肤",
clearstyle: "清除样式",
copystyle: "复制样式",
pastestyle: "粘贴样式",
appendsiblingnode: "同级主题",
appendchildnode: "下级主题",
arrangeup: "前调",
arrangedown: "后调",
editnode: "编辑",
removenode: "移除",
priority: "优先级",
progress: {
p1: "未开始",
p2: "完成 1/8",
p3: "完成 1/4",
p4: "完成 3/8",
p5: "完成一半",
p6: "完成 5/8",
p7: "完成 3/4",
p8: "完成 7/8",
p9: "已完成",
p0: "清除进度"
},
link: "链接",
image: "图片",
note: "备注",
insertlink: "插入链接",
insertimage: "插入图片",
insertnote: "插入备注",
removelink: "移除已有链接",
removeimage: "移除已有图片",
removenote: "移除已有备注",
resetlayout: "整理",
justnow: "刚刚",
minutesago: "{0} 分钟前",
hoursago: "{0} 小时前",
yesterday: "昨天",
daysago: "{0} 天前",
longago: "很久之前",
redirect: "您正在打开连接 {0},百度脑图不能保证连接的安全性,是否要继续?",
navigator: "导航器",
unsavedcontent: "当前文件还没有保存到网盘:\n\n{0}\n\n虽然未保存的数据会缓存在草稿箱,但是清除浏览器缓存会导致草稿箱清除。",
shortcuts: "快捷键",
contact: "联系与反馈",
email: "邮件组",
qq_group: "QQ 群",
github_issue: "Github",
baidu_tieba: "贴吧",
clipboardunsupported: "您的浏览器不支持剪贴板,请使用快捷键复制",
load_success: "{0} 加载成功",
save_success: "{0} 已保存于 {1}",
autosave_success: "{0} 已自动保存于 {1}",
selectall: "全选",
selectrevert: "反选",
selectsiblings: "选择兄弟节点",
selectlevel: "选择同级节点",
selectpath: "选择路径",
selecttree: "选择子树"
},
popupcolor: {
clearColor: "清空颜色",
standardColor: "标准颜色",
themeColor: "主题颜色"
},
dialogs: {
markers: {
static: {
lang_input_text: "文本内容:",
lang_input_url: "链接地址:",
lang_input_title: "标题:",
lang_input_target: "是否在新窗口:"
},
priority: "优先级",
none: "无",
progress: {
title: "进度",
notdone: "未完成",
done1: "完成 1/8",
done2: "完成 1/4",
done3: "完成 3/8",
done4: "完成 1/2",
done5: "完成 5/8",
done6: "完成 3/4",
done7: "完成 7/8",
done: "已完成"
}
},
help: {},
hyperlink: {},
image: {},
resource: {}
},
hyperlink: {
hyperlink: "链接...",
unhyperlink: "移除链接"
},
image: {
image: "图片...",
removeimage: "移除图片"
},
marker: {
marker: "进度/优先级..."
},
resource: {
resource: "资源..."
}
}
}
}),
angular.module("kityminderEditor").service("memory",
function() {
return {
get: function(e) {
var t = window.localStorage.getItem(e);
return JSON.parse(t)
},
set: function(e, t) {
try {
return window.localStorage.setItem(e, JSON.stringify(t)),
!0
} catch(e) {
if (function(e) {
var t = !1;
if (e) if (e.code) switch (e.code) {
case 22:
t = !0;
break;
case 1014:
"NS_ERROR_DOM_QUOTA_REACHED" === e.name && (t = !0)
} else - 2147024882 === e.number && (t = !0);
return t
} (e)) return ! 1
}
},
remove: function(e) {
var t = window.localStorage.getItem(e);
return window.localStorage.removeItem(e),
t
},
clear: function() {
window.localStorage.clear()
}
}
}),
angular.module("kityminderEditor").service("minder.service",
function() {
var t = [];
return {
registerEvent: function(e) {
t.push(e)
},
executeCallback: function() {
t.forEach(function(e) {
e.apply(this, arguments)
})
}
}
}),
angular.module("kityminderEditor").service("resourceService", ["$document",
function(t) {
var n = null;
this.open = function(e) {
n || (t.bind("click", i), t.bind("keydown", r)),
n && n !== e && (n.resourceListOpen = !1),
n = e
},
this.close = function(e) {
n === e && (n = null, t.unbind("click", i), t.unbind("keydown", r))
};
var i = function(e) {
if (n) {
var t = n.getToggleElement();
e && t && t[0].contains(e.target) || n.$apply(function() {
console.log("to close the resourcelist"),
n.resourceListOpen = !1
})
}
},
r = function(e) {
27 === e.which && (n.focusToggleElement(), i())
}
}]),
angular.module("kityminderEditor").service("revokeDialog", ["$modal", "minder.service",
function(e, t) {
return t.registerEvent(function() {
var t = window.minder,
n = window.editor,
i = n.hotbox.getParentFSM();
t.on("importNodeData",
function() {
i.jump("modal", "import-text-modal"),
e.open({
animation: !0,
templateUrl: "ui/dialog/imExportNode/imExportNode.tpl.html",
controller: "imExportNode.ctrl",
size: "md",
resolve: {
title: function() {
return "导入节点"
},
defaultValue: function() {
return ""
},
type: function() {
return "import"
}
}
}).result.then(function(e) {
try {
t.Text2Children(t.getSelectedNode(), e)
} catch(e) {
alert(e)
}
i.jump("normal", "import-text-finish"),
n.receiver.selectAll()
},
function() {
i.jump("normal", "import-text-finish"),
n.receiver.selectAll()
})
}),
t.on("exportNodeData",
function() {
i.jump("modal", "export-text-modal"),
e.open({
animation: !0,
templateUrl: "ui/dialog/imExportNode/imExportNode.tpl.html",
controller: "imExportNode.ctrl",
size: "md",
resolve: {
title: function() {
return "导出节点"
},
defaultValue: function() {
var e = t.getSelectedNode();
return (0, window.kityminder.data.getRegisterProtocol("text").Node2Text)(e)
},
type: function() {
return "export"
}
}
}).result.then(function(e) {
i.jump("normal", "export-text-finish"),
n.receiver.selectAll()
},
function() {
i.jump("normal", "export-text-finish"),
n.receiver.selectAll()
})
})
}),
{}
}]),
angular.module("kityminderEditor").service("server", ["config", "$http",
function(i, r) {
return {
uploadImage: function(e) {
var t = i.get("imageUpload"),
n = new FormData;
return n.append("upload_file", e),
r.post(t, n, {
transformRequest: angular.identity,
headers: {
"Content-Type": void 0
}
})
}
}
}]),
angular.module("kityminderEditor").service("valueTransfer",
function() {
return {}
}),
angular.module("kityminderEditor").filter("commandState",
function() {
return function(e, t) {
return e.queryCommandState(t)
}
}).filter("commandValue",
function() {
return function(e, t) {
return e.queryCommandValue(t)
}
}),
angular.module("kityminderEditor").filter("lang", ["config", "lang.zh-cn",
function(r, o) {
return function(e, t) {
var n = r.get("defaultLang");
if (null == o[n]) return "未发现对应语言包,请检查 lang.xxx.service.js!";
var i = o[n];
return t.split("/").forEach(function(e, t) {
i = i[e]
}),
i[e] || null
}
}]),
angular.module("kityminderEditor").controller("hyperlink.ctrl", ["$scope", "$modalInstance", "link",
function(t, n, e) {
t.R_URL = new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"),
t.url = e.url || "",
t.title = e.title || "",
setTimeout(function() {
var e = $("#link-url");
e.focus(),
e[0].setSelectionRange(0, t.url.length)
},
30),
t.shortCut = function(e) {
e.stopPropagation(),
13 == e.keyCode ? t.ok() : 27 == e.keyCode && t.cancel()
},
t.ok = function() {
if (t.R_URL.test(t.url)) n.close({
url: t.url,
title: t.title
});
else {
t.urlPassed = !1;
var e = $("#link-url");
e.focus(),
e[0].setSelectionRange(0, t.url.length)
}
editor.receiver.selectAll()
},
t.cancel = function() {
n.dismiss("cancel"),
editor.receiver.selectAll()
}
}]),
angular.module("kityminderEditor").controller("imExportNode.ctrl", ["$scope", "$modalInstance", "title", "defaultValue", "type",
function(r, e, t, n, o) {
r.title = t,
r.value = n,
r.type = o,
r.ok = function() {
"" != r.value && (e.close(r.value), editor.receiver.selectAll())
},
r.cancel = function() {
e.dismiss("cancel"),
editor.receiver.selectAll()
},
setTimeout(function() {
$(".single-input").focus(),
$(".single-input")[0].setSelectionRange(0, n.length)
},
30),
r.shortCut = function(e) {
if (e.stopPropagation(), 27 == e.keyCode && r.cancel(), 8 == e.keyCode && "export" == o && e.preventDefault(), 9 == e.keyCode) {
e.preventDefault();
var t = e.target,
n = function(e) {
var t = 0;
if (document.selection) {
e.focus();
var n = document.selection.createRange();
n.moveStart("character", -e.value.length),
t = n.text.length
} else(e.selectionStart || "0" == e.selectionStart) && (t = e.selectionStart);
return t
} (t),
i = t.value;
t.value = i.substr(0, n) + "\t" + i.substr(n),
function(e, t) {
if (e.setSelectionRange) e.focus(),
e.setSelectionRange(t, t);
else if (e.createTextRange) {
var n = e.createTextRange();
n.collapse(!0),
n.moveEnd("character", t),
n.moveStart("character", t),
n.select()
}
} (t, n + 1)
}
}
}]),
angular.module("kityminderEditor").controller("image.ctrl", ["$http", "$scope", "$modalInstance", "image", "server",
function(i, r, t, e, n) {
r.data = {
list: [],
url: e.url || "",
title: e.title || "",
R_URL: /^https?\:\/\/\w+/
},
setTimeout(function() {
var e = $("#image-url");
e.focus(),
e[0].setSelectionRange(0, r.data.url.length)
},
300),
r.searchImage = function() {
var e, t, n;
r.list = [],
(e = r.data.searchKeyword2, t = new Date, n = "http://image.baidu.com/search/acjson?tn=resultjson_com&ipn=rj&ct=201326592&fp=result&queryWord=" + e + "&cl=2&lm=-1&ie=utf-8&oe=utf-8&st=-1&ic=0&word=" + e + "&face=0&istype=2&nc=1&pn=60&rn=60&gsm=3c&" + t.getTime() + "=&callback=JSON_CALLBACK", i.jsonp(n)).success(function(e) {
if (e && e.data) for (var t = 0; t < e.data.length; t++) e.data[t].objURL && r.list.push({
title: e.data[t].fromPageTitleEnc,
src: e.data[t].middleURL,
url: e.data[t].middleURL
})
}).error(function() {})
},
r.selectImage = function(e) {
var t = $("#img-item" + this.$index),
n = $("#img-" + this.$index);
t.siblings(".selected").removeClass("selected"),
t.addClass("selected"),
r.data.url = n.attr("src"),
r.data.title = n.attr("alt")
},
r.uploadImage = function() {
var e = $("#upload-image");
if (e.val()) {
if (/^.*\.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG)$/.test(e.val())) {
var t = e[0].files[0];
return n.uploadImage(t).then(function(e) {
var t = e.data;
0 === t.errno && (r.data.url = t.data.url)
})
}
alert("后缀只能是 jpg、gif 及 png")
}
},
r.shortCut = function(e) {
e.stopPropagation(),
13 == e.keyCode ? r.ok() : 27 == e.keyCode && r.cancel()
},
r.ok = function() {
if (r.data.R_URL.test(r.data.url)) t.close({
url: r.data.url,
title: r.data.title
});
else {
r.urlPassed = !1;
var e = $("#image-url");
e && (e.focus(), e[0].setSelectionRange(0, r.data.url.length))
}
editor.receiver.selectAll()
},
r.cancel = function() {
t.dismiss("cancel"),
editor.receiver.selectAll()
}
}]),
angular.module("kityminderEditor").directive("appendNode", ["commandBinder",
function(t) {
return {
restrict: "E",
templateUrl: "ui/directive/appendNode/appendNode.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
var r = e.minder;
t.bind(r, "appendchildnode", e),
e.execCommand = function(e) {
var t, n, i;
r.execCommand(e, "分支主题"),
t = editor.receiver.element,
n = editor.fsm,
i = editor.receiver,
t.innerText = r.queryCommandValue("text"),
n.jump("input", "input-request"),
i.selectAll()
}
}
}
}]),
angular.module("kityminderEditor").directive("arrange", ["commandBinder",
function(e) {
return {
restrict: "E",
templateUrl: "ui/directive/arrange/arrange.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.minder
}
}
}]),
angular.module("kityminderEditor").directive("colorPanel",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/colorPanel/colorPanel.html",
scope: {
minder: "="
},
replace: !0,
link: function(n) {
var i = n.minder;
i.getThemeItems();
n.$on("colorPicked",
function(e, t) {
e.stopPropagation(),
n.bgColor = t,
i.execCommand("background", t)
}),
n.setDefaultBg = function() {
var e = i.getSelectedNode(),
t = i.getNodeStyle(e, "background");
return "object" == typeof t ? t.toHEX() : t
},
n.bgColor = n.setDefaultBg() || "#fff"
}
}
}),
angular.module("kityminderEditor").directive("expandLevel",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/expandLevel/expandLevel.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.levels = [1, 2, 3, 4, 5, 6]
}
}
}),
angular.module("kityminderEditor").directive("fontOperator",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/fontOperator/fontOperator.html",
scope: {
minder: "="
},
replace: !0,
link: function(n) {
var i = n.minder;
i.getThemeItems();
n.fontSizeList = [10, 12, 16, 18, 24, 32, 48],
n.fontFamilyList = [{
name: "宋体",
val: "宋体,SimSun"
},
{
name: "微软雅黑",
val: "微软雅黑,Microsoft YaHei"
},
{
name: "楷体",
val: "楷体,楷体_GB2312,SimKai"
},
{
name: "黑体",
val: "黑体, SimHei"
},
{
name: "隶书",
val: "隶书, SimLi"
},
{
name: "Andale Mono",
val: "andale mono"
},
{
name: "Arial",
val: "arial,helvetica,sans-serif"
},
{
name: "arialBlack",
val: "arial black,avant garde"
},
{
name: "Comic Sans Ms",
val: "comic sans ms"
},
{
name: "Impact",
val: "impact,chicago"
},
{
name: "Times New Roman",
val: "times new roman"
},
{
name: "Sans-Serif",
val: "sans-serif"
}],
n.$on("colorPicked",
function(e, t) {
e.stopPropagation(),
n.foreColor = t,
i.execCommand("forecolor", t)
}),
n.setDefaultColor = function() {
var e = i.getSelectedNode(),
t = i.getNodeStyle(e, "color");
return "object" == typeof t ? t.toHEX() : t
},
n.foreColor = n.setDefaultColor() || "#000",
n.getFontfamilyName = function(i) {
var r = "";
return n.fontFamilyList.forEach(function(e, t, n) {
if (e.val === i) return r = e.name,
""
}),
r
}
}
}
}),
angular.module("kityminderEditor").directive("hyperLink", ["$modal",
function(n) {
return {
restrict: "E",
templateUrl: "ui/directive/hyperLink/hyperLink.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
var t = e.minder;
e.addHyperlink = function() {
var e = t.queryCommandValue("HyperLink");
n.open({
animation: !0,
templateUrl: "ui/dialog/hyperlink/hyperlink.tpl.html",
controller: "hyperlink.ctrl",
size: "md",
resolve: {
link: function() {
return e
}
}
}).result.then(function(e) {
t.execCommand("HyperLink", e.url, e.title || "")
})
}
}
}
}]),
angular.module("kityminderEditor").directive("imageBtn", ["$modal",
function(n) {
return {
restrict: "E",
templateUrl: "ui/directive/imageBtn/imageBtn.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
var t = e.minder;
e.addImage = function() {
var e = t.queryCommandValue("image");
n.open({
animation: !0,
templateUrl: "ui/dialog/image/image.tpl.html",
controller: "image.ctrl",
size: "md",
resolve: {
image: function() {
return e
}
}
}).result.then(function(e) {
t.execCommand("image", e.url, e.title || "")
})
}
}
}
}]),
angular.module("kityminderEditor").directive("kityminderEditor", ["config", "minder.service", "revokeDialog",
function(a, l, e) {
return {
restrict: "EA",
templateUrl: "ui/directive/kityminderEditor/kityminderEditor.html",
replace: !0,
scope: {
onInit: "&"
},
link: function(i, e, t) {
var r = e.children(".minder-editor")[0];
function o(e, t) {
i.onInit({
editor: e,
minder: t
}),
l.executeCallback()
}
if ("undefined" != typeof seajs) seajs.config({
base: "./src"
}),
define("demo",
function(e) {
var t = e("editor"),
n = window.editor = new t(r);
window.localStorage.__dev_minder_content && n.minder.importJson(JSON.parse(window.localStorage.__dev_minder_content)),
n.minder.on("contentchange",
function() {
window.localStorage.__dev_minder_content = JSON.stringify(n.minder.exportJson())
}),
window.minder = window.km = n.minder,
i.editor = n,
i.minder = minder,
i.config = a.get(),
i.$apply(),
o(n, minder)
}),
seajs.use("demo");
else if (window.kityminder && window.kityminder.Editor) {
var n = new kityminder.Editor(r);
window.editor = i.editor = n,
window.minder = i.minder = n.minder,
i.config = a.get(),
o(n, n.minder)
}
}
}
}]),
angular.module("kityminderEditor").directive("kityminderViewer", ["config", "minder.service",
function(e, l) {
return {
restrict: "EA",
templateUrl: "ui/directive/kityminderViewer/kityminderViewer.html",
replace: !0,
scope: {
onInit: "&"
},
link: function(e, t, n) {
var i, r, o = t.children(".minder-viewer")[0];
if (window.kityminder && window.kityminder.Editor) {
var a = new kityminder.Editor(o);
window.editor = e.editor = a,
window.minder = e.minder = a.minder,
r = (i = a).minder,
e.onInit({
editor: i,
minder: r
}),
l.executeCallback()
}
}
}
}]),
angular.module("kityminderEditor").directive("layout",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/layout/layout.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {}
}
}),
angular.module("kityminderEditor").directive("navigator", ["memory", "config",
function(g, f) {
return {
restrict: "A",
templateUrl: "ui/directive/navigator/navigator.html",
scope: {
minder: "="
},
link: function(n) {
function e() {
minder.on("layout layoutallfinish", m),
minder.on("viewchange", p)
}
function t() {
minder.off("layout layoutallfinish", m),
minder.off("viewchange", p)
}
minder.setDefaultOptions({
zoom: f.get("zoom")
}),
n.isNavOpen = !g.get("navigator-hidden"),
n.getZoomRadio = function(e) {
var t = minder.getOption("zoom"),
n = t[0];
return 1 - (e - n) / (t[t.length - 1] - n)
},
n.getHeight = function(e) {
var t = $(".zoom-pan").height();
return n.getZoomRadio(e) * t
},
n.zoom = 100,
minder.on("zoom",
function(e) {
n.zoom = e.zoom
}),
n.toggleNavOpen = function() {
n.isNavOpen = !n.isNavOpen,
g.set("navigator-hidden", !n.isNavOpen),
n.isNavOpen ? (e(), m(), p()) : t()
},
setTimeout(function() {
n.isNavOpen ? (e(), m(), p()) : t()
},
0);
var i = $(".nav-previewer"),
r = new kity.Paper(i[0]),
o = r.put(new kity.Path),
a = r.put(new kity.Path),
l = r.put(new kity.Rect(100, 100).stroke("red", "1%")),
s = new kity.Box,
c = new kity.Box,
d = u(minder.getTheme());
function u(e) {
switch (e) {
case "tianpan":
case "tianpan-compact":
return function(e, t, n, i, r) {
var o = i >> 1;
e.push("M", t, n + o, "a", o, o, 0, 1, 1, 0, .01, "z")
};
default:
return function(e, t, n, i, r) {
e.push("M", t, n, "h", i, "v", r, "h", -i, "z")
}
}
}
function m() {
var e = minder.getRenderContainer().getBoundaryBox();
s = e;
r.setViewBox(e.x - 30 - .5, e.y - 30 - .5, e.width + 60 + 1, e.height + 60 + 1);
var n = [],
i = [];
minder.getRoot().traverse(function(e) {
var t = e.getLayoutBox();
d(n, t.x, t.y, t.width, t.height),
e.getConnection() && e.parent && e.parent.isExpanded() && i.push(e.getConnection().getPathData())
}),
r.setStyle("background", minder.getStyle("background")),
n.length ? o.fill(minder.getStyle("root-background")).setPathData(n) : o.setPathData(null),
i.length ? a.stroke(minder.getStyle("connect-color"), "0.5%").setPathData(i) : a.setPathData(null),
p()
}
function p() {
c = minder.getViewDragger().getView(),
l.setBox(c.intersect(s))
}
minder.on("themechange",
function(e) {
d = u(e.theme)
}),
function() {
function t(e, t) {
var n = c;
e.x = -e.x,
e.y = -e.y;
var i = minder.getPaper().getViewPortMatrix();
n = i.transformBox(n);
var r = e.offset(n.width / 2, n.height / 2);
minder.getViewDragger().moveTo(r, t)
}
var n = !1;
r.on("mousedown",
function(e) {
n = !0,
t(e.getPosition("top"), 200),
i.addClass("grab")
}),
r.on("mousemove",
function(e) {
n && t(e.getPosition("top"))
}),
$(window).on("mouseup",
function() {
n = !1,
i.removeClass("grab")
})
} ()
}
}
}]),
angular.module("kityminderEditor").directive("noteBtn", ["valueTransfer",
function(t) {
return {
restrict: "E",
templateUrl: "ui/directive/noteBtn/noteBtn.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.minder;
e.addNote = function() {
t.noteEditorOpen = !0
}
}
}
}]),
angular.module("kityminderEditor").directive("noteEditor", ["valueTransfer",
function(a) {
return {
restrict: "A",
templateUrl: "ui/directive/noteEditor/noteEditor.html",
scope: {
minder: "="
},
replace: !0,
controller: ["$scope",
function(n) {
var i, r = n.minder,
o = !1;
n.codemirrorLoaded = function(e) {
i = n.cmEditor = e,
e.setSize("100%", "100%")
},
n.$watch("noteContent",
function(e) {
var t = -1 != r.queryCommandState("note");
e && t && !o && r.execCommand("note", e),
setTimeout(function() {
i.refresh()
})
});
n.$watch(function() {
return a.noteEditorOpen
},
function(e, t) {
e && setTimeout(function() {
i.refresh(),
i.focus()
}),
n.noteEditorOpen = a.noteEditorOpen
},
!0),
n.closeNoteEditor = function() {
a.noteEditorOpen = !1,
editor.receiver.selectAll()
},
r.on("interactchange",
function() {
var e = n.noteEnabled = -1 != r.queryCommandState("note"),
t = r.queryCommandValue("note") || "";
e && (n.noteContent = t),
o = !0,
n.$apply(),
o = !1
})
}]
}
}]),
angular.module("kityminderEditor").directive("notePreviewer", ["$sce", "valueTransfer",
function(v, e) {
return {
restrict: "A",
templateUrl: "ui/directive/notePreviewer/notePreviewer.html",
link: function(m, e) {
var t, n = m.minder,
p = e.parent(),
g = e.children();
m.showNotePreviewer = !1,
marked.setOptions({
gfm: !0,
tables: !0,
breaks: !0,
pedantic: !1,
sanitize: !0,
smartLists: !0,
smartypants: !1
}),
n.on("shownoterequest",
function(e) {
t = setTimeout(function() { !
function(e, t) {
var n = e.getRenderer("NoteIconRenderer").getRenderShape().getRenderBox("screen"),
i = e.getData("note");
g[0].scrollTop = 0;
var r = marked(i);
t && (r = r.replace(new RegExp("(" + t + ")", "ig"), '<span class="highlight">$1</span>'));
m.noteContent = v.trustAsHtml(r),
m.$apply();
var o = $(p[0]).width(),
a = $(p[0]).height(),
l = $(g).outerWidth(),
s = $(g).outerHeight(),
c = n.cx - l / 2 - p[0].offsetLeft,
d = n.bottom + 10 - p[0].offsetTop;
c < 0 && (c = 10);
o < c + l && (c = n.left - l - 10 - p[0].offsetLeft);
a < d + s && (d = n.top - s - 10 - p[0].offsetTop);
m.previewerStyle = {
left: Math.round(c) + "px",
top: Math.round(d) + "px"
},
m.showNotePreviewer = !0;
var u = g[0].querySelector(".highlight");
u && u.scrollIntoView();
f = !0,
m.$apply()
} (e.node, e.keyword)
},
300)
}),
n.on("hidenoterequest",
function() {
clearTimeout(t),
m.showNotePreviewer = !1
});
var f = !1;
$(document).on("mousedown mousewheel DOMMouseScroll",
function() {
f && (m.showNotePreviewer = !1, m.$apply())
}),
e.on("mousedown mousewheel DOMMouseScroll",
function(e) {
e.stopPropagation()
})
}
}
}]),
angular.module("kityminderEditor").directive("operation",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/operation/operation.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.editNode = function() {
var e = editor.receiver.element,
t = editor.fsm,
n = editor.receiver;
e.innerText = minder.queryCommandValue("text"),
t.jump("input", "input-request"),
n.selectAll()
}
}
}
}),
angular.module("kityminderEditor").directive("priorityEditor", ["commandBinder",
function(r) {
return {
restrict: "E",
templateUrl: "ui/directive/priorityEditor/priorityEditor.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
for (var t = e.minder,
n = [], i = 0; i < 10; i++) n.push(i);
r.bind(t, "priority", e),
e.priorities = n,
e.getPriorityTitle = function(e) {
switch (e) {
case 0:
return "移除优先级";
default:
return "优先级" + e
}
}
}
}
}]),
angular.module("kityminderEditor").directive("progressEditor", ["commandBinder",
function(r) {
return {
restrict: "E",
templateUrl: "ui/directive/progressEditor/progressEditor.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
for (var t = e.minder,
n = [], i = 0; i < 10; i++) n.push(i);
r.bind(t, "progress", e),
e.progresses = n,
e.getProgressTitle = function(e) {
switch (e) {
case 0:
return "移除进度";
case 1:
return "未开始";
case 9:
return "全部完成";
default:
return "完成" + (e - 1) + "/8"
}
}
}
}
}]),
angular.module("kityminderEditor").directive("resourceEditor",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/resourceEditor/resourceEditor.html",
scope: {
minder: "="
},
replace: !0,
controller: ["$scope",
function(n) {
var i = n.minder,
r = !1;
i.on("interactchange",
function() {
var t = (n.enabled = -1 != i.queryCommandState("resource")) ? i.queryCommandValue("resource") : [],
e = i.getUsedResource().map(function(e) {
return {
name: e,
selected: -1 < t.indexOf(e)
}
});
n.used = e,
r = !0,
n.$apply(),
r = !1
}),
n.$watch("used",
function(e) {
if ( - 1 != i.queryCommandState("resource") && e) {
var t = e.filter(function(e) {
return e.selected
}).map(function(e) {
return e.name
});
if (r) return;
i.execCommand("resource", t)
}
},
!0),
n.resourceColor = function(e) {
return i.getResourceColor(e).toHEX()
},
n.addResource = function(e) {
var t = i.queryCommandValue("resource");
e && /\S/.test(e) && ( - 1 == t.indexOf(e) && n.used.push({
name: e,
selected: !0
}), n.newResourceName = null)
}
}]
}
}).directive("clickAnywhereButHere", ["$document",
function(o) {
return {
link: function(i, e, r) {
var n = function(e) {
var t = 0 < $("#resource-dropdown").has(e.target).length,
n = $("#resource-dropdown") == e.target;
t || n || i.$apply(r.clickAnywhereButHere)
};
i.$watch(r.isActive,
function(e, t) {
e !== t && 1 == e ? o.bind("click", n) : e !== t && 0 == e && o.unbind("click", n)
})
}
}
}]),
angular.module("kityminderEditor").directive("searchBox",
function() {
return {
restrict: "A",
templateUrl: "ui/directive/searchBox/searchBox.html",
scope: {
minder: "="
},
replace: !0,
controller: ["$scope",
function(a) {
var l = a.minder,
e = window.editor;
function n() {
$("#search-input").blur(),
a.showSearch = !1,
l.fire("hidenoterequest"),
e.receiver.selectAll()
}
function t() {
a.showSearch = !0,
setTimeout(function() {
$("#search-input").focus()
},
10),
a.keyword && $("#search-input")[0].setSelectionRange(0, a.keyword.length)
}
a.handleKeyDown = function(e) {
if (13 == e.keyCode) {
var t = e.shiftKey ? "prev": "next";
d(a.keyword, t)
}
27 == e.keyCode && n()
},
a.doSearch = d,
a.exitSearch = n,
a.showTip = !1,
a.showSearch = !1,
$("body").on("keydown",
function(e) {
70 != e.keyCode || !e.ctrlKey && !e.metaKey || e.shiftKey || (t(), a.$apply(), e.preventDefault())
}),
l.on("searchNode",
function() {
t()
});
var s = [],
c = [];
function i() {
s = [],
l.getRoot().traverse(function(e) {
s.push(e)
})
}
function d(e, t) {
if (a.showTip = !1, l.fire("hidenoterequest"), e && /\S/.exec(e)) {
a.showTip = !0,
a.curIndex = 0,
a.resultNum = 0,
e = e.toLowerCase();
var n, i, r = d.lastKeyword != e;
if (d.lastKeyword = e, r &&
function(e) {
c = [];
for (var t = 0; t < s.length; t++) {
var n = s[t]; - 1 != n.getText().toLowerCase().indexOf(e) && c.push({
node: n
});
var i = n.getData("note");
i && -1 != i.toLowerCase().indexOf(e) && c.push({
node: n,
keyword: e
})
}
} (e), a.resultNum = c.length, c.length) {
var o = r ? 0 : ("next" === t ? d.lastIndex + 1 : d.lastIndex - 1) || 0;
o = (c.length + o) % c.length,
n = c[o].node,
i = c[o].keyword,
l.execCommand("camera", n, 50),
setTimeout(function() {
l.select(n, !0),
n.isExpanded() || l.execCommand("expand", !0),
i && l.fire("shownoterequest", {
node: n,
keyword: i
})
},
60),
d.lastIndex = o,
a.curIndex = o + 1
}
} else $("#search-input").focus()
}
l.on("contentchange", i),
i()
}]
}
}),
angular.module("kityminderEditor").directive("searchBtn",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/searchBtn/searchBtn.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.enterSearch = function() {
minder.fire("searchNode")
}
}
}
}),
angular.module("kityminderEditor").directive("selectAll",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/selectAll/selectAll.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
var i = e.minder;
e.items = ["revert", "siblings", "level", "path", "tree"],
e.select = {
all: function() {
var t = [];
i.getRoot().traverse(function(e) {
t.push(e)
}),
i.select(t, !0),
i.fire("receiverfocus")
},
revert: function() {
var t = i.getSelectedNodes(),
n = [];
i.getRoot().traverse(function(e) { - 1 == t.indexOf(e) && n.push(e)
}),
i.select(n, !0),
i.fire("receiverfocus")
},
siblings: function() {
var e = i.getSelectedNodes(),
t = [];
e.forEach(function(e) {
e.parent && e.parent.children.forEach(function(e) { - 1 == t.indexOf(e) && t.push(e)
})
}),
i.select(t, !0),
i.fire("receiverfocus")
},
level: function() {
var t = i.getSelectedNodes().map(function(e) {
return e.getLevel()
}),
n = [];
i.getRoot().traverse(function(e) { - 1 != t.indexOf(e.getLevel()) && n.push(e)
}),
i.select(n, !0),
i.fire("receiverfocus")
},
path: function() {
var e = i.getSelectedNodes(),
t = [];
e.forEach(function(e) {
for (; e && -1 == t.indexOf(e);) t.push(e),
e = e.parent
}),
i.select(t, !0),
i.fire("receiverfocus")
},
tree: function() {
var e = i.getSelectedNodes(),
t = [];
e.forEach(function(e) {
e.traverse(function(e) { - 1 == t.indexOf(e) && t.push(e)
})
}),
i.select(t, !0),
i.fire("receiverfocus")
}
}
}
}
}),
angular.module("kityminderEditor").directive("styleOperator",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/styleOperator/styleOperator.html",
scope: {
minder: "="
},
replace: !0
}
}),
angular.module("kityminderEditor").directive("templateList",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/templateList/templateList.html",
scope: {
minder: "="
},
replace: !0,
link: function(e) {
e.templateList = kityminder.Minder.getTemplateList()
}
}
}),
angular.module("kityminderEditor").directive("themeList",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/themeList/themeList.html",
replace: !0,
link: function(e) {
var i = kityminder.Minder.getThemeList();
e.getThemeThumbStyle = function(e) {
var t = i[e];
if (t) {
var n = {
color: t["root-color"],
"border-radius": t["root-radius"] / 2
};
return t["root-background"] && (n.background = t["root-background"].toString()),
n
}
},
e.themeKeyList = ["classic", "classic-compact", "fresh-blue", "fresh-blue-compat", "fresh-green", "fresh-green-compat", "fresh-pink", "fresh-pink-compat", "fresh-purple", "fresh-purple-compat", "fresh-red", "fresh-red-compat", "fresh-soil", "fresh-soil-compat", "snow", "snow-compact", "tianpan", "tianpan-compact", "fish", "wire"]
}
}
}),
angular.module("kityminderEditor").directive("topTab",
function() {
return {
restrict: "A",
templateUrl: "ui/directive/topTab/topTab.html",
scope: {
minder: "=topTab",
editor: "="
},
link: function(e) {
var r = !1,
o = !0,
a = !0;
e.setCurTab = function(e) {
setTimeout(function() {
r = !0,
"idea" != e && (o = !1)
})
},
e.toggleTopTab = function() {
setTimeout(function() {
var e, t, n, i;
r && !o || (o = !1, a ? (n = $(".tab-content"), i = $(".minder-editor"), n.animate({
height: 0,
display: "none"
}), i.animate({
top: "32px"
})) : (e = $(".tab-content"), t = $(".minder-editor"), e.animate({
height: "60px",
display: "block"
}), t.animate({
top: "92px"
})), a = !a),
r = !1
})
}
}
}
}),
angular.module("kityminderEditor").directive("undoRedo",
function() {
return {
restrict: "E",
templateUrl: "ui/directive/undoRedo/undoRedo.html",
scope: {
editor: "="
},
replace: !0,
link: function(e) {}
}
}),
e = "expose-editor",
d.r([t[e]])
} ();