|
413 | 413 | const select = document.createElement("select")
|
414 | 414 | let idx = 0
|
415 | 415 |
|
416 |
| - if (title) select.options[idx++] = new Option(title, "", true) |
| 416 | + if (title) { |
| 417 | + select.options[idx++] = new Option(title, "", true) |
| 418 | + } |
417 | 419 |
|
418 |
| - for (let i = 0; i < contents.length; i++) { |
| 420 | + for (const content of contents) { |
419 | 421 | // Option _values_ may either be the prefix (for plugins) or keys (for
|
420 | 422 | // regions)
|
421 | 423 | select.options[idx++] = new Option(
|
422 |
| - contents[i].title, |
423 |
| - contents[i].prefix || contents[i].key, |
| 424 | + content.title, |
| 425 | + content.prefix || content.key, |
424 | 426 | )
|
425 | 427 | }
|
426 | 428 | return select
|
|
489 | 491 | // Filter allowed regions
|
490 | 492 | const inlineType = getInlineType($inline)
|
491 | 493 | const regions = []
|
492 |
| - for (let i = 0; i < ContentEditor.regions.length; i++) { |
| 494 | + for (const region of ContentEditor.regions) { |
493 | 495 | if (
|
494 | 496 | (!inlineType ||
|
495 | 497 | !pluginRegions[inlineType] ||
|
496 |
| - $.inArray( |
497 |
| - ContentEditor.regions[i].key, |
498 |
| - pluginRegions[inlineType], |
499 |
| - ) >= 0) && |
500 |
| - !/^_unknown_/.test(ContentEditor.regions[i].key) |
| 498 | + $.inArray(region.key, pluginRegions[inlineType]) >= 0) && |
| 499 | + !/^_unknown_/.test(region.key) |
501 | 500 | ) {
|
502 |
| - regions.push(ContentEditor.regions[i]) |
| 501 | + regions.push(region) |
503 | 502 | }
|
504 | 503 | }
|
505 | 504 |
|
|
611 | 610 | )
|
612 | 611 | }
|
613 | 612 |
|
614 |
| - const pluginInlineGroups = (function selectPluginInlineGroups() { |
615 |
| - const selector = [] |
616 |
| - for (let i = 0; i < ContentEditor.plugins.length; i++) { |
617 |
| - selector.push(`#${ContentEditor.plugins[i].prefix}-group`) |
618 |
| - } |
619 |
| - return $(selector.join(", ")) |
620 |
| - })() |
| 613 | + const pluginInlineGroups = $( |
| 614 | + ContentEditor.plugins |
| 615 | + .map((plugin) => `#${plugin.prefix}-group`) |
| 616 | + .join(", "), |
| 617 | + ) |
621 | 618 |
|
622 | 619 | reorderInlines(pluginInlineGroups)
|
623 | 620 | pluginInlineGroups.hide()
|
|
763 | 760 | // Initialize tabs and currentRegion.
|
764 | 761 | ;(() => {
|
765 | 762 | const tabContainer = $(".tabs.regions")
|
766 |
| - for (let i = 0; i < ContentEditor.regions.length; i++) { |
| 763 | + for (const region of ContentEditor.regions) { |
767 | 764 | const t = document.createElement("h2")
|
768 | 765 | t.className = "tab"
|
769 |
| - t.textContent = ContentEditor.regions[i].title |
770 |
| - t.setAttribute("data-region", ContentEditor.regions[i].key) |
| 766 | + t.textContent = region.title |
| 767 | + t.setAttribute("data-region", region.key) |
771 | 768 | tabContainer.append(t)
|
772 | 769 | }
|
773 | 770 |
|
|
0 commit comments