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

Method toolPrepareMethodSuccess

src/components/modules/tools.ts:225–249  ·  view source on GitHub ↗

* Tool prepare method success callback * * @param {object} data - append tool to available list

(data: { toolName: string })

Source from the content-addressed store, hash-verified

223 * @param {object} data - append tool to available list
224 */
225 private toolPrepareMethodSuccess(data: { toolName: string }): void {
226 const tool = this.factory.get(data.toolName);
227
228 if (tool.isInline()) {
229 /**
230 * Some Tools validation
231 */
232 const inlineToolRequiredMethods = [ 'render' ];
233 const notImplementedMethods = inlineToolRequiredMethods.filter((method) => !tool.create()[method]);
234
235 if (notImplementedMethods.length) {
236 _.log(
237 `Incorrect Inline Tool: ${tool.name}. Some of required methods is not implemented %o`,
238 'warn',
239 notImplementedMethods
240 );
241
242 this.toolsUnavailable.set(tool.name, tool);
243
244 return;
245 }
246 }
247
248 this.toolsAvailable.set(tool.name, tool);
249 }
250
251 /**
252 * Tool prepare method fail callback

Callers 1

prepareMethod · 0.95

Calls 4

isInlineMethod · 0.80
getMethod · 0.65
createMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected