MCPcopy
hub / github.com/marktext/marktext / find

Method find

packages/muya/src/search/index.ts:113–135  ·  view source on GitHub ↗

* Find preview or next value, and highlight it. * @param {string} action : previous or next.

(action: 'previous' | 'next')

Source from the content-addressed store, hash-verified

111 * @param {string} action : previous or next.
112 */
113 find(action: 'previous' | 'next'): this {
114 const { matches } = this;
115 let { index } = this;
116 const len = matches.length;
117
118 if (!len)
119 return this;
120
121 index = action === 'next' ? index + 1 : index - 1;
122
123 if (index < 0)
124 index = len - 1;
125
126 if (index >= len)
127 index = 0;
128
129 this.index = index;
130
131 this._updateMatches(true);
132 this._updateMatches();
133
134 return this;
135 }
136
137 /**
138 * Search value in current document.

Callers 15

validEmojiFunction · 0.45
transformAliasToOriginFunction · 0.45
footnote.spec.tsFile · 0.45
pickMethod · 0.45
dropMethod · 0.45
findByTypeFunction · 0.45
listenMethod · 0.45
listenMethod · 0.45
TableDragBarClass · 0.45
listenMethod · 0.45

Calls 1

_updateMatchesMethod · 0.95

Tested by 1

findByTypeFunction · 0.36