()
| 421 | }; |
| 422 | |
| 423 | const initEditors = () => { |
| 424 | let initCount = 0; |
| 425 | const editors: Editor[] = []; |
| 426 | let targets: HTMLElement[]; |
| 427 | |
| 428 | const createEditor = (id: string, options: RawEditorOptions, targetElm: HTMLElement) => { |
| 429 | const editor: Editor = new Editor(id, options, self); |
| 430 | editors.push(editor); |
| 431 | |
| 432 | editor.on('init', () => { |
| 433 | if (++initCount === targets.length) { |
| 434 | provideResults(editors); |
| 435 | } |
| 436 | }); |
| 437 | |
| 438 | editor.targetElm = editor.targetElm || targetElm; |
| 439 | editor.render(); |
| 440 | }; |
| 441 | |
| 442 | DOM.unbind(window, 'ready', initEditors); |
| 443 | execCallback('onpageload'); |
| 444 | |
| 445 | targets = Arr.unique(findTargets(options)); |
| 446 | |
| 447 | Tools.each(targets, (elm) => { |
| 448 | purgeDestroyedEditor(self.get(elm.id)); |
| 449 | }); |
| 450 | |
| 451 | targets = Tools.grep(targets, (elm) => { |
| 452 | return !self.get(elm.id); |
| 453 | }); |
| 454 | |
| 455 | if (targets.length === 0) { |
| 456 | provideResults([]); |
| 457 | } else { |
| 458 | each(targets, (elm) => { |
| 459 | if (isInvalidInlineTarget(options, elm)) { |
| 460 | ErrorReporter.initError('Could not initialize inline editor on invalid inline target element', elm); |
| 461 | } else { |
| 462 | createEditor(createId(elm), options, elm); |
| 463 | } |
| 464 | }); |
| 465 | } |
| 466 | }; |
| 467 | |
| 468 | DOM.bind(window, 'ready', initEditors); |
| 469 |
nothing calls this directly
no test coverage detected
searching dependent graphs…