You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2970 rivejä
183 KiB

4 vuotta sitten
  1. /*!
  2. * ====================================================
  3. * kityminder-editor - v1.0.67 - 2021-01-07
  4. * https://github.com/fex-team/kityminder-editor
  5. * GitHub: https://github.com/fex-team/kityminder-editor
  6. * Copyright (c) 2021 ; Licensed
  7. * ====================================================
  8. */
  9. !
  10. function() {
  11. var d = {
  12. r: function(e) {
  13. if (d[e].inited) return d[e].value;
  14. if ("function" != typeof d[e].value) return d[e].inited = !0,
  15. d[e].value;
  16. var t = {
  17. exports: {}
  18. },
  19. n = d[e].value(null, t.exports, t);
  20. if (d[e].inited = !0, void 0 !== (d[e].value = n)) return n;
  21. for (var i in t.exports) if (t.exports.hasOwnProperty(i)) return d[e].inited = !0,
  22. d[e].value = t.exports,
  23. t.exports
  24. }
  25. };
  26. d[0] = {
  27. value: function(e, t, n) {
  28. var i = [];
  29. function r(e) {
  30. i.push(e)
  31. }
  32. function o(e) {
  33. this.selector = e;
  34. for (var t = 0; t < i.length; t++)"function" == typeof i[t] && i[t].call(this, this)
  35. }
  36. return (o.assemble = r)(d.r(7)),
  37. r(d.r(9)),
  38. r(d.r(14)),
  39. r(d.r(18)),
  40. r(d.r(11)),
  41. r(d.r(12)),
  42. r(d.r(5)),
  43. r(d.r(6)),
  44. r(d.r(8)),
  45. r(d.r(15)),
  46. r(d.r(10)),
  47. r(d.r(13)),
  48. r(d.r(16)),
  49. r(d.r(17)),
  50. n.exports = o
  51. }
  52. },
  53. d[1] = {
  54. value: function(e, t, n) {
  55. return n.exports = kityminder.Editor = d.r(0)
  56. }
  57. },
  58. d[2] = {
  59. value: function(e, t, n) {
  60. return n.exports = window.HotBox
  61. }
  62. },
  63. d[3] = {
  64. value: function(e, t, n) {}
  65. },
  66. d[4] = {
  67. value: function(e, t, n) {
  68. return n.exports = window.kityminder.Minder
  69. }
  70. },
  71. d[5] = {
  72. value: function(e, t, n) {
  73. function i() {
  74. var n = "\ufeff",
  75. i = {
  76. "application/km": "￿"
  77. },
  78. r = {
  79. "\ufeff": "SPLITOR",
  80. "￿": "application/km"
  81. };
  82. function o(e, t) {
  83. if (!this.isPureText(t)) {
  84. if (!this.whichMimeType(t)) throw new Error("unknow mimetype!");
  85. t = this.getPureText(t)
  86. }
  87. return ! 1 === e ? t: e + n + t
  88. }
  89. this.registMimeTypeProtocol = function(e, t) {
  90. if (t && r[t]) throw new Error("sing has registed!");
  91. if (e && i[e]) throw new Error("mimetype has registed!");
  92. r[t] = e,
  93. i[e] = t
  94. },
  95. this.getMimeTypeProtocol = function(e, t) {
  96. var n = i[e] || !1;
  97. return void 0 === t ? o.bind(this, n) : o(n, t)
  98. },
  99. this.getSpitor = function() {
  100. return n
  101. },
  102. this.getMimeType = function(e) {
  103. return void 0 !== e ? r[e] || null: i
  104. }
  105. }
  106. return i.prototype.isPureText = function(e) {
  107. return ! ~e.indexOf(this.getSpitor())
  108. },
  109. i.prototype.getPureText = function(e) {
  110. return this.isPureText(e) ? e: e.split(this.getSpitor())[1]
  111. },
  112. i.prototype.whichMimeType = function(e) {
  113. return this.isPureText(e) ? null: this.getMimeType(e.split(this.getSpitor())[0])
  114. },
  115. n.exports = function() {
  116. this.minder.supportClipboardEvent && !kity.Browser.gecko && (this.MimeType = new i)
  117. }
  118. }
  119. },
  120. d[6] = {
  121. value: function(e, t, n) {
  122. return n.exports = function() {
  123. var c = this.minder,
  124. r = window.kityminder.data;
  125. if (c.supportClipboardEvent && !kity.Browser.gecko) {
  126. var d = this.fsm,
  127. u = this.receiver,
  128. s = this.MimeType,
  129. o = s.getMimeTypeProtocol("application/km"),
  130. m = r.getRegisterProtocol("json").decode,
  131. p = [];
  132. document.addEventListener("copy",
  133. function(e) {
  134. if (document.activeElement == u.element) {
  135. var t = e;
  136. switch (d.state()) {
  137. case "input":
  138. break;
  139. case "normal":
  140. var n = [].concat(c.getSelectedNodes());
  141. if (n.length) {
  142. var i;
  143. if (1 < n.length && (n.sort(function(e, t) {
  144. return e.getLevel() - t.getLevel()
  145. }), (i = n[0].getLevel()) !== n[n.length - 1].getLevel())) {
  146. var r, o = 0,
  147. a = n.length,
  148. l = a - 1;
  149. for (r = n[l]; r.getLevel() !== i;) {
  150. for (o = 0; o < a && n[o].getLevel() === i;) {
  151. if (n[o].isAncestorOf(r)) {
  152. n.splice(l, 1);
  153. break
  154. }
  155. o++
  156. }
  157. r = n[--l]
  158. }
  159. }
  160. var s = g(n);
  161. t.clipboardData.setData("text/plain", s)
  162. }
  163. e.preventDefault()
  164. }
  165. }
  166. }),
  167. document.addEventListener("cut",
  168. function(e) {
  169. if (document.activeElement == u.element) {
  170. if ("normal" !== c.getStatus()) return void e.preventDefault();
  171. var t = e;
  172. switch (d.state()) {
  173. case "input":
  174. break;
  175. case "normal":
  176. var n = c.getSelectedNodes();
  177. n.length && (t.clipboardData.setData("text/plain", g(n)), c.execCommand("removenode")),
  178. e.preventDefault()
  179. }
  180. }
  181. }),
  182. document.addEventListener("paste",
  183. function(e) {
  184. if (document.activeElement == u.element) {
  185. if ("normal" !== c.getStatus()) return void e.preventDefault();
  186. var t = e,
  187. n = d.state(),
  188. i = t.clipboardData.getData("text/plain");
  189. switch (n) {
  190. case "input":
  191. if (!s.isPureText(i)) return void e.preventDefault();
  192. break;
  193. case "normal":
  194. var r = c.getSelectedNodes();
  195. if ("application/km" === s.whichMimeType(i)) {
  196. var o, a = m(s.getPureText(i));
  197. r.forEach(function(e) {
  198. for (var t = a.length - 1; 0 <= t; t--) o = c.createNode(null, e),
  199. c.importNode(o, a[t]),
  200. p.push(o),
  201. e.appendChild(o)
  202. }),
  203. c.select(p, !0),
  204. p = [],
  205. c.refresh()
  206. } else {
  207. if (t.clipboardData && -1 < t.clipboardData.items[0].type.indexOf("image")) {
  208. var l = t.clipboardData.items[0].getAsFile();
  209. return angular.element(document.body).injector().get("server").uploadImage(l).then(function(e) {
  210. var t = e.data;
  211. 0 === t.errno && c.execCommand("image", t.data.url)
  212. })
  213. }
  214. r.forEach(function(e) {
  215. c.Text2Children(e, i)
  216. })
  217. }
  218. e.preventDefault()
  219. }
  220. }
  221. })
  222. }
  223. function g(e) {
  224. for (var t = [], n = 0, i = e.length; n < i; n++) t.push(c.exportNode(e[n]));
  225. return o(r.getRegisterProtocol("json").encode(t))
  226. }
  227. }
  228. }
  229. },
  230. d[7] = {
  231. value: function(e, t, n) {
  232. return n.exports = function() {
  233. var e;
  234. if (! (e = "string" == typeof this.selector ? document.querySelector(this.selector) : this.selector)) throw new Error("Invalid selector: " + this.selector);
  235. e.classList.add("km-editor"),
  236. this.container = e
  237. }
  238. }
  239. },
  240. d[8] = {
  241. value: function(e, t, n) {
  242. var v = d.r(2);
  243. new(d.r(19))("drag");
  244. return n.exports = function() {
  245. var n, i, t = this.fsm,
  246. o = this.minder,
  247. r = this.hotbox;
  248. this.receiver.element,
  249. t.when("* -> drag",
  250. function() {}),
  251. t.when("drag -> *",
  252. function(e, t, n) {});
  253. var a, l, s, c, d, u, m = 1,
  254. p = !1,
  255. g = !1;
  256. function f(e, t) {
  257. if (!e) return p = g = !1,
  258. u && kity.releaseFrame(u),
  259. void(u = null);
  260. var n, i, r;
  261. u || (u = kity.requestFrame((n = e, i = t, r = o,
  262. function(e) {
  263. switch (n) {
  264. case "left":
  265. r._viewDragger.move({
  266. x:
  267. -i,
  268. y: 0
  269. },
  270. 0);
  271. break;
  272. case "top":
  273. r._viewDragger.move({
  274. x:
  275. 0,
  276. y: -i
  277. },
  278. 0);
  279. break;
  280. case "right":
  281. r._viewDragger.move({
  282. x:
  283. i,
  284. y: 0
  285. },
  286. 0);
  287. break;
  288. case "bottom":
  289. r._viewDragger.move({
  290. x:
  291. 0,
  292. y: i
  293. },
  294. 0);
  295. break;
  296. default:
  297. return
  298. }
  299. e.next()
  300. })))
  301. }
  302. o.on("mousedown",
  303. function(e) {
  304. m = 0;
  305. var t = o.getPaper().container.getBoundingClientRect();
  306. n = e.originEvent.clientX,
  307. i = e.originEvent.clientY,
  308. d = t.top,
  309. a = t.width,
  310. l = t.height
  311. }),
  312. o.on("mousemove",
  313. function(e) {
  314. 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),
  315. t.jump("drag", "user-drag")
  316. }),
  317. window.addEventListener("mouseup",
  318. function() {
  319. if (m = 1, "drag" === t.state()) return f(!1),
  320. t.jump("normal", "drag-finish")
  321. },
  322. !1)
  323. }
  324. }
  325. },
  326. d[9] = {
  327. value: function(e, t, n) {
  328. var s = new(d.r(19))("fsm");
  329. function c(e, t, n, i) {
  330. return e.when == t && (("*" == e.enter || e.enter == i) && ("*" == e.exit || e.exit == n || void 0))
  331. }
  332. return n.exports = function() {
  333. this.fsm = new
  334. function(e) {
  335. var a = e,
  336. l = [];
  337. this.jump = function(e, t) {
  338. if (!t) throw new Error("Please tell fsm the reason to jump");
  339. var n, i, r = a,
  340. o = [r, e].concat([].slice.call(arguments, 1));
  341. for (n = 0; n < l.length; n++) if (c((i = l[n]).condition, "before", r, e) && i.apply(null, o)) return;
  342. 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);
  343. return a
  344. },
  345. this.state = function() {
  346. return a
  347. },
  348. this.when = function(e, t) {
  349. var n, i, r, o;
  350. 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);
  351. r = i[0],
  352. o = i[1],
  353. t.condition = {
  354. when: n,
  355. exit: r,
  356. enter: o
  357. },
  358. l.push(t)
  359. }
  360. } ("normal")
  361. }
  362. }
  363. },
  364. d[10] = {
  365. value: function(e, t, n) {
  366. var g = d.r(22);
  367. return window.diff = g,
  368. n.exports = function() {
  369. var n, i, r, o, a = this.minder,
  370. e = this.hotbox,
  371. l = 100;
  372. function t() {
  373. r = [],
  374. o = [],
  375. n = a.exportJson()
  376. }
  377. function s() {
  378. var e = a.exportJson(),
  379. t = g(e, n);
  380. if (t.length) {
  381. for (r.push(t); r.length > l;) r.shift();
  382. return n = e,
  383. !0
  384. }
  385. }
  386. function c() {
  387. i = !0;
  388. var e, t = r.pop();
  389. t && (a.applyPatches(t), e = a.exportJson(), o.push(g(e, n)), n = e),
  390. i = !1
  391. }
  392. function d() {
  393. i = !0;
  394. var e = o.pop();
  395. e && (a.applyPatches(e), s()),
  396. i = !1
  397. }
  398. function u() {
  399. return !! r.length
  400. }
  401. function m() {
  402. return !! o.length
  403. }
  404. this.history = {
  405. reset: t,
  406. undo: c,
  407. redo: d,
  408. hasUndo: u,
  409. hasRedo: m
  410. },
  411. t(),
  412. a.on("contentchange",
  413. function() {
  414. i || s() && (o = [])
  415. }),
  416. a.on("import", t),
  417. a.on("patch",
  418. function(e) {
  419. if (i) {
  420. var t = e.patch;
  421. switch (t.express) {
  422. case "node.add":
  423. a.select(t.node.getChild(t.index), !0);
  424. break;
  425. case "node.remove":
  426. case "data.replace":
  427. case "data.remove":
  428. case "data.add":
  429. a.select(t.node, !0)
  430. }
  431. }
  432. });
  433. var p = e.state("main");
  434. p.button({
  435. position: "top",
  436. label: "撤销",
  437. key: "Ctrl + Z",
  438. enable: u,
  439. action: c,
  440. next: "idle"
  441. }),
  442. p.button({
  443. position: "top",
  444. label: "重做",
  445. key: "Ctrl + Y",
  446. enable: m,
  447. action: d,
  448. next: "idle"
  449. })
  450. }
  451. }
  452. },
  453. d[11] = {
  454. value: function(e, t, n) {
  455. var i = d.r(2);
  456. return n.exports = function() {
  457. var e = this.fsm,
  458. a = this.minder,
  459. r = this.receiver,
  460. t = this.container,
  461. l = new i(t);
  462. l.setParentFSM(e),
  463. e.when("normal -> hotbox",
  464. function(e, t, n) {
  465. var i, r = a.getSelectedNode();
  466. if (r) {
  467. var o = r.getRenderBox();
  468. i = {
  469. x: o.cx,
  470. y: o.cy
  471. }
  472. }
  473. l.active("main", i)
  474. }),
  475. e.when("normal -> normal",
  476. function(e, t, n, i) {
  477. "shortcut-handle" == n && (l.dispatch(i) ? i.preventDefault() : a.dispatchKeyEvent(i))
  478. }),
  479. e.when("modal -> normal",
  480. function(e, t, n, i) {
  481. "import-text-finish" == n && r.element.focus()
  482. }),
  483. this.hotbox = l
  484. }
  485. }
  486. },
  487. d[12] = {
  488. value: function(e, t, n) {
  489. d.r(21);
  490. var s = new(d.r(19))("input");
  491. return n.exports = function() {
  492. var r = this.fsm,
  493. p = this.minder,
  494. e = this.hotbox,
  495. o = this.receiver,
  496. a = o.element,
  497. l = window.kity.Browser.gecko;
  498. function t() {
  499. var e = p.getSelectedNode();
  500. if (e) {
  501. var t = a;
  502. if (a.innerText = "", "bold" === e.getData("font-weight")) {
  503. var n = document.createElement("b");
  504. t.appendChild(n),
  505. t = n
  506. }
  507. if ("italic" === e.getData("font-style")) {
  508. var i = document.createElement("i");
  509. t.appendChild(i),
  510. t = i
  511. }
  512. t.innerText = p.queryCommandValue("text"),
  513. l && o.fixFFCaretDisappeared(),
  514. r.jump("input", "input-request"),
  515. o.selectAll()
  516. }
  517. }
  518. function n() {
  519. var e = p.getSelectedNode();
  520. if (e) {
  521. var t = e.getData("font-size") || e.getStyle("font-size");
  522. a.style.fontSize = t + "px",
  523. a.style.minWidth = 0,
  524. a.style.minWidth = a.clientWidth + "px",
  525. a.style.fontWeight = e.getData("font-weight") || "",
  526. a.style.fontStyle = e.getData("font-style") || "",
  527. a.classList.add("input"),
  528. a.focus()
  529. }
  530. }
  531. function g() {
  532. a.classList.remove("input"),
  533. o.selectAll()
  534. }
  535. function i() {
  536. var t = i,
  537. n = p.getSelectedNode();
  538. n && (t.timer || (t.timer = setTimeout(function() {
  539. var e = n.getRenderBox("TextRenderer");
  540. a.style.left = Math.round(e.x) + "px",
  541. a.style.top = (s.flaged ? Math.round(e.bottom + 30) : Math.round(e.y)) + "px",
  542. t.timer = 0
  543. })))
  544. }
  545. s.flaged && a.classList.add("debug"),
  546. a.onmousedown = function(e) {
  547. e.stopPropagation()
  548. },
  549. p.on("layoutallfinish viewchange viewchanged selectionchange",
  550. function(e) {
  551. "viewchange" == e.type && "input" != r.state() || i()
  552. }),
  553. i(),
  554. r.when("* -> input", n),
  555. r.when("input -> *",
  556. function(e, t, n) {
  557. switch (n) {
  558. case "input-cancel":
  559. return g();
  560. case "input-commit":
  561. default:
  562. return function() {
  563. var e = [].slice.call(a.childNodes);
  564. setTimeout(function() {
  565. a.innerHTML = ""
  566. },
  567. 0);
  568. var t = p.getSelectedNode();
  569. if (e = function(e) {
  570. for (var t, n, i, r = "",
  571. o = /\S/,
  572. 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)) {
  573. case "[object HTMLBRElement]":
  574. r += "\n";
  575. break;
  576. case "[object Text]":
  577. if (t = t.textContent.replace("&nbsp;", " "), o.test(t)) r += t;
  578. else for (i = t.length; i--;) a.test(t[i]) ? r += " ": "\t" === t[i] && (r += "\t");
  579. break;
  580. case "[object HTMLElement]":
  581. switch (t.nodeName) {
  582. case "B":
  583. s = !0;
  584. break;
  585. case "I":
  586. c = !0
  587. } [].splice.apply(e, [d, 1].concat([].slice.call(t.childNodes))),
  588. u = e.length,
  589. d--;
  590. break;
  591. case "[object HTMLSpanElement]":
  592. [].splice.apply(e, [d, 1].concat([].slice.call(t.childNodes))),
  593. u = e.length,
  594. d--;
  595. break;
  596. case "[object HTMLImageElement]":
  597. t.src && /http(|s):\/\//.test(t.src) && p.execCommand("Image", t.src, t.alt);
  598. break;
  599. case "[object HTMLDivElement]":
  600. n = [];
  601. for (var m = 0,
  602. u = t.childNodes.length; m < u; m++) n.push(t.childNodes[m]);
  603. n.push(l),
  604. [].splice.apply(e, [d, 1].concat(n)),
  605. u = e.length,
  606. d--;
  607. break;
  608. default:
  609. if (t && t.childNodes.length) {
  610. n = [];
  611. for (var m = 0,
  612. u = t.childNodes.length; m < u; m++) n.push(t.childNodes[m]);
  613. n.push(l),
  614. [].splice.apply(e, [d, 1].concat(n)),
  615. u = e.length,
  616. d--
  617. } else t && void 0 !== t.textContent ? r += t.textContent: r += ""
  618. }
  619. return r = (r = r.replace(/^\n*|\n*$/g, "")).replace(new RegExp("(\n|\r|\n\r)( |" + String.fromCharCode(160) + "){4}", "g"), "$1\t"),
  620. p.getSelectedNode().setText(r),
  621. s ? p.queryCommandState("bold") || p.execCommand("bold") : p.queryCommandState("bold") && p.execCommand("bold"),
  622. c ? p.queryCommandState("italic") || p.execCommand("italic") : p.queryCommandState("italic") && p.execCommand("italic"),
  623. g(),
  624. r
  625. } (e),
  626. function(t, e) {
  627. try {
  628. p.decodeData("text", e).then(function(e) { !
  629. function e(t, n, i) {
  630. var r = n.data;
  631. t.setText(r.text || "");
  632. for (var o = n.children || [], a = 0; a < o.length; a++) {
  633. var l = i.createNode(null, t);
  634. e(l, o[a], i)
  635. }
  636. return t
  637. } (t, e, p),
  638. p.fire("contentchange"),
  639. p.getRoot().renderTree(),
  640. p.layout(300)
  641. })
  642. } catch(e) {
  643. if (p.fire("contentchange"), p.getRoot().renderTree(), "Error: Invalid local format" !== e.toString()) throw e
  644. }
  645. } (t, e), "root" == t.type) {
  646. var n = p.getRoot().getText();
  647. p.fire("initChangeRoot", {
  648. text: n
  649. })
  650. }
  651. } ()
  652. }
  653. }),
  654. o.onblur(function(e) {
  655. "input" == r.state() && r.jump("normal", "input-commit")
  656. }),
  657. p.on("beforemousedown",
  658. function() {
  659. "input" == r.state() && r.jump("normal", "input-commit")
  660. }),
  661. p.on("dblclick",
  662. function() {
  663. p.getSelectedNode() && "readonly" !== p._status && t()
  664. }),
  665. e.state("main").button({
  666. position: "center",
  667. label: "编辑",
  668. key: "F2",
  669. enable: function() {
  670. return - 1 != p.queryCommandState("text")
  671. },
  672. action: t
  673. }),
  674. this.editText = t
  675. }
  676. }
  677. },
  678. d[13] = {
  679. value: function(e, t, n) {
  680. var c = d.r(2);
  681. return n.exports = function() {
  682. var t, n, i = this.fsm,
  683. r = this.minder,
  684. o = this.receiver,
  685. e = this.container,
  686. a = o.element,
  687. l = this.hotbox,
  688. s = !1;
  689. o.listen("normal",
  690. function(e) {
  691. if (o.enable(), e.is("Space")) return e.preventDefault(),
  692. kity.Browser.safari && (a.innerHTML = ""),
  693. i.jump("hotbox", "space-trigger");
  694. switch (e.type) {
  695. case "keydown":
  696. if (r.getSelectedNode()) {
  697. 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")
  698. } else a.innerHTML = "";
  699. i.jump("normal", "shortcut-handle", e)
  700. }
  701. var t
  702. }), o.listen("hotbox",
  703. function(e) {
  704. if (o.disable(), e.preventDefault(), l.dispatch(e), l.state() == c.STATE_IDLE && "hotbox" == i.state()) return i.jump("normal", "hotbox-idle")
  705. }),
  706. o.listen("input",
  707. function(e) {
  708. if (o.enable(), "keydown" == e.type) {
  709. if (e.is("Enter")) return e.preventDefault(),
  710. i.jump("normal", "input-commit");
  711. if (e.is("Esc")) return e.preventDefault(),
  712. i.jump("normal", "input-cancel"); (e.is("Tab") || e.is("Shift + Tab")) && e.preventDefault()
  713. } else if ("keyup" == e.type && e.is("Esc")) {
  714. if (e.preventDefault(), !s) return i.jump("normal", "input-cancel")
  715. } else "compositionstart" == e.type ? s = !0 : "compositionend" == e.type && setTimeout(function() {
  716. s = !1
  717. })
  718. }),
  719. e.addEventListener("mousedown",
  720. function(e) {
  721. 2 == e.button && e.preventDefault(),
  722. "hotbox" == i.state() ? (l.active(c.STATE_IDLE), i.jump("normal", "blur")) : "normal" == i.state() && 2 == e.button && (t = e.clientX, n = e.clientY)
  723. },
  724. !1),
  725. e.addEventListener("mousewheel",
  726. function(e) {
  727. "hotbox" == i.state() && (l.active(c.STATE_IDLE), i.jump("normal", "mousemove-blur"))
  728. },
  729. !1),
  730. e.addEventListener("contextmenu",
  731. function(e) {
  732. e.preventDefault()
  733. }),
  734. e.addEventListener("mouseup",
  735. function(e) {
  736. "normal" == i.state() && 2 == e.button && e.clientX == t && e.clientY == n && r.getSelectedNode() && i.jump("hotbox", "content-menu")
  737. },
  738. !1),
  739. l.$element.addEventListener("mousedown",
  740. function(e) {
  741. e.stopPropagation()
  742. })
  743. }
  744. }
  745. },
  746. d[14] = {
  747. value: function(e, t, n) {
  748. var i = d.r(4);
  749. return n.exports = function() {
  750. var e = new i({
  751. enableKeyReceiver: !1,
  752. enableAnimation: !0
  753. });
  754. e.renderTo(this.selector),
  755. e.setTheme(null),
  756. e.select(e.getRoot(), !0),
  757. e.execCommand("text", "中心主题"),
  758. this.minder = e
  759. }
  760. }
  761. },
  762. d[15] = {
  763. value: function(e, t, n) {
  764. return n.exports = function() {
  765. var o = this,
  766. a = this.minder,
  767. e = this.hotbox,
  768. l = this.fsm,
  769. s = e.state("main"),
  770. c = 0; ["前移:Alt+Up:ArrangeUp", "下级:Tab|Insert:AppendChildNode", "同级:Enter:AppendSiblingNode", "后移:Alt+Down:ArrangeDown", "删除:Delete|Backspace:RemoveNode", "上级:Shift+Tab|Shift+Insert:AppendParentNode"].forEach(function(e) {
  771. var t = e.split(":"),
  772. n = t.shift(),
  773. i = t.shift(),
  774. r = t.shift();
  775. s.button({
  776. position: "ring",
  777. label: n,
  778. key: i,
  779. action: function() {
  780. 0 === r.indexOf("Append") ? (c++, a.execCommand(r, "分支主题"), a.on("layoutallfinish",
  781. function e() {--c || o.editText(),
  782. a.off("layoutallfinish", e)
  783. })) : (a.execCommand(r), l.jump("normal", "command-executed"))
  784. },
  785. enable: function() {
  786. return - 1 != a.queryCommandState(r)
  787. }
  788. })
  789. }),
  790. s.button({
  791. position: "bottom",
  792. label: "导入节点",
  793. key: "Alt + V",
  794. enable: function() {
  795. return 1 == a.getSelectedNodes().length
  796. },
  797. action: function() {
  798. a.fire("importNodeData")
  799. },
  800. next: "idle"
  801. }),
  802. s.button({
  803. position: "bottom",
  804. label: "导出节点",
  805. key: "Alt + C",
  806. enable: function() {
  807. return 1 == a.getSelectedNodes().length
  808. },
  809. action: function() {
  810. a.fire("exportNodeData")
  811. },
  812. next: "idle"
  813. })
  814. }
  815. }
  816. },
  817. d[16] = {
  818. value: function(e, t, n) {
  819. return n.exports = function() {
  820. var t = this.minder,
  821. e = this.hotbox;
  822. e.state("main").button({
  823. position: "top",
  824. label: "优先级",
  825. key: "P",
  826. next: "priority",
  827. enable: function() {
  828. return - 1 != t.queryCommandState("priority")
  829. }
  830. });
  831. var n = e.state("priority");
  832. "123456789".replace(/./g,
  833. function(e) {
  834. n.button({
  835. position: "ring",
  836. label: "P" + e,
  837. key: e,
  838. action: function() {
  839. t.execCommand("Priority", e)
  840. }
  841. })
  842. }),
  843. n.button({
  844. position: "center",
  845. label: "移除",
  846. key: "Del",
  847. action: function() {
  848. t.execCommand("Priority", 0)
  849. }
  850. }),
  851. n.button({
  852. position: "top",
  853. label: "返回",
  854. key: "esc",
  855. next: "back"
  856. })
  857. }
  858. }
  859. },
  860. d[17] = {
  861. value: function(e, t, n) {
  862. return n.exports = function() {
  863. var t = this.minder,
  864. e = this.hotbox;
  865. e.state("main").button({
  866. position: "top",
  867. label: "进度",
  868. key: "G",
  869. next: "progress",
  870. enable: function() {
  871. return - 1 != t.queryCommandState("progress")
  872. }
  873. });
  874. var n = e.state("progress");
  875. "012345678".replace(/./g,
  876. function(e) {
  877. n.button({
  878. position: "ring",
  879. label: "G" + e,
  880. key: e,
  881. action: function() {
  882. t.execCommand("Progress", parseInt(e) + 1)
  883. }
  884. })
  885. }),
  886. n.button({
  887. position: "center",
  888. label: "移除",
  889. key: "Del",
  890. action: function() {
  891. t.execCommand("Progress", 0)
  892. }
  893. }),
  894. n.button({
  895. position: "top",
  896. label: "返回",
  897. key: "esc",
  898. next: "back"
  899. })
  900. }
  901. }
  902. },
  903. d[18] = {
  904. value: function(e, t, n) {
  905. var a = d.r(23);
  906. d.r(2);
  907. return n.exports = function() {
  908. var i = this.fsm,
  909. e = this.minder,
  910. n = document.createElement("div");
  911. n.contentEditable = !0,
  912. n.setAttribute("tabindex", -1),
  913. n.classList.add("receiver"),
  914. n.onkeydown = n.onkeypress = n.onkeyup = o,
  915. n.addEventListener("compositionstart", o),
  916. this.container.appendChild(n);
  917. var t = {
  918. element: n,
  919. selectAll: function() {
  920. n.innerHTML || (n.innerHTML = "&nbsp;");
  921. var e = document.createRange(),
  922. t = window.getSelection();
  923. e.selectNodeContents(n),
  924. t.removeAllRanges(),
  925. t.addRange(e),
  926. n.focus()
  927. },
  928. enable: function() {
  929. n.setAttribute("contenteditable", !0)
  930. },
  931. disable: function() {
  932. n.setAttribute("contenteditable", !1)
  933. },
  934. fixFFCaretDisappeared: function() {
  935. n.removeAttribute("contenteditable"),
  936. n.setAttribute("contenteditable", "true"),
  937. n.blur(),
  938. n.focus()
  939. },
  940. onblur: function(e) {
  941. n.onblur = e
  942. }
  943. };
  944. t.selectAll(),
  945. e.on("beforemousedown", t.selectAll),
  946. e.on("receiverfocus", t.selectAll),
  947. e.on("readonly",
  948. function() {
  949. e.disable(),
  950. editor.receiver.element.parentElement.removeChild(editor.receiver.element),
  951. editor.hotbox.$container.removeChild(editor.hotbox.$element)
  952. });
  953. var r = [];
  954. function o(e) {
  955. var t;
  956. e.is = function(e) {
  957. for (var t = e.split("|"), n = 0; n < t.length; n++) if (a.is(this, t[n])) return ! 0;
  958. return ! 1
  959. };
  960. for (var n = 0; n < r.length; n++) if (("*" == (t = r[n]).notifyState || t.notifyState == i.state()) && t.call(null, e)) return
  961. }
  962. t.listen = function(e, t) {
  963. 1 == arguments.length && (t = e, e = "*"),
  964. t.notifyState = e,
  965. r.push(t)
  966. },
  967. this.receiver = t
  968. }
  969. }
  970. },
  971. d[19] = {
  972. value: function(e, t, n) {
  973. var i = d.r(20);
  974. function r() {}
  975. return n.exports = function(t) {
  976. if (this.flaged = -1 != window.location.search.indexOf(t)) {
  977. var e = function(e) {
  978. for (var t = 0,
  979. n = 0; n < e.length; n++) t += e.charCodeAt(n);
  980. return t
  981. } (t) % 360,
  982. n = i("background: hsl({0}, 50%, 80%); color: hsl({0}, 100%, 30%); padding: 2px 3px; margin: 1px 3px 0 0;border-radius: 2px;", e);
  983. this.log = function() {
  984. var e = i.apply(null, arguments);
  985. console.log(i("%c{0}%c{1}", t, e), n, "background: none; color: black;")
  986. }
  987. } else this.log = r
  988. }
  989. }
  990. },
  991. d[20] = {
  992. value: function(e, t, n) {
  993. return n.exports = function(e, n) {
  994. return "object" != typeof n && (n = [].slice.call(arguments, 1)),
  995. String(e).replace(/\{(\w+)\}/gi,
  996. function(e, t) {
  997. return n[t] || t
  998. })
  999. }
  1000. }
  1001. },
  1002. d[21] = {
  1003. value: function(e, t, n) { ! ("innerText" in document.createElement("a")) && "getSelection" in window && (HTMLElement.prototype.__defineGetter__("innerText",
  1004. function() {
  1005. var e, t, n = window.getSelection(),
  1006. i = [];
  1007. for (t = 0; t < n.rangeCount; t++) i[t] = n.getRangeAt(t);
  1008. for (n.removeAllRanges(), n.selectAllChildren(this), e = n.toString(), n.removeAllRanges(), t = 0; t < i.length; t++) n.addRange(i[t]);
  1009. return e
  1010. }), HTMLElement.prototype.__defineSetter__("innerText",
  1011. function(e) {
  1012. this.innerHTML = (e || "").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>")
  1013. }))
  1014. }
  1015. },
  1016. d[22] = {
  1017. value: function(e, t, n) {
  1018. var m = Object.keys ? Object.keys: function(e) {
  1019. var t = [];
  1020. for (var n in e) e.hasOwnProperty(n) && t.push(n);
  1021. return t
  1022. };
  1023. function p(e) {
  1024. return - 1 === e.indexOf("/") && -1 === e.indexOf("~") ? e: e.replace(/~/g, "~0").replace(/\//g, "~1")
  1025. }
  1026. function g(e) {
  1027. return "object" == typeof e ? JSON.parse(JSON.stringify(e)) : e
  1028. }
  1029. return n.exports = function(e, t) {
  1030. var n = [];
  1031. return function e(t, n, i, r) {
  1032. for (var o = m(n), a = m(t), l = !1, s = a.length - 1; 0 <= s; s--) {
  1033. var c = t[u = a[s]];
  1034. if (n.hasOwnProperty(u)) {
  1035. var d = n[u];
  1036. "object" == typeof c && null != c && "object" == typeof d && null != d ? e(c, d, i, r + "/" + p(u)) : c != d && i.push({
  1037. op: "replace",
  1038. path: r + "/" + p(u),
  1039. value: g(d)
  1040. })
  1041. } else i.push({
  1042. op: "remove",
  1043. path: r + "/" + p(u)
  1044. }),
  1045. l = !0
  1046. }
  1047. if (l || o.length != a.length) for (s = 0; s < o.length; s++) {
  1048. var u = o[s];
  1049. t.hasOwnProperty(u) || i.push({
  1050. op: "add",
  1051. path: r + "/" + p(u),
  1052. value: g(n[u])
  1053. })
  1054. }
  1055. } (e, t, n, ""),
  1056. n
  1057. }
  1058. }
  1059. },
  1060. d[23] = {
  1061. value: function(e, t, n) {
  1062. var i = d.r(24),
  1063. r = 4096,
  1064. o = 8192,
  1065. a = 16384;
  1066. function l(e) {
  1067. return "string" == typeof e ? (t = 0, e.toLowerCase().split(/\s*\+\s*/).forEach(function(e) {
  1068. switch (e) {
  1069. case "ctrl":
  1070. case "cmd":
  1071. t |= r;
  1072. break;
  1073. case "alt":
  1074. t |= o;
  1075. break;
  1076. case "shift":
  1077. t |= a;
  1078. break;
  1079. default:
  1080. t |= i[e]
  1081. }
  1082. }), t) : function(e) {
  1083. var t = 0; (e.ctrlKey || e.metaKey) && (t |= r);
  1084. e.altKey && (t |= o);
  1085. e.shiftKey && (t |= a);
  1086. if ( - 1 === [16, 17, 18, 91].indexOf(e.keyCode)) {
  1087. if (229 === e.keyCode && e.keyIdentifier) return t |= parseInt(e.keyIdentifier.substr(2), 16);
  1088. t |= e.keyCode
  1089. }
  1090. return t
  1091. } (e);
  1092. var t
  1093. }
  1094. t.hash = l,
  1095. t.is = function(e, t) {
  1096. return e && t && l(e) == l(t)
  1097. }
  1098. }
  1099. },
  1100. d[24] = {
  1101. value: function(e, t, n) {
  1102. var i = {
  1103. Shift: 16,
  1104. Control: 17,
  1105. Alt: 18,
  1106. CapsLock: 20,
  1107. BackSpace: 8,
  1108. Tab: 9,
  1109. Enter: 13,
  1110. Esc: 27,
  1111. Space: 32,
  1112. PageUp: 33,
  1113. PageDown: 34,
  1114. End: 35,
  1115. Home: 36,
  1116. Insert: 45,
  1117. Left: 37,
  1118. Up: 38,
  1119. Right: 39,
  1120. Down: 40,
  1121. Direction: {
  1122. 37 : 1,
  1123. 38 : 1,
  1124. 39 : 1,
  1125. 40 : 1
  1126. },
  1127. Del: 46,
  1128. NumLock: 144,
  1129. Cmd: 91,
  1130. CmdFF: 224,
  1131. F1: 112,
  1132. F2: 113,
  1133. F3: 114,
  1134. F4: 115,
  1135. F5: 116,
  1136. F6: 117,
  1137. F7: 118,
  1138. F8: 119,
  1139. F9: 120,
  1140. F10: 121,
  1141. F11: 122,
  1142. F12: 123,
  1143. "`": 192,
  1144. "=": 187,
  1145. "-": 189,
  1146. "/": 191,
  1147. ".": 190
  1148. };
  1149. for (var r in i) i.hasOwnProperty(r) && (i[r.toLowerCase()] = i[r]);
  1150. var o = "a".charCodeAt(0);
  1151. "abcdefghijklmnopqrstuvwxyz".split("").forEach(function(e) {
  1152. i[e] = e.charCodeAt(0) - o + 65
  1153. });
  1154. for (var a = 9; i[a.toString()] = a + 48, --a;);
  1155. n.exports = i
  1156. }
  1157. };
  1158. var e, t = {
  1159. "expose-editor": 1
  1160. };
  1161. angular.module("kityminderEditor", ["ui.bootstrap", "ui.codemirror", "ui.colorpicker"]).config(["$sceDelegateProvider",
  1162. function(e) {
  1163. e.resourceUrlWhitelist(["self", "http://agroup.baidu.com:8910/**", "http://cq01-fe-rdtest01.vm.baidu.com:8910/**", "http://agroup.baidu.com:8911/**"])
  1164. }]),
  1165. angular.module("kityminderEditor").run(["$templateCache",
  1166. function(e) {
  1167. "use strict";
  1168. e.put()
  1169. 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>"),
  1170. 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>"),
  1171. 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>'),
  1172. 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>'),
  1173. 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>'),
  1174. 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>'),
  1175. //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>'),
  1176. 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>'),
  1177. 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>'),
  1178. 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>'),
  1179. 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>'),
  1180. 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>'),
  1181. 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>'),
  1182. e.put("ui/directive/notePreviewer/notePreviewer.html", '<div id="previewer-content" ng-show="showNotePreviewer" ng-style="previewerStyle" ng-bind-html="noteContent"></div>'),
  1183. 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>"),
  1184. 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>'),
  1185. 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>'),
  1186. //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>'),
  1187. 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>'),
  1188. 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>'),
  1189. 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>'),
  1190. 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>'),
  1191. 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>'),
  1192. 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>'),
  1193. 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>'),
  1194. 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>'),
  1195. 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>'),
  1196. 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>'),
  1197. 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>')
  1198. }]),
  1199. angular.module("kityminderEditor").service("commandBinder",
  1200. function() {
  1201. return {
  1202. bind: function(e, t, n) {
  1203. e.on("interactchange",
  1204. function() {
  1205. n.commandDisabled = -1 === e.queryCommandState(t),
  1206. n.commandValue = e.queryCommandValue(t),
  1207. n.$apply()
  1208. })
  1209. }
  1210. }
  1211. }),
  1212. angular.module("kityminderEditor").provider("config",
  1213. function() {
  1214. this.config = {
  1215. ctrlPanelMin: 250,
  1216. ctrlPanelWidth: parseInt(window.localStorage.__dev_minder_ctrlPanelWidth) || 250,
  1217. dividerWidth: 3,
  1218. defaultLang: "zh-cn",
  1219. zoom: [10, 20, 30, 50, 80, 100, 120, 150, 200],
  1220. imageUpload: "server/imageUpload.php"
  1221. },
  1222. this.set = function(e, t) {
  1223. var n = Object.keys(this.config),
  1224. i = {};
  1225. for (var r in "object" == typeof e ? i = e: i[e] = t, i) {
  1226. if (!i.hasOwnProperty(r) || -1 === n.indexOf(r)) return console.error("Unsupported config key: ", e, ", please choose in :", n.join(", ")),
  1227. !1;
  1228. this.config[r] = i[r]
  1229. }
  1230. return ! 0
  1231. },
  1232. this.$get = function() {
  1233. var t = this;
  1234. return {
  1235. get: function(e) {
  1236. return 0 === arguments.length ? t.config: t.config.hasOwnProperty(e) ? t.config[e] : (console.warn("Missing config key pair for : ", e), "")
  1237. }
  1238. }
  1239. }
  1240. }),
  1241. angular.module("kityminderEditor").service("lang.zh-cn",
  1242. function() {
  1243. return {
  1244. "zh-cn": {
  1245. template: {
  1246. default:
  1247. "思维导图",
  1248. tianpan: "天盘图",
  1249. structure: "组织结构图",
  1250. filetree: "目录组织图",
  1251. right: "逻辑结构图",
  1252. "fish-bone": "鱼骨头图"
  1253. },
  1254. theme: {
  1255. classic: "脑图经典",
  1256. "classic-compact": "紧凑经典",
  1257. snow: "温柔冷光",
  1258. "snow-compact": "紧凑冷光",
  1259. fish: "鱼骨图",
  1260. wire: "线框",
  1261. "fresh-red": "清新红",
  1262. "fresh-soil": "泥土黄",
  1263. "fresh-green": "文艺绿",
  1264. "fresh-blue": "天空蓝",
  1265. "fresh-purple": "浪漫紫",
  1266. "fresh-pink": "脑残粉",
  1267. "fresh-red-compat": "紧凑红",
  1268. "fresh-soil-compat": "紧凑黄",
  1269. "fresh-green-compat": "紧凑绿",
  1270. "fresh-blue-compat": "紧凑蓝",
  1271. "fresh-purple-compat": "紧凑紫",
  1272. "fresh-pink-compat": "紧凑粉",
  1273. tianpan: "经典天盘",
  1274. "tianpan-compact": "紧凑天盘"
  1275. },
  1276. maintopic: "中心主题",
  1277. topic: "分支主题",
  1278. panels: {
  1279. history: "历史",
  1280. template: "模板",
  1281. theme: "皮肤",
  1282. layout: "布局",
  1283. style: "样式",
  1284. font: "文字",
  1285. color: "颜色",
  1286. background: "背景",
  1287. insert: "插入",
  1288. arrange: "调整",
  1289. nodeop: "当前",
  1290. priority: "优先级",
  1291. progress: "进度",
  1292. resource: "资源",
  1293. note: "备注",
  1294. attachment: "附件",
  1295. word: "文字"
  1296. },
  1297. error_message: {
  1298. title: "哎呀,脑图出错了",
  1299. err_load: "加载脑图失败",
  1300. err_save: "保存脑图失败",
  1301. err_network: "网络错误",
  1302. err_doc_resolve: "文档解析失败",
  1303. err_unknown: "发生了奇怪的错误",
  1304. err_localfile_read: "文件读取错误",
  1305. err_download: "文件下载失败",
  1306. err_remove_share: "取消分享失败",
  1307. err_create_share: "分享失败",
  1308. err_mkdir: "目录创建失败",
  1309. err_ls: "读取目录失败",
  1310. err_share_data: "加载分享内容出错",
  1311. err_share_sync_fail: "分享内容同步失败",
  1312. err_move_file: "文件移动失败",
  1313. err_rename: "重命名失败",
  1314. unknownreason: "可能是外星人篡改了代码...",
  1315. pcs_code: {
  1316. 3 : "不支持此接口",
  1317. 4 : "没有权限执行此操作",
  1318. 5 : "IP未授权",
  1319. 110 : "用户会话已过期,请重新登录",
  1320. 31001 : "数据库查询错误",
  1321. 31002 : "数据库连接错误",
  1322. 31003 : "数据库返回空结果",
  1323. 31021 : "网络错误",
  1324. 31022 : "暂时无法连接服务器",
  1325. 31023 : "输入参数错误",
  1326. 31024 : "app id为空",
  1327. 31025 : "后端存储错误",
  1328. 31041 : "用户的cookie不是合法的百度cookie",
  1329. 31042 : "用户未登陆",
  1330. 31043 : "用户未激活",
  1331. 31044 : "用户未授权",
  1332. 31045 : "用户不存在",
  1333. 31046 : "用户已经存在",
  1334. 31061 : "文件已经存在",
  1335. 31062 : "文件名非法",
  1336. 31063 : "文件父目录不存在",
  1337. 31064 : "无权访问此文件",
  1338. 31065 : "目录已满",
  1339. 31066 : "文件不存在",
  1340. 31067 : "文件处理出错",
  1341. 31068 : "文件创建失败",
  1342. 31069 : "文件拷贝失败",
  1343. 31070 : "文件删除失败",
  1344. 31071 : "不能读取文件元信息",
  1345. 31072 : "文件移动失败",
  1346. 31073 : "文件重命名失败",
  1347. 31079 : "未找到文件MD5,请使用上传API上传整个文件。",
  1348. 31081 : "superfile创建失败",
  1349. 31082 : "superfile 块列表为空",
  1350. 31083 : "superfile 更新失败",
  1351. 31101 : "tag系统内部错误",
  1352. 31102 : "tag参数错误",
  1353. 31103 : "tag系统错误",
  1354. 31110 : "未授权设置此目录配额",
  1355. 31111 : "配额管理只支持两级目录",
  1356. 31112 : "超出配额",
  1357. 31113 : "配额不能超出目录祖先的配额",
  1358. 31114 : "配额不能比子目录配额小",
  1359. 31141 : "请求缩略图服务失败",
  1360. 31201 : "签名错误",
  1361. 31202 : "文件不存在",
  1362. 31203 : "设置acl失败",
  1363. 31204 : "请求acl验证失败",
  1364. 31205 : "获取acl失败",
  1365. 31206 : "acl不存在",
  1366. 31207 : "bucket已存在",
  1367. 31208 : "用户请求错误",
  1368. 31209 : "服务器错误",
  1369. 31210 : "服务器不支持",
  1370. 31211 : "禁止访问",
  1371. 31212 : "服务不可用",
  1372. 31213 : "重试出错",
  1373. 31214 : "上传文件data失败",
  1374. 31215 : "上传文件meta失败",
  1375. 31216 : "下载文件data失败",
  1376. 31217 : "下载文件meta失败",
  1377. 31218 : "容量超出限额",
  1378. 31219 : "请求数超出限额",
  1379. 31220 : "流量超出限额",
  1380. 31298 : "服务器返回值KEY非法",
  1381. 31299 : "服务器返回值KEY不存在"
  1382. }
  1383. },
  1384. ui: {
  1385. shared_file_title: "[分享的] {0} (只读)",
  1386. load_share_for_edit: "正在加载分享的文件...",
  1387. share_sync_success: "分享内容已同步",
  1388. recycle_clear_confirm: "确认清空回收站么?清空后的文件无法恢复。",
  1389. fullscreen_exit_hint: "按 Esc 或 F11 退出全屏",
  1390. error_detail: "详细信息",
  1391. copy_and_feedback: "复制并反馈",
  1392. move_file_confirm: '确定把 "{0}" 移动到 "{1}" 吗?',
  1393. rename: "重命名",
  1394. rename_success: "{0} 重命名成功",
  1395. move_success: "{0} 移动成功到 {1}",
  1396. command: {
  1397. appendsiblingnode: "插入同级主题",
  1398. appendparentnode: "插入上级主题",
  1399. appendchildnode: "插入下级主题",
  1400. removenode: "删除",
  1401. editnode: "编辑",
  1402. arrangeup: "上移",
  1403. arrangedown: "下移",
  1404. resetlayout: "整理布局",
  1405. expandtoleaf: "展开全部节点",
  1406. expandtolevel1: "展开到一级节点",
  1407. expandtolevel2: "展开到二级节点",
  1408. expandtolevel3: "展开到三级节点",
  1409. expandtolevel4: "展开到四级节点",
  1410. expandtolevel5: "展开到五级节点",
  1411. expandtolevel6: "展开到六级节点",
  1412. fullscreen: "全屏",
  1413. outline: "大纲"
  1414. },
  1415. search: "搜索",
  1416. expandtoleaf: "展开",
  1417. back: "返回",
  1418. undo: "撤销 (Ctrl + Z)",
  1419. redo: "重做 (Ctrl + Y)",
  1420. tabs: {
  1421. idea: "思路",
  1422. appearence: "外观",
  1423. view: "视图"
  1424. },
  1425. quickvisit: {
  1426. new: "新建 (Ctrl + Alt + N)",
  1427. save: "保存 (Ctrl + S)",
  1428. share: "分享 (Ctrl + Alt + S)",
  1429. feedback: "反馈问题(F1)",
  1430. editshare: "编辑"
  1431. },
  1432. menu: {
  1433. mainmenutext: "百度脑图",
  1434. newtab: "新建",
  1435. opentab: "打开",
  1436. savetab: "保存",
  1437. sharetab: "分享",
  1438. preferencetab: "设置",
  1439. helptab: "帮助",
  1440. feedbacktab: "反馈",
  1441. recenttab: "最近使用",
  1442. netdisktab: "百度云存储",
  1443. localtab: "本地文件",
  1444. drafttab: "草稿箱",
  1445. downloadtab: "导出到本地",
  1446. createsharetab: "当前脑图",
  1447. managesharetab: "已分享",
  1448. newheader: "新建脑图",
  1449. openheader: "打开",
  1450. saveheader: "保存到",
  1451. draftheader: "草稿箱",
  1452. shareheader: "分享我的脑图",
  1453. downloadheader: "导出到指定格式",
  1454. preferenceheader: "偏好设置",
  1455. helpheader: "帮助",
  1456. feedbackheader: "反馈"
  1457. },
  1458. mydocument: "我的文档",
  1459. emptydir: "目录为空!",
  1460. pickfile: "选择文件...",
  1461. acceptfile: "支持的格式:{0}",
  1462. dropfile: "或将文件拖至此处",
  1463. unsupportedfile: "不支持的文件格式",
  1464. untitleddoc: "未命名文档",
  1465. overrideconfirm: "{0} 已存在,确认覆盖吗?",
  1466. checklogin: "检查登录状态中...",
  1467. loggingin: "正在登录...",
  1468. recent: "最近打开",
  1469. clearrecent: "清空",
  1470. clearrecentconfirm: "确认清空最近文档列表?",
  1471. cleardraft: "清空",
  1472. cleardraftconfirm: "确认清空草稿箱?",
  1473. none_share: "不分享",
  1474. public_share: "公开分享",
  1475. password_share: "私密分享",
  1476. email_share: "邮件邀请",
  1477. url_share: "脑图 URL 地址:",
  1478. sns_share: "社交网络分享:",
  1479. sns_share_text: "“{0}” - 我用百度脑图制作的思维导图,快看看吧!(地址:{1})",
  1480. none_share_description: "不分享当前脑图",
  1481. public_share_description: "创建任何人可见的分享",
  1482. share_button_text: "创建",
  1483. password_share_description: "创建需要密码才可见的分享",
  1484. email_share_description: "创建指定人可见的分享,您还可以允许他们编辑",
  1485. ondev: "敬请期待!",
  1486. create_share_failed: "分享失败:{0}",
  1487. remove_share_failed: "删除失败:{1}",
  1488. copy: "复制",
  1489. copied: "已复制",
  1490. shared_tip: "当前脑图被 {0} 分享,你可以修改之后保存到自己的网盘上或再次分享",
  1491. current_share: "当前脑图",
  1492. manage_share: "我的分享",
  1493. share_remove_action: "不分享该脑图",
  1494. share_view_action: "打开分享地址",
  1495. share_edit_action: "编辑分享的文件",
  1496. login: "登录",
  1497. logout: "注销",
  1498. switchuser: "切换账户",
  1499. userinfo: "个人信息",
  1500. gotonetdisk: "我的网盘",
  1501. requirelogin: '请 <a class="login-button">登录</a> 后使用',
  1502. saveas: "保存为",
  1503. filename: "文件名",
  1504. fileformat: "保存格式",
  1505. save: "保存",
  1506. mkdir: "新建目录",
  1507. recycle: "回收站",
  1508. newdir: "未命名目录",
  1509. bold: "加粗",
  1510. italic: "斜体",
  1511. forecolor: "字体颜色",
  1512. fontfamily: "字体",
  1513. fontsize: "字号",
  1514. layoutstyle: "主题",
  1515. node: "节点操作",
  1516. saveto: "另存为",
  1517. hand: "允许拖拽",
  1518. camera: "定位根节点",
  1519. "zoom-in": "放大(Ctrl+)",
  1520. "zoom-out": "缩小(Ctrl-)",
  1521. markers: "标签",
  1522. resource: "资源",
  1523. help: "帮助",
  1524. preference: "偏好设置",
  1525. expandnode: "展开到叶子",
  1526. collapsenode: "收起到一级节点",
  1527. template: "模板",
  1528. theme: "皮肤",
  1529. clearstyle: "清除样式",
  1530. copystyle: "复制样式",
  1531. pastestyle: "粘贴样式",
  1532. appendsiblingnode: "同级主题",
  1533. appendchildnode: "下级主题",
  1534. arrangeup: "前调",
  1535. arrangedown: "后调",
  1536. editnode: "编辑",
  1537. removenode: "移除",
  1538. priority: "优先级",
  1539. progress: {
  1540. p1: "未开始",
  1541. p2: "完成 1/8",
  1542. p3: "完成 1/4",
  1543. p4: "完成 3/8",
  1544. p5: "完成一半",
  1545. p6: "完成 5/8",
  1546. p7: "完成 3/4",
  1547. p8: "完成 7/8",
  1548. p9: "已完成",
  1549. p0: "清除进度"
  1550. },
  1551. link: "链接",
  1552. image: "图片",
  1553. note: "备注",
  1554. insertlink: "插入链接",
  1555. insertimage: "插入图片",
  1556. insertnote: "插入备注",
  1557. removelink: "移除已有链接",
  1558. removeimage: "移除已有图片",
  1559. removenote: "移除已有备注",
  1560. resetlayout: "整理",
  1561. justnow: "刚刚",
  1562. minutesago: "{0} 分钟前",
  1563. hoursago: "{0} 小时前",
  1564. yesterday: "昨天",
  1565. daysago: "{0} 天前",
  1566. longago: "很久之前",
  1567. redirect: "您正在打开连接 {0},百度脑图不能保证连接的安全性,是否要继续?",
  1568. navigator: "导航器",
  1569. unsavedcontent: "当前文件还没有保存到网盘:\n\n{0}\n\n虽然未保存的数据会缓存在草稿箱,但是清除浏览器缓存会导致草稿箱清除。",
  1570. shortcuts: "快捷键",
  1571. contact: "联系与反馈",
  1572. email: "邮件组",
  1573. qq_group: "QQ 群",
  1574. github_issue: "Github",
  1575. baidu_tieba: "贴吧",
  1576. clipboardunsupported: "您的浏览器不支持剪贴板,请使用快捷键复制",
  1577. load_success: "{0} 加载成功",
  1578. save_success: "{0} 已保存于 {1}",
  1579. autosave_success: "{0} 已自动保存于 {1}",
  1580. selectall: "全选",
  1581. selectrevert: "反选",
  1582. selectsiblings: "选择兄弟节点",
  1583. selectlevel: "选择同级节点",
  1584. selectpath: "选择路径",
  1585. selecttree: "选择子树"
  1586. },
  1587. popupcolor: {
  1588. clearColor: "清空颜色",
  1589. standardColor: "标准颜色",
  1590. themeColor: "主题颜色"
  1591. },
  1592. dialogs: {
  1593. markers: {
  1594. static: {
  1595. lang_input_text: "文本内容:",
  1596. lang_input_url: "链接地址:",
  1597. lang_input_title: "标题:",
  1598. lang_input_target: "是否在新窗口:"
  1599. },
  1600. priority: "优先级",
  1601. none: "无",
  1602. progress: {
  1603. title: "进度",
  1604. notdone: "未完成",
  1605. done1: "完成 1/8",
  1606. done2: "完成 1/4",
  1607. done3: "完成 3/8",
  1608. done4: "完成 1/2",
  1609. done5: "完成 5/8",
  1610. done6: "完成 3/4",
  1611. done7: "完成 7/8",
  1612. done: "已完成"
  1613. }
  1614. },
  1615. help: {},
  1616. hyperlink: {},
  1617. image: {},
  1618. resource: {}
  1619. },
  1620. hyperlink: {
  1621. hyperlink: "链接...",
  1622. unhyperlink: "移除链接"
  1623. },
  1624. image: {
  1625. image: "图片...",
  1626. removeimage: "移除图片"
  1627. },
  1628. marker: {
  1629. marker: "进度/优先级..."
  1630. },
  1631. resource: {
  1632. resource: "资源..."
  1633. }
  1634. }
  1635. }
  1636. }),
  1637. angular.module("kityminderEditor").service("memory",
  1638. function() {
  1639. return {
  1640. get: function(e) {
  1641. var t = window.localStorage.getItem(e);
  1642. return JSON.parse(t)
  1643. },
  1644. set: function(e, t) {
  1645. try {
  1646. return window.localStorage.setItem(e, JSON.stringify(t)),
  1647. !0
  1648. } catch(e) {
  1649. if (function(e) {
  1650. var t = !1;
  1651. if (e) if (e.code) switch (e.code) {
  1652. case 22:
  1653. t = !0;
  1654. break;
  1655. case 1014:
  1656. "NS_ERROR_DOM_QUOTA_REACHED" === e.name && (t = !0)
  1657. } else - 2147024882 === e.number && (t = !0);
  1658. return t
  1659. } (e)) return ! 1
  1660. }
  1661. },
  1662. remove: function(e) {
  1663. var t = window.localStorage.getItem(e);
  1664. return window.localStorage.removeItem(e),
  1665. t
  1666. },
  1667. clear: function() {
  1668. window.localStorage.clear()
  1669. }
  1670. }
  1671. }),
  1672. angular.module("kityminderEditor").service("minder.service",
  1673. function() {
  1674. var t = [];
  1675. return {
  1676. registerEvent: function(e) {
  1677. t.push(e)
  1678. },
  1679. executeCallback: function() {
  1680. t.forEach(function(e) {
  1681. e.apply(this, arguments)
  1682. })
  1683. }
  1684. }
  1685. }),
  1686. angular.module("kityminderEditor").service("resourceService", ["$document",
  1687. function(t) {
  1688. var n = null;
  1689. this.open = function(e) {
  1690. n || (t.bind("click", i), t.bind("keydown", r)),
  1691. n && n !== e && (n.resourceListOpen = !1),
  1692. n = e
  1693. },
  1694. this.close = function(e) {
  1695. n === e && (n = null, t.unbind("click", i), t.unbind("keydown", r))
  1696. };
  1697. var i = function(e) {
  1698. if (n) {
  1699. var t = n.getToggleElement();
  1700. e && t && t[0].contains(e.target) || n.$apply(function() {
  1701. console.log("to close the resourcelist"),
  1702. n.resourceListOpen = !1
  1703. })
  1704. }
  1705. },
  1706. r = function(e) {
  1707. 27 === e.which && (n.focusToggleElement(), i())
  1708. }
  1709. }]),
  1710. angular.module("kityminderEditor").service("revokeDialog", ["$modal", "minder.service",
  1711. function(e, t) {
  1712. return t.registerEvent(function() {
  1713. var t = window.minder,
  1714. n = window.editor,
  1715. i = n.hotbox.getParentFSM();
  1716. t.on("importNodeData",
  1717. function() {
  1718. i.jump("modal", "import-text-modal"),
  1719. e.open({
  1720. animation: !0,
  1721. templateUrl: "ui/dialog/imExportNode/imExportNode.tpl.html",
  1722. controller: "imExportNode.ctrl",
  1723. size: "md",
  1724. resolve: {
  1725. title: function() {
  1726. return "导入节点"
  1727. },
  1728. defaultValue: function() {
  1729. return ""
  1730. },
  1731. type: function() {
  1732. return "import"
  1733. }
  1734. }
  1735. }).result.then(function(e) {
  1736. try {
  1737. t.Text2Children(t.getSelectedNode(), e)
  1738. } catch(e) {
  1739. alert(e)
  1740. }
  1741. i.jump("normal", "import-text-finish"),
  1742. n.receiver.selectAll()
  1743. },
  1744. function() {
  1745. i.jump("normal", "import-text-finish"),
  1746. n.receiver.selectAll()
  1747. })
  1748. }),
  1749. t.on("exportNodeData",
  1750. function() {
  1751. i.jump("modal", "export-text-modal"),
  1752. e.open({
  1753. animation: !0,
  1754. templateUrl: "ui/dialog/imExportNode/imExportNode.tpl.html",
  1755. controller: "imExportNode.ctrl",
  1756. size: "md",
  1757. resolve: {
  1758. title: function() {
  1759. return "导出节点"
  1760. },
  1761. defaultValue: function() {
  1762. var e = t.getSelectedNode();
  1763. return (0, window.kityminder.data.getRegisterProtocol("text").Node2Text)(e)
  1764. },
  1765. type: function() {
  1766. return "export"
  1767. }
  1768. }
  1769. }).result.then(function(e) {
  1770. i.jump("normal", "export-text-finish"),
  1771. n.receiver.selectAll()
  1772. },
  1773. function() {
  1774. i.jump("normal", "export-text-finish"),
  1775. n.receiver.selectAll()
  1776. })
  1777. })
  1778. }),
  1779. {}
  1780. }]),
  1781. angular.module("kityminderEditor").service("server", ["config", "$http",
  1782. function(i, r) {
  1783. return {
  1784. uploadImage: function(e) {
  1785. var t = i.get("imageUpload"),
  1786. n = new FormData;
  1787. return n.append("upload_file", e),
  1788. r.post(t, n, {
  1789. transformRequest: angular.identity,
  1790. headers: {
  1791. "Content-Type": void 0
  1792. }
  1793. })
  1794. }
  1795. }
  1796. }]),
  1797. angular.module("kityminderEditor").service("valueTransfer",
  1798. function() {
  1799. return {}
  1800. }),
  1801. angular.module("kityminderEditor").filter("commandState",
  1802. function() {
  1803. return function(e, t) {
  1804. return e.queryCommandState(t)
  1805. }
  1806. }).filter("commandValue",
  1807. function() {
  1808. return function(e, t) {
  1809. return e.queryCommandValue(t)
  1810. }
  1811. }),
  1812. angular.module("kityminderEditor").filter("lang", ["config", "lang.zh-cn",
  1813. function(r, o) {
  1814. return function(e, t) {
  1815. var n = r.get("defaultLang");
  1816. if (null == o[n]) return "未发现对应语言包,请检查 lang.xxx.service.js!";
  1817. var i = o[n];
  1818. return t.split("/").forEach(function(e, t) {
  1819. i = i[e]
  1820. }),
  1821. i[e] || null
  1822. }
  1823. }]),
  1824. angular.module("kityminderEditor").controller("hyperlink.ctrl", ["$scope", "$modalInstance", "link",
  1825. function(t, n, e) {
  1826. 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"),
  1827. t.url = e.url || "",
  1828. t.title = e.title || "",
  1829. setTimeout(function() {
  1830. var e = $("#link-url");
  1831. e.focus(),
  1832. e[0].setSelectionRange(0, t.url.length)
  1833. },
  1834. 30),
  1835. t.shortCut = function(e) {
  1836. e.stopPropagation(),
  1837. 13 == e.keyCode ? t.ok() : 27 == e.keyCode && t.cancel()
  1838. },
  1839. t.ok = function() {
  1840. if (t.R_URL.test(t.url)) n.close({
  1841. url: t.url,
  1842. title: t.title
  1843. });
  1844. else {
  1845. t.urlPassed = !1;
  1846. var e = $("#link-url");
  1847. e.focus(),
  1848. e[0].setSelectionRange(0, t.url.length)
  1849. }
  1850. editor.receiver.selectAll()
  1851. },
  1852. t.cancel = function() {
  1853. n.dismiss("cancel"),
  1854. editor.receiver.selectAll()
  1855. }
  1856. }]),
  1857. angular.module("kityminderEditor").controller("imExportNode.ctrl", ["$scope", "$modalInstance", "title", "defaultValue", "type",
  1858. function(r, e, t, n, o) {
  1859. r.title = t,
  1860. r.value = n,
  1861. r.type = o,
  1862. r.ok = function() {
  1863. "" != r.value && (e.close(r.value), editor.receiver.selectAll())
  1864. },
  1865. r.cancel = function() {
  1866. e.dismiss("cancel"),
  1867. editor.receiver.selectAll()
  1868. },
  1869. setTimeout(function() {
  1870. $(".single-input").focus(),
  1871. $(".single-input")[0].setSelectionRange(0, n.length)
  1872. },
  1873. 30),
  1874. r.shortCut = function(e) {
  1875. if (e.stopPropagation(), 27 == e.keyCode && r.cancel(), 8 == e.keyCode && "export" == o && e.preventDefault(), 9 == e.keyCode) {
  1876. e.preventDefault();
  1877. var t = e.target,
  1878. n = function(e) {
  1879. var t = 0;
  1880. if (document.selection) {
  1881. e.focus();
  1882. var n = document.selection.createRange();
  1883. n.moveStart("character", -e.value.length),
  1884. t = n.text.length
  1885. } else(e.selectionStart || "0" == e.selectionStart) && (t = e.selectionStart);
  1886. return t
  1887. } (t),
  1888. i = t.value;
  1889. t.value = i.substr(0, n) + "\t" + i.substr(n),
  1890. function(e, t) {
  1891. if (e.setSelectionRange) e.focus(),
  1892. e.setSelectionRange(t, t);
  1893. else if (e.createTextRange) {
  1894. var n = e.createTextRange();
  1895. n.collapse(!0),
  1896. n.moveEnd("character", t),
  1897. n.moveStart("character", t),
  1898. n.select()
  1899. }
  1900. } (t, n + 1)
  1901. }
  1902. }
  1903. }]),
  1904. angular.module("kityminderEditor").controller("image.ctrl", ["$http", "$scope", "$modalInstance", "image", "server",
  1905. function(i, r, t, e, n) {
  1906. r.data = {
  1907. list: [],
  1908. url: e.url || "",
  1909. title: e.title || "",
  1910. R_URL: /^https?\:\/\/\w+/
  1911. },
  1912. setTimeout(function() {
  1913. var e = $("#image-url");
  1914. e.focus(),
  1915. e[0].setSelectionRange(0, r.data.url.length)
  1916. },
  1917. 300),
  1918. r.searchImage = function() {
  1919. var e, t, n;
  1920. r.list = [],
  1921. (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) {
  1922. if (e && e.data) for (var t = 0; t < e.data.length; t++) e.data[t].objURL && r.list.push({
  1923. title: e.data[t].fromPageTitleEnc,
  1924. src: e.data[t].middleURL,
  1925. url: e.data[t].middleURL
  1926. })
  1927. }).error(function() {})
  1928. },
  1929. r.selectImage = function(e) {
  1930. var t = $("#img-item" + this.$index),
  1931. n = $("#img-" + this.$index);
  1932. t.siblings(".selected").removeClass("selected"),
  1933. t.addClass("selected"),
  1934. r.data.url = n.attr("src"),
  1935. r.data.title = n.attr("alt")
  1936. },
  1937. r.uploadImage = function() {
  1938. var e = $("#upload-image");
  1939. if (e.val()) {
  1940. if (/^.*\.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG)$/.test(e.val())) {
  1941. var t = e[0].files[0];
  1942. return n.uploadImage(t).then(function(e) {
  1943. var t = e.data;
  1944. 0 === t.errno && (r.data.url = t.data.url)
  1945. })
  1946. }
  1947. alert("后缀只能是 jpg、gif 及 png")
  1948. }
  1949. },
  1950. r.shortCut = function(e) {
  1951. e.stopPropagation(),
  1952. 13 == e.keyCode ? r.ok() : 27 == e.keyCode && r.cancel()
  1953. },
  1954. r.ok = function() {
  1955. if (r.data.R_URL.test(r.data.url)) t.close({
  1956. url: r.data.url,
  1957. title: r.data.title
  1958. });
  1959. else {
  1960. r.urlPassed = !1;
  1961. var e = $("#image-url");
  1962. e && (e.focus(), e[0].setSelectionRange(0, r.data.url.length))
  1963. }
  1964. editor.receiver.selectAll()
  1965. },
  1966. r.cancel = function() {
  1967. t.dismiss("cancel"),
  1968. editor.receiver.selectAll()
  1969. }
  1970. }]),
  1971. angular.module("kityminderEditor").directive("appendNode", ["commandBinder",
  1972. function(t) {
  1973. return {
  1974. restrict: "E",
  1975. templateUrl: "ui/directive/appendNode/appendNode.html",
  1976. scope: {
  1977. minder: "="
  1978. },
  1979. replace: !0,
  1980. link: function(e) {
  1981. var r = e.minder;
  1982. t.bind(r, "appendchildnode", e),
  1983. e.execCommand = function(e) {
  1984. var t, n, i;
  1985. r.execCommand(e, "分支主题"),
  1986. t = editor.receiver.element,
  1987. n = editor.fsm,
  1988. i = editor.receiver,
  1989. t.innerText = r.queryCommandValue("text"),
  1990. n.jump("input", "input-request"),
  1991. i.selectAll()
  1992. }
  1993. }
  1994. }
  1995. }]),
  1996. angular.module("kityminderEditor").directive("arrange", ["commandBinder",
  1997. function(e) {
  1998. return {
  1999. restrict: "E",
  2000. templateUrl: "ui/directive/arrange/arrange.html",
  2001. scope: {
  2002. minder: "="
  2003. },
  2004. replace: !0,
  2005. link: function(e) {
  2006. e.minder
  2007. }
  2008. }
  2009. }]),
  2010. angular.module("kityminderEditor").directive("colorPanel",
  2011. function() {
  2012. return {
  2013. restrict: "E",
  2014. templateUrl: "ui/directive/colorPanel/colorPanel.html",
  2015. scope: {
  2016. minder: "="
  2017. },
  2018. replace: !0,
  2019. link: function(n) {
  2020. var i = n.minder;
  2021. i.getThemeItems();
  2022. n.$on("colorPicked",
  2023. function(e, t) {
  2024. e.stopPropagation(),
  2025. n.bgColor = t,
  2026. i.execCommand("background", t)
  2027. }),
  2028. n.setDefaultBg = function() {
  2029. var e = i.getSelectedNode(),
  2030. t = i.getNodeStyle(e, "background");
  2031. return "object" == typeof t ? t.toHEX() : t
  2032. },
  2033. n.bgColor = n.setDefaultBg() || "#fff"
  2034. }
  2035. }
  2036. }),
  2037. angular.module("kityminderEditor").directive("expandLevel",
  2038. function() {
  2039. return {
  2040. restrict: "E",
  2041. templateUrl: "ui/directive/expandLevel/expandLevel.html",
  2042. scope: {
  2043. minder: "="
  2044. },
  2045. replace: !0,
  2046. link: function(e) {
  2047. e.levels = [1, 2, 3, 4, 5, 6]
  2048. }
  2049. }
  2050. }),
  2051. angular.module("kityminderEditor").directive("fontOperator",
  2052. function() {
  2053. return {
  2054. restrict: "E",
  2055. templateUrl: "ui/directive/fontOperator/fontOperator.html",
  2056. scope: {
  2057. minder: "="
  2058. },
  2059. replace: !0,
  2060. link: function(n) {
  2061. var i = n.minder;
  2062. i.getThemeItems();
  2063. n.fontSizeList = [10, 12, 16, 18, 24, 32, 48],
  2064. n.fontFamilyList = [{
  2065. name: "宋体",
  2066. val: "宋体,SimSun"
  2067. },
  2068. {
  2069. name: "微软雅黑",
  2070. val: "微软雅黑,Microsoft YaHei"
  2071. },
  2072. {
  2073. name: "楷体",
  2074. val: "楷体,楷体_GB2312,SimKai"
  2075. },
  2076. {
  2077. name: "黑体",
  2078. val: "黑体, SimHei"
  2079. },
  2080. {
  2081. name: "隶书",
  2082. val: "隶书, SimLi"
  2083. },
  2084. {
  2085. name: "Andale Mono",
  2086. val: "andale mono"
  2087. },
  2088. {
  2089. name: "Arial",
  2090. val: "arial,helvetica,sans-serif"
  2091. },
  2092. {
  2093. name: "arialBlack",
  2094. val: "arial black,avant garde"
  2095. },
  2096. {
  2097. name: "Comic Sans Ms",
  2098. val: "comic sans ms"
  2099. },
  2100. {
  2101. name: "Impact",
  2102. val: "impact,chicago"
  2103. },
  2104. {
  2105. name: "Times New Roman",
  2106. val: "times new roman"
  2107. },
  2108. {
  2109. name: "Sans-Serif",
  2110. val: "sans-serif"
  2111. }],
  2112. n.$on("colorPicked",
  2113. function(e, t) {
  2114. e.stopPropagation(),
  2115. n.foreColor = t,
  2116. i.execCommand("forecolor", t)
  2117. }),
  2118. n.setDefaultColor = function() {
  2119. var e = i.getSelectedNode(),
  2120. t = i.getNodeStyle(e, "color");
  2121. return "object" == typeof t ? t.toHEX() : t
  2122. },
  2123. n.foreColor = n.setDefaultColor() || "#000",
  2124. n.getFontfamilyName = function(i) {
  2125. var r = "";
  2126. return n.fontFamilyList.forEach(function(e, t, n) {
  2127. if (e.val === i) return r = e.name,
  2128. ""
  2129. }),
  2130. r
  2131. }
  2132. }
  2133. }
  2134. }),
  2135. angular.module("kityminderEditor").directive("hyperLink", ["$modal",
  2136. function(n) {
  2137. return {
  2138. restrict: "E",
  2139. templateUrl: "ui/directive/hyperLink/hyperLink.html",
  2140. scope: {
  2141. minder: "="
  2142. },
  2143. replace: !0,
  2144. link: function(e) {
  2145. var t = e.minder;
  2146. e.addHyperlink = function() {
  2147. var e = t.queryCommandValue("HyperLink");
  2148. n.open({
  2149. animation: !0,
  2150. templateUrl: "ui/dialog/hyperlink/hyperlink.tpl.html",
  2151. controller: "hyperlink.ctrl",
  2152. size: "md",
  2153. resolve: {
  2154. link: function() {
  2155. return e
  2156. }
  2157. }
  2158. }).result.then(function(e) {
  2159. t.execCommand("HyperLink", e.url, e.title || "")
  2160. })
  2161. }
  2162. }
  2163. }
  2164. }]),
  2165. angular.module("kityminderEditor").directive("imageBtn", ["$modal",
  2166. function(n) {
  2167. return {
  2168. restrict: "E",
  2169. templateUrl: "ui/directive/imageBtn/imageBtn.html",
  2170. scope: {
  2171. minder: "="
  2172. },
  2173. replace: !0,
  2174. link: function(e) {
  2175. var t = e.minder;
  2176. e.addImage = function() {
  2177. var e = t.queryCommandValue("image");
  2178. n.open({
  2179. animation: !0,
  2180. templateUrl: "ui/dialog/image/image.tpl.html",
  2181. controller: "image.ctrl",
  2182. size: "md",
  2183. resolve: {
  2184. image: function() {
  2185. return e
  2186. }
  2187. }
  2188. }).result.then(function(e) {
  2189. t.execCommand("image", e.url, e.title || "")
  2190. })
  2191. }
  2192. }
  2193. }
  2194. }]),
  2195. angular.module("kityminderEditor").directive("kityminderEditor", ["config", "minder.service", "revokeDialog",
  2196. function(a, l, e) {
  2197. return {
  2198. restrict: "EA",
  2199. templateUrl: "ui/directive/kityminderEditor/kityminderEditor.html",
  2200. replace: !0,
  2201. scope: {
  2202. onInit: "&"
  2203. },
  2204. link: function(i, e, t) {
  2205. var r = e.children(".minder-editor")[0];
  2206. function o(e, t) {
  2207. i.onInit({
  2208. editor: e,
  2209. minder: t
  2210. }),
  2211. l.executeCallback()
  2212. }
  2213. if ("undefined" != typeof seajs) seajs.config({
  2214. base: "./src"
  2215. }),
  2216. define("demo",
  2217. function(e) {
  2218. var t = e("editor"),
  2219. n = window.editor = new t(r);
  2220. window.localStorage.__dev_minder_content && n.minder.importJson(JSON.parse(window.localStorage.__dev_minder_content)),
  2221. n.minder.on("contentchange",
  2222. function() {
  2223. window.localStorage.__dev_minder_content = JSON.stringify(n.minder.exportJson())
  2224. }),
  2225. window.minder = window.km = n.minder,
  2226. i.editor = n,
  2227. i.minder = minder,
  2228. i.config = a.get(),
  2229. i.$apply(),
  2230. o(n, minder)
  2231. }),
  2232. seajs.use("demo");
  2233. else if (window.kityminder && window.kityminder.Editor) {
  2234. var n = new kityminder.Editor(r);
  2235. window.editor = i.editor = n,
  2236. window.minder = i.minder = n.minder,
  2237. i.config = a.get(),
  2238. o(n, n.minder)
  2239. }
  2240. }
  2241. }
  2242. }]),
  2243. angular.module("kityminderEditor").directive("kityminderViewer", ["config", "minder.service",
  2244. function(e, l) {
  2245. return {
  2246. restrict: "EA",
  2247. templateUrl: "ui/directive/kityminderViewer/kityminderViewer.html",
  2248. replace: !0,
  2249. scope: {
  2250. onInit: "&"
  2251. },
  2252. link: function(e, t, n) {
  2253. var i, r, o = t.children(".minder-viewer")[0];
  2254. if (window.kityminder && window.kityminder.Editor) {
  2255. var a = new kityminder.Editor(o);
  2256. window.editor = e.editor = a,
  2257. window.minder = e.minder = a.minder,
  2258. r = (i = a).minder,
  2259. e.onInit({
  2260. editor: i,
  2261. minder: r
  2262. }),
  2263. l.executeCallback()
  2264. }
  2265. }
  2266. }
  2267. }]),
  2268. angular.module("kityminderEditor").directive("layout",
  2269. function() {
  2270. return {
  2271. restrict: "E",
  2272. templateUrl: "ui/directive/layout/layout.html",
  2273. scope: {
  2274. minder: "="
  2275. },
  2276. replace: !0,
  2277. link: function(e) {}
  2278. }
  2279. }),
  2280. angular.module("kityminderEditor").directive("navigator", ["memory", "config",
  2281. function(g, f) {
  2282. return {
  2283. restrict: "A",
  2284. templateUrl: "ui/directive/navigator/navigator.html",
  2285. scope: {
  2286. minder: "="
  2287. },
  2288. link: function(n) {
  2289. function e() {
  2290. minder.on("layout layoutallfinish", m),
  2291. minder.on("viewchange", p)
  2292. }
  2293. function t() {
  2294. minder.off("layout layoutallfinish", m),
  2295. minder.off("viewchange", p)
  2296. }
  2297. minder.setDefaultOptions({
  2298. zoom: f.get("zoom")
  2299. }),
  2300. n.isNavOpen = !g.get("navigator-hidden"),
  2301. n.getZoomRadio = function(e) {
  2302. var t = minder.getOption("zoom"),
  2303. n = t[0];
  2304. return 1 - (e - n) / (t[t.length - 1] - n)
  2305. },
  2306. n.getHeight = function(e) {
  2307. var t = $(".zoom-pan").height();
  2308. return n.getZoomRadio(e) * t
  2309. },
  2310. n.zoom = 100,
  2311. minder.on("zoom",
  2312. function(e) {
  2313. n.zoom = e.zoom
  2314. }),
  2315. n.toggleNavOpen = function() {
  2316. n.isNavOpen = !n.isNavOpen,
  2317. g.set("navigator-hidden", !n.isNavOpen),
  2318. n.isNavOpen ? (e(), m(), p()) : t()
  2319. },
  2320. setTimeout(function() {
  2321. n.isNavOpen ? (e(), m(), p()) : t()
  2322. },
  2323. 0);
  2324. var i = $(".nav-previewer"),
  2325. r = new kity.Paper(i[0]),
  2326. o = r.put(new kity.Path),
  2327. a = r.put(new kity.Path),
  2328. l = r.put(new kity.Rect(100, 100).stroke("red", "1%")),
  2329. s = new kity.Box,
  2330. c = new kity.Box,
  2331. d = u(minder.getTheme());
  2332. function u(e) {
  2333. switch (e) {
  2334. case "tianpan":
  2335. case "tianpan-compact":
  2336. return function(e, t, n, i, r) {
  2337. var o = i >> 1;
  2338. e.push("M", t, n + o, "a", o, o, 0, 1, 1, 0, .01, "z")
  2339. };
  2340. default:
  2341. return function(e, t, n, i, r) {
  2342. e.push("M", t, n, "h", i, "v", r, "h", -i, "z")
  2343. }
  2344. }
  2345. }
  2346. function m() {
  2347. var e = minder.getRenderContainer().getBoundaryBox();
  2348. s = e;
  2349. r.setViewBox(e.x - 30 - .5, e.y - 30 - .5, e.width + 60 + 1, e.height + 60 + 1);
  2350. var n = [],
  2351. i = [];
  2352. minder.getRoot().traverse(function(e) {
  2353. var t = e.getLayoutBox();
  2354. d(n, t.x, t.y, t.width, t.height),
  2355. e.getConnection() && e.parent && e.parent.isExpanded() && i.push(e.getConnection().getPathData())
  2356. }),
  2357. r.setStyle("background", minder.getStyle("background")),
  2358. n.length ? o.fill(minder.getStyle("root-background")).setPathData(n) : o.setPathData(null),
  2359. i.length ? a.stroke(minder.getStyle("connect-color"), "0.5%").setPathData(i) : a.setPathData(null),
  2360. p()
  2361. }
  2362. function p() {
  2363. c = minder.getViewDragger().getView(),
  2364. l.setBox(c.intersect(s))
  2365. }
  2366. minder.on("themechange",
  2367. function(e) {
  2368. d = u(e.theme)
  2369. }),
  2370. function() {
  2371. function t(e, t) {
  2372. var n = c;
  2373. e.x = -e.x,
  2374. e.y = -e.y;
  2375. var i = minder.getPaper().getViewPortMatrix();
  2376. n = i.transformBox(n);
  2377. var r = e.offset(n.width / 2, n.height / 2);
  2378. minder.getViewDragger().moveTo(r, t)
  2379. }
  2380. var n = !1;
  2381. r.on("mousedown",
  2382. function(e) {
  2383. n = !0,
  2384. t(e.getPosition("top"), 200),
  2385. i.addClass("grab")
  2386. }),
  2387. r.on("mousemove",
  2388. function(e) {
  2389. n && t(e.getPosition("top"))
  2390. }),
  2391. $(window).on("mouseup",
  2392. function() {
  2393. n = !1,
  2394. i.removeClass("grab")
  2395. })
  2396. } ()
  2397. }
  2398. }
  2399. }]),
  2400. angular.module("kityminderEditor").directive("noteBtn", ["valueTransfer",
  2401. function(t) {
  2402. return {
  2403. restrict: "E",
  2404. templateUrl: "ui/directive/noteBtn/noteBtn.html",
  2405. scope: {
  2406. minder: "="
  2407. },
  2408. replace: !0,
  2409. link: function(e) {
  2410. e.minder;
  2411. e.addNote = function() {
  2412. t.noteEditorOpen = !0
  2413. }
  2414. }
  2415. }
  2416. }]),
  2417. angular.module("kityminderEditor").directive("noteEditor", ["valueTransfer",
  2418. function(a) {
  2419. return {
  2420. restrict: "A",
  2421. templateUrl: "ui/directive/noteEditor/noteEditor.html",
  2422. scope: {
  2423. minder: "="
  2424. },
  2425. replace: !0,
  2426. controller: ["$scope",
  2427. function(n) {
  2428. var i, r = n.minder,
  2429. o = !1;
  2430. n.codemirrorLoaded = function(e) {
  2431. i = n.cmEditor = e,
  2432. e.setSize("100%", "100%")
  2433. },
  2434. n.$watch("noteContent",
  2435. function(e) {
  2436. var t = -1 != r.queryCommandState("note");
  2437. e && t && !o && r.execCommand("note", e),
  2438. setTimeout(function() {
  2439. i.refresh()
  2440. })
  2441. });
  2442. n.$watch(function() {
  2443. return a.noteEditorOpen
  2444. },
  2445. function(e, t) {
  2446. e && setTimeout(function() {
  2447. i.refresh(),
  2448. i.focus()
  2449. }),
  2450. n.noteEditorOpen = a.noteEditorOpen
  2451. },
  2452. !0),
  2453. n.closeNoteEditor = function() {
  2454. a.noteEditorOpen = !1,
  2455. editor.receiver.selectAll()
  2456. },
  2457. r.on("interactchange",
  2458. function() {
  2459. var e = n.noteEnabled = -1 != r.queryCommandState("note"),
  2460. t = r.queryCommandValue("note") || "";
  2461. e && (n.noteContent = t),
  2462. o = !0,
  2463. n.$apply(),
  2464. o = !1
  2465. })
  2466. }]
  2467. }
  2468. }]),
  2469. angular.module("kityminderEditor").directive("notePreviewer", ["$sce", "valueTransfer",
  2470. function(v, e) {
  2471. return {
  2472. restrict: "A",
  2473. templateUrl: "ui/directive/notePreviewer/notePreviewer.html",
  2474. link: function(m, e) {
  2475. var t, n = m.minder,
  2476. p = e.parent(),
  2477. g = e.children();
  2478. m.showNotePreviewer = !1,
  2479. marked.setOptions({
  2480. gfm: !0,
  2481. tables: !0,
  2482. breaks: !0,
  2483. pedantic: !1,
  2484. sanitize: !0,
  2485. smartLists: !0,
  2486. smartypants: !1
  2487. }),
  2488. n.on("shownoterequest",
  2489. function(e) {
  2490. t = setTimeout(function() { !
  2491. function(e, t) {
  2492. var n = e.getRenderer("NoteIconRenderer").getRenderShape().getRenderBox("screen"),
  2493. i = e.getData("note");
  2494. g[0].scrollTop = 0;
  2495. var r = marked(i);
  2496. t && (r = r.replace(new RegExp("(" + t + ")", "ig"), '<span class="highlight">$1</span>'));
  2497. m.noteContent = v.trustAsHtml(r),
  2498. m.$apply();
  2499. var o = $(p[0]).width(),
  2500. a = $(p[0]).height(),
  2501. l = $(g).outerWidth(),
  2502. s = $(g).outerHeight(),
  2503. c = n.cx - l / 2 - p[0].offsetLeft,
  2504. d = n.bottom + 10 - p[0].offsetTop;
  2505. c < 0 && (c = 10);
  2506. o < c + l && (c = n.left - l - 10 - p[0].offsetLeft);
  2507. a < d + s && (d = n.top - s - 10 - p[0].offsetTop);
  2508. m.previewerStyle = {
  2509. left: Math.round(c) + "px",
  2510. top: Math.round(d) + "px"
  2511. },
  2512. m.showNotePreviewer = !0;
  2513. var u = g[0].querySelector(".highlight");
  2514. u && u.scrollIntoView();
  2515. f = !0,
  2516. m.$apply()
  2517. } (e.node, e.keyword)
  2518. },
  2519. 300)
  2520. }),
  2521. n.on("hidenoterequest",
  2522. function() {
  2523. clearTimeout(t),
  2524. m.showNotePreviewer = !1
  2525. });
  2526. var f = !1;
  2527. $(document).on("mousedown mousewheel DOMMouseScroll",
  2528. function() {
  2529. f && (m.showNotePreviewer = !1, m.$apply())
  2530. }),
  2531. e.on("mousedown mousewheel DOMMouseScroll",
  2532. function(e) {
  2533. e.stopPropagation()
  2534. })
  2535. }
  2536. }
  2537. }]),
  2538. angular.module("kityminderEditor").directive("operation",
  2539. function() {
  2540. return {
  2541. restrict: "E",
  2542. templateUrl: "ui/directive/operation/operation.html",
  2543. scope: {
  2544. minder: "="
  2545. },
  2546. replace: !0,
  2547. link: function(e) {
  2548. e.editNode = function() {
  2549. var e = editor.receiver.element,
  2550. t = editor.fsm,
  2551. n = editor.receiver;
  2552. e.innerText = minder.queryCommandValue("text"),
  2553. t.jump("input", "input-request"),
  2554. n.selectAll()
  2555. }
  2556. }
  2557. }
  2558. }),
  2559. angular.module("kityminderEditor").directive("priorityEditor", ["commandBinder",
  2560. function(r) {
  2561. return {
  2562. restrict: "E",
  2563. templateUrl: "ui/directive/priorityEditor/priorityEditor.html",
  2564. scope: {
  2565. minder: "="
  2566. },
  2567. replace: !0,
  2568. link: function(e) {
  2569. for (var t = e.minder,
  2570. n = [], i = 0; i < 10; i++) n.push(i);
  2571. r.bind(t, "priority", e),
  2572. e.priorities = n,
  2573. e.getPriorityTitle = function(e) {
  2574. switch (e) {
  2575. case 0:
  2576. return "移除优先级";
  2577. default:
  2578. return "优先级" + e
  2579. }
  2580. }
  2581. }
  2582. }
  2583. }]),
  2584. angular.module("kityminderEditor").directive("progressEditor", ["commandBinder",
  2585. function(r) {
  2586. return {
  2587. restrict: "E",
  2588. templateUrl: "ui/directive/progressEditor/progressEditor.html",
  2589. scope: {
  2590. minder: "="
  2591. },
  2592. replace: !0,
  2593. link: function(e) {
  2594. for (var t = e.minder,
  2595. n = [], i = 0; i < 10; i++) n.push(i);
  2596. r.bind(t, "progress", e),
  2597. e.progresses = n,
  2598. e.getProgressTitle = function(e) {
  2599. switch (e) {
  2600. case 0:
  2601. return "移除进度";
  2602. case 1:
  2603. return "未开始";
  2604. case 9:
  2605. return "全部完成";
  2606. default:
  2607. return "完成" + (e - 1) + "/8"
  2608. }
  2609. }
  2610. }
  2611. }
  2612. }]),
  2613. angular.module("kityminderEditor").directive("resourceEditor",
  2614. function() {
  2615. return {
  2616. restrict: "E",
  2617. templateUrl: "ui/directive/resourceEditor/resourceEditor.html",
  2618. scope: {
  2619. minder: "="
  2620. },
  2621. replace: !0,
  2622. controller: ["$scope",
  2623. function(n) {
  2624. var i = n.minder,
  2625. r = !1;
  2626. i.on("interactchange",
  2627. function() {
  2628. var t = (n.enabled = -1 != i.queryCommandState("resource")) ? i.queryCommandValue("resource") : [],
  2629. e = i.getUsedResource().map(function(e) {
  2630. return {
  2631. name: e,
  2632. selected: -1 < t.indexOf(e)
  2633. }
  2634. });
  2635. n.used = e,
  2636. r = !0,
  2637. n.$apply(),
  2638. r = !1
  2639. }),
  2640. n.$watch("used",
  2641. function(e) {
  2642. if ( - 1 != i.queryCommandState("resource") && e) {
  2643. var t = e.filter(function(e) {
  2644. return e.selected
  2645. }).map(function(e) {
  2646. return e.name
  2647. });
  2648. if (r) return;
  2649. i.execCommand("resource", t)
  2650. }
  2651. },
  2652. !0),
  2653. n.resourceColor = function(e) {
  2654. return i.getResourceColor(e).toHEX()
  2655. },
  2656. n.addResource = function(e) {
  2657. var t = i.queryCommandValue("resource");
  2658. e && /\S/.test(e) && ( - 1 == t.indexOf(e) && n.used.push({
  2659. name: e,
  2660. selected: !0
  2661. }), n.newResourceName = null)
  2662. }
  2663. }]
  2664. }
  2665. }).directive("clickAnywhereButHere", ["$document",
  2666. function(o) {
  2667. return {
  2668. link: function(i, e, r) {
  2669. var n = function(e) {
  2670. var t = 0 < $("#resource-dropdown").has(e.target).length,
  2671. n = $("#resource-dropdown") == e.target;
  2672. t || n || i.$apply(r.clickAnywhereButHere)
  2673. };
  2674. i.$watch(r.isActive,
  2675. function(e, t) {
  2676. e !== t && 1 == e ? o.bind("click", n) : e !== t && 0 == e && o.unbind("click", n)
  2677. })
  2678. }
  2679. }
  2680. }]),
  2681. angular.module("kityminderEditor").directive("searchBox",
  2682. function() {
  2683. return {
  2684. restrict: "A",
  2685. templateUrl: "ui/directive/searchBox/searchBox.html",
  2686. scope: {
  2687. minder: "="
  2688. },
  2689. replace: !0,
  2690. controller: ["$scope",
  2691. function(a) {
  2692. var l = a.minder,
  2693. e = window.editor;
  2694. function n() {
  2695. $("#search-input").blur(),
  2696. a.showSearch = !1,
  2697. l.fire("hidenoterequest"),
  2698. e.receiver.selectAll()
  2699. }
  2700. function t() {
  2701. a.showSearch = !0,
  2702. setTimeout(function() {
  2703. $("#search-input").focus()
  2704. },
  2705. 10),
  2706. a.keyword && $("#search-input")[0].setSelectionRange(0, a.keyword.length)
  2707. }
  2708. a.handleKeyDown = function(e) {
  2709. if (13 == e.keyCode) {
  2710. var t = e.shiftKey ? "prev": "next";
  2711. d(a.keyword, t)
  2712. }
  2713. 27 == e.keyCode && n()
  2714. },
  2715. a.doSearch = d,
  2716. a.exitSearch = n,
  2717. a.showTip = !1,
  2718. a.showSearch = !1,
  2719. $("body").on("keydown",
  2720. function(e) {
  2721. 70 != e.keyCode || !e.ctrlKey && !e.metaKey || e.shiftKey || (t(), a.$apply(), e.preventDefault())
  2722. }),
  2723. l.on("searchNode",
  2724. function() {
  2725. t()
  2726. });
  2727. var s = [],
  2728. c = [];
  2729. function i() {
  2730. s = [],
  2731. l.getRoot().traverse(function(e) {
  2732. s.push(e)
  2733. })
  2734. }
  2735. function d(e, t) {
  2736. if (a.showTip = !1, l.fire("hidenoterequest"), e && /\S/.exec(e)) {
  2737. a.showTip = !0,
  2738. a.curIndex = 0,
  2739. a.resultNum = 0,
  2740. e = e.toLowerCase();
  2741. var n, i, r = d.lastKeyword != e;
  2742. if (d.lastKeyword = e, r &&
  2743. function(e) {
  2744. c = [];
  2745. for (var t = 0; t < s.length; t++) {
  2746. var n = s[t]; - 1 != n.getText().toLowerCase().indexOf(e) && c.push({
  2747. node: n
  2748. });
  2749. var i = n.getData("note");
  2750. i && -1 != i.toLowerCase().indexOf(e) && c.push({
  2751. node: n,
  2752. keyword: e
  2753. })
  2754. }
  2755. } (e), a.resultNum = c.length, c.length) {
  2756. var o = r ? 0 : ("next" === t ? d.lastIndex + 1 : d.lastIndex - 1) || 0;
  2757. o = (c.length + o) % c.length,
  2758. n = c[o].node,
  2759. i = c[o].keyword,
  2760. l.execCommand("camera", n, 50),
  2761. setTimeout(function() {
  2762. l.select(n, !0),
  2763. n.isExpanded() || l.execCommand("expand", !0),
  2764. i && l.fire("shownoterequest", {
  2765. node: n,
  2766. keyword: i
  2767. })
  2768. },
  2769. 60),
  2770. d.lastIndex = o,
  2771. a.curIndex = o + 1
  2772. }
  2773. } else $("#search-input").focus()
  2774. }
  2775. l.on("contentchange", i),
  2776. i()
  2777. }]
  2778. }
  2779. }),
  2780. angular.module("kityminderEditor").directive("searchBtn",
  2781. function() {
  2782. return {
  2783. restrict: "E",
  2784. templateUrl: "ui/directive/searchBtn/searchBtn.html",
  2785. scope: {
  2786. minder: "="
  2787. },
  2788. replace: !0,
  2789. link: function(e) {
  2790. e.enterSearch = function() {
  2791. minder.fire("searchNode")
  2792. }
  2793. }
  2794. }
  2795. }),
  2796. angular.module("kityminderEditor").directive("selectAll",
  2797. function() {
  2798. return {
  2799. restrict: "E",
  2800. templateUrl: "ui/directive/selectAll/selectAll.html",
  2801. scope: {
  2802. minder: "="
  2803. },
  2804. replace: !0,
  2805. link: function(e) {
  2806. var i = e.minder;
  2807. e.items = ["revert", "siblings", "level", "path", "tree"],
  2808. e.select = {
  2809. all: function() {
  2810. var t = [];
  2811. i.getRoot().traverse(function(e) {
  2812. t.push(e)
  2813. }),
  2814. i.select(t, !0),
  2815. i.fire("receiverfocus")
  2816. },
  2817. revert: function() {
  2818. var t = i.getSelectedNodes(),
  2819. n = [];
  2820. i.getRoot().traverse(function(e) { - 1 == t.indexOf(e) && n.push(e)
  2821. }),
  2822. i.select(n, !0),
  2823. i.fire("receiverfocus")
  2824. },
  2825. siblings: function() {
  2826. var e = i.getSelectedNodes(),
  2827. t = [];
  2828. e.forEach(function(e) {
  2829. e.parent && e.parent.children.forEach(function(e) { - 1 == t.indexOf(e) && t.push(e)
  2830. })
  2831. }),
  2832. i.select(t, !0),
  2833. i.fire("receiverfocus")
  2834. },
  2835. level: function() {
  2836. var t = i.getSelectedNodes().map(function(e) {
  2837. return e.getLevel()
  2838. }),
  2839. n = [];
  2840. i.getRoot().traverse(function(e) { - 1 != t.indexOf(e.getLevel()) && n.push(e)
  2841. }),
  2842. i.select(n, !0),
  2843. i.fire("receiverfocus")
  2844. },
  2845. path: function() {
  2846. var e = i.getSelectedNodes(),
  2847. t = [];
  2848. e.forEach(function(e) {
  2849. for (; e && -1 == t.indexOf(e);) t.push(e),
  2850. e = e.parent
  2851. }),
  2852. i.select(t, !0),
  2853. i.fire("receiverfocus")
  2854. },
  2855. tree: function() {
  2856. var e = i.getSelectedNodes(),
  2857. t = [];
  2858. e.forEach(function(e) {
  2859. e.traverse(function(e) { - 1 == t.indexOf(e) && t.push(e)
  2860. })
  2861. }),
  2862. i.select(t, !0),
  2863. i.fire("receiverfocus")
  2864. }
  2865. }
  2866. }
  2867. }
  2868. }),
  2869. angular.module("kityminderEditor").directive("styleOperator",
  2870. function() {
  2871. return {
  2872. restrict: "E",
  2873. templateUrl: "ui/directive/styleOperator/styleOperator.html",
  2874. scope: {
  2875. minder: "="
  2876. },
  2877. replace: !0
  2878. }
  2879. }),
  2880. angular.module("kityminderEditor").directive("templateList",
  2881. function() {
  2882. return {
  2883. restrict: "E",
  2884. templateUrl: "ui/directive/templateList/templateList.html",
  2885. scope: {
  2886. minder: "="
  2887. },
  2888. replace: !0,
  2889. link: function(e) {
  2890. e.templateList = kityminder.Minder.getTemplateList()
  2891. }
  2892. }
  2893. }),
  2894. angular.module("kityminderEditor").directive("themeList",
  2895. function() {
  2896. return {
  2897. restrict: "E",
  2898. templateUrl: "ui/directive/themeList/themeList.html",
  2899. replace: !0,
  2900. link: function(e) {
  2901. var i = kityminder.Minder.getThemeList();
  2902. e.getThemeThumbStyle = function(e) {
  2903. var t = i[e];
  2904. if (t) {
  2905. var n = {
  2906. color: t["root-color"],
  2907. "border-radius": t["root-radius"] / 2
  2908. };
  2909. return t["root-background"] && (n.background = t["root-background"].toString()),
  2910. n
  2911. }
  2912. },
  2913. 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"]
  2914. }
  2915. }
  2916. }),
  2917. angular.module("kityminderEditor").directive("topTab",
  2918. function() {
  2919. return {
  2920. restrict: "A",
  2921. templateUrl: "ui/directive/topTab/topTab.html",
  2922. scope: {
  2923. minder: "=topTab",
  2924. editor: "="
  2925. },
  2926. link: function(e) {
  2927. var r = !1,
  2928. o = !0,
  2929. a = !0;
  2930. e.setCurTab = function(e) {
  2931. setTimeout(function() {
  2932. r = !0,
  2933. "idea" != e && (o = !1)
  2934. })
  2935. },
  2936. e.toggleTopTab = function() {
  2937. setTimeout(function() {
  2938. var e, t, n, i;
  2939. r && !o || (o = !1, a ? (n = $(".tab-content"), i = $(".minder-editor"), n.animate({
  2940. height: 0,
  2941. display: "none"
  2942. }), i.animate({
  2943. top: "32px"
  2944. })) : (e = $(".tab-content"), t = $(".minder-editor"), e.animate({
  2945. height: "60px",
  2946. display: "block"
  2947. }), t.animate({
  2948. top: "92px"
  2949. })), a = !a),
  2950. r = !1
  2951. })
  2952. }
  2953. }
  2954. }
  2955. }),
  2956. angular.module("kityminderEditor").directive("undoRedo",
  2957. function() {
  2958. return {
  2959. restrict: "E",
  2960. templateUrl: "ui/directive/undoRedo/undoRedo.html",
  2961. scope: {
  2962. editor: "="
  2963. },
  2964. replace: !0,
  2965. link: function(e) {}
  2966. }
  2967. }),
  2968. e = "expose-editor",
  2969. d.r([t[e]])
  2970. } ();