MCPcopy Index your code
hub / github.com/codex-team/editor.js / processPattern

Method processPattern

src/components/modules/paste.ts:814–838  ·  view source on GitHub ↗

* Get patterns` matches * * @param {string} text - text to process * @returns {Promise<{event: PasteEvent, tool: string}>}

(text: string)

Source from the content-addressed store, hash-verified

812 * @returns {Promise<{event: PasteEvent, tool: string}>}
813 */
814 private async processPattern(text: string): Promise<{ event: PasteEvent; tool: string }> {
815 const pattern = this.toolsPatterns.find((substitute) => {
816 const execResult = substitute.pattern.exec(text);
817
818 if (!execResult) {
819 return false;
820 }
821
822 return text === execResult.shift();
823 });
824
825 if (!pattern) {
826 return;
827 }
828
829 const event = this.composePasteEvent('pattern', {
830 key: pattern.key,
831 data: text,
832 });
833
834 return {
835 event,
836 tool: pattern.tool.name,
837 };
838 }
839
840 /**
841 * Insert pasted Block content to Editor

Callers 1

processInlinePasteMethod · 0.95

Calls 2

composePasteEventMethod · 0.95
findMethod · 0.80

Tested by

no test coverage detected