[wp-trac] [WordPress Trac] #48411: Sorting Block Items in Ascending Order

WordPress Trac noreply at wordpress.org
Wed Oct 23 17:06:52 UTC 2019


#48411: Sorting Block Items in Ascending Order
-------------------------+-----------------------------
 Reporter:  vinoth06     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Editor       |    Version:  5.2.3
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The Block items are not sorting in any order, it would be good to sort in
 Ascending order
 Example Photo[[Image(https://imgur.com/a/sbwKuxp)]]

 To sort

 1. Open wp-includes/js/dist/block-editor.js
 2. Find the method BlockTypesList()
 3. Replace var items = _ref.items, with


 {{{
 var items = _ref.items.sort(function (a, b) {
                     var a1 = a.title, b1 = b.title;
                     if (a1 == b1) return 0;
                     return a1 > b1 ? 1 : -1;
                 }),
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48411>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list