(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d21b2b8"],{bf42:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this;e._self._c;return e._m(0)},c=[function(){var e=this,t=e._self._c;return t("div",[t("h1",[e._v("Search plugin")]),t("blockquote",[t("p",[e._v("v0.6.9+")])]),t("p",[e._v("This plugin provides the ability to search and replace node content.")]),t("h2",[e._v("Register")]),t("pre",{staticClass:"hljs"},[t("code",[t("span",{staticClass:"hljs-keyword"},[e._v("import")]),e._v(" MindMap "),t("span",{staticClass:"hljs-keyword"},[e._v("from")]),e._v(" "),t("span",{staticClass:"hljs-string"},[e._v("'simple-mind-map'")]),e._v("\n"),t("span",{staticClass:"hljs-keyword"},[e._v("import")]),e._v(" Search "),t("span",{staticClass:"hljs-keyword"},[e._v("from")]),e._v(" "),t("span",{staticClass:"hljs-string"},[e._v("'simple-mind-map/src/plugins/Search.js'")]),e._v("\nMindMap.usePlugin(Search)\n")])]),t("p",[e._v("After registration and instantiation of "),t("code",[e._v("MindMap")]),e._v(", the instance can be obtained through "),t("code",[e._v("mindMap.search")]),e._v(".")]),t("h2",[e._v("Event")]),t("h3",[e._v("search_info_change")]),t("p",[e._v("You can listen to 'search_info_change' event to get the number of current search results and the index currently located.")]),t("pre",{staticClass:"hljs"},[t("code",[e._v("mindMap.on("),t("span",{staticClass:"hljs-string"},[e._v("'search_info_change'")]),e._v(", "),t("span",{staticClass:"hljs-function"},[e._v("("),t("span",{staticClass:"hljs-params"},[e._v("data")]),e._v(") =>")]),e._v(" {\n    "),t("span",{staticClass:"hljs-comment"},[e._v("/*\n        data: {\n            currentIndex,// Index, from zero\n            total\n        }\n    */")]),e._v("\n})\n")])]),t("h2",[e._v("Method")]),t("h3",[e._v("search(searchText, callback)")]),t("ul",[t("li",[t("p",[t("code",[e._v("searchText")]),e._v(": Text to search for")])]),t("li",[t("p",[t("code",[e._v("callback")]),e._v(": The callback function that completes this search will be triggered after jumping to the node")])])]),t("p",[e._v("Search for node content, which can be called repeatedly. Each call will search and locate to the next matching node. If the search text changes, it will be searched again.")]),t("h3",[e._v("endSearch()")]),t("p",[e._v("End search.")]),t("h3",[e._v("replace(replaceText, jumpNext = false)")]),t("ul",[t("li",[t("p",[t("code",[e._v("replaceText")]),e._v(": Text to be replaced")])]),t("li",[t("p",[t("code",[e._v("jumpNext")]),e._v(": v0.6.12+, Whether to automatically jump to the next matching node")])])]),t("p",[e._v("To replace the content of the current node, call the 'search' method after calling it to replace the content of the currently located matching node.")]),t("h3",[e._v("replaceAll(replaceText)")]),t("ul",[t("li",[t("code",[e._v("replaceText")]),e._v(": Text to be replaced")])]),t("p",[e._v("Replace all matching node contents, and call it after calling the 'search' method.")]),t("h3",[e._v("getReplacedText(node, searchText, replaceText)")]),t("ul",[t("li",[t("p",[t("code",[e._v("node")]),e._v(": Node instance")])]),t("li",[t("p",[t("code",[e._v("searchText")]),e._v(": Text to search for")])]),t("li",[t("p",[t("code",[e._v("replaceText")]),e._v(": Text to be replaced")])])]),t("p",[e._v("Return the text content of the node after search and replacement. Note that the node content will not be actually changed, but is only used to calculate the content of a node after replacement.")])])}],l={},s=l,o=a("2877"),r=Object(o["a"])(s,n,c,!1,null,null,null);t["default"]=r.exports}}]);