[PR #3853] [MERGED] Started refactor and alignment of JS component system #6272

Closed
opened 2026-02-05 10:28:15 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/3853
Author: @ssddanbrown
Created: 11/15/2022
Status: Merged
Merged: 11/16/2022
Merged by: @ssddanbrown

Base: developmentHead: component_refactor


📝 Commits (8)

  • 09c6a3c Started refactor and alignment of component system
  • 4310d34 Updated a batch of JS components
  • b37e84d Updated another set of components
  • db79167 Updated a whole load more js components
  • 3b8ee39 Finished updating remainder of JS components to new system
  • 25c23a2 Removed use of image-manager/entity-selector window globals
  • be736b3 Replaced el.components mapping with component service weakmap
  • 05a24ea Updated js dev docs with latest component changes

📊 Changes

96 files changed (+973 additions, -1019 deletions)

View changed files

📝 dev/docs/javascript-code.md (+24 -6)
📝 resources/js/app.js (+5 -2)
📝 resources/js/components/add-remove-rows.js (+4 -6)
📝 resources/js/components/ajax-delete-row.js (+3 -8)
📝 resources/js/components/ajax-form.js (+4 -7)
📝 resources/js/components/attachments-list.js (+4 -5)
📝 resources/js/components/attachments.js (+8 -11)
📝 resources/js/components/auto-submit.js (+3 -4)
📝 resources/js/components/auto-suggest.js (+3 -5)
📝 resources/js/components/back-to-top.js (+11 -12)
📝 resources/js/components/book-sort.js (+12 -14)
📝 resources/js/components/chapter-contents.js (+2 -7)
📝 resources/js/components/code-editor.js (+13 -10)
📝 resources/js/components/code-highlighter.js (+9 -7)
📝 resources/js/components/code-textarea.js (+4 -5)
📝 resources/js/components/collapsible.js (+14 -14)
resources/js/components/component.js (+58 -0)
📝 resources/js/components/confirm-dialog.js (+4 -6)
📝 resources/js/components/custom-checkbox.js (+10 -11)
📝 resources/js/components/details-highlighter.js (+10 -9)

...and 76 more files

📄 Description

  • Updates old components to newer format, removes legacy component support.
  • Makes component registration easier and less duplicated.
  • Adds base component class to extend for better editor support.
  • Aligns global window exposure usage and aligns with other service names.
  • Separates app-specific component registration from generic component logic.

Todo

  • Continue working through (components/index.js) component list.
  • Thoroughly test attachments file upload once done (Lots of inter component events).
  • Ensure no window.EntitySelectorPopup references exist ($components.first instead).
  • Update JS dev docs.
  • Rethink elem.components usage?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/3853 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 11/15/2022 **Status:** ✅ Merged **Merged:** 11/16/2022 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `component_refactor` --- ### 📝 Commits (8) - [`09c6a3c`](https://github.com/BookStackApp/BookStack/commit/09c6a3c2405742ea6003e9a8a30e7ad212ab6977) Started refactor and alignment of component system - [`4310d34`](https://github.com/BookStackApp/BookStack/commit/4310d34135243e91fdacd960a825f60f0231621e) Updated a batch of JS components - [`b37e84d`](https://github.com/BookStackApp/BookStack/commit/b37e84dc101e8ca5c80bcd731adb9cc19b9e08ab) Updated another set of components - [`db79167`](https://github.com/BookStackApp/BookStack/commit/db791674691062c26e0073361ab731ed5c772713) Updated a whole load more js components - [`3b8ee39`](https://github.com/BookStackApp/BookStack/commit/3b8ee3954e3f2834dae4b7a56d4fcecd5e8d03e6) Finished updating remainder of JS components to new system - [`25c23a2`](https://github.com/BookStackApp/BookStack/commit/25c23a2e5f3934a2ed2cc51ef9de0b286986fadf) Removed use of image-manager/entity-selector window globals - [`be736b3`](https://github.com/BookStackApp/BookStack/commit/be736b3939a428674ccab33c7aaca95c05ef6437) Replaced el.components mapping with component service weakmap - [`05a24ea`](https://github.com/BookStackApp/BookStack/commit/05a24ea3559950baf2506349c3ff5b8b1bca887d) Updated js dev docs with latest component changes ### 📊 Changes **96 files changed** (+973 additions, -1019 deletions) <details> <summary>View changed files</summary> 📝 `dev/docs/javascript-code.md` (+24 -6) 📝 `resources/js/app.js` (+5 -2) 📝 `resources/js/components/add-remove-rows.js` (+4 -6) 📝 `resources/js/components/ajax-delete-row.js` (+3 -8) 📝 `resources/js/components/ajax-form.js` (+4 -7) 📝 `resources/js/components/attachments-list.js` (+4 -5) 📝 `resources/js/components/attachments.js` (+8 -11) 📝 `resources/js/components/auto-submit.js` (+3 -4) 📝 `resources/js/components/auto-suggest.js` (+3 -5) 📝 `resources/js/components/back-to-top.js` (+11 -12) 📝 `resources/js/components/book-sort.js` (+12 -14) 📝 `resources/js/components/chapter-contents.js` (+2 -7) 📝 `resources/js/components/code-editor.js` (+13 -10) 📝 `resources/js/components/code-highlighter.js` (+9 -7) 📝 `resources/js/components/code-textarea.js` (+4 -5) 📝 `resources/js/components/collapsible.js` (+14 -14) ➕ `resources/js/components/component.js` (+58 -0) 📝 `resources/js/components/confirm-dialog.js` (+4 -6) 📝 `resources/js/components/custom-checkbox.js` (+10 -11) 📝 `resources/js/components/details-highlighter.js` (+10 -9) _...and 76 more files_ </details> ### 📄 Description - Updates old components to newer format, removes legacy component support. - Makes component registration easier and less duplicated. - Adds base component class to extend for better editor support. - Aligns global window exposure usage and aligns with other service names. - Separates app-specific component registration from generic component logic. ## Todo - [x] Continue working through (components/index.js) component list. - [x] Thoroughly test attachments file upload once done (Lots of inter component events). - [x] Ensure no `window.EntitySelectorPopup` references exist ($components.first instead). - [x] Update JS dev docs. - [x] Rethink `elem.components` usage? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:28:15 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6272