MCPcopy
hub / github.com/codex-team/editor.js / processPlain

Method processPlain

src/components/modules/paste.ts:709–737  ·  view source on GitHub ↗

* Split plain text by new line symbols and return it as array of Block data * * @param {string} plain - string to process * @returns {PasteData[]}

(plain: string)

Source from the content-addressed store, hash-verified

707 * @returns {PasteData[]}
708 */
709 private processPlain(plain: string): PasteData[] {
710 const { defaultBlock } = this.config as { defaultBlock: string };
711
712 if (!plain) {
713 return [];
714 }
715
716 const tool = defaultBlock;
717
718 return plain
719 .split(/\r?\n/)
720 .filter((text) => text.trim())
721 .map((text) => {
722 const content = $.make('div');
723
724 content.textContent = text;
725
726 const event = this.composePasteEvent('tag', {
727 data: content,
728 });
729
730 return {
731 content,
732 tool,
733 isBlock: false,
734 event,
735 };
736 });
737 }
738
739 /**
740 * Process paste of single Block tool content

Callers 1

processTextMethod · 0.95

Calls 3

composePasteEventMethod · 0.95
splitMethod · 0.80
makeMethod · 0.45

Tested by

no test coverage detected