silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
719 stars 820 forks source link

Edit existing link in HTMLEditor text, does not work if there are too many pages #11133

Open baukezwaan opened 4 months ago

baukezwaan commented 4 months ago

Module version(s) affected

5.1. and 4.13.

Description

For sites with many childpages under a certain page (for instance newsitems in the Blog-module), it is not possible to see the current link in the tinymce-popup for editing internal links.

This has to do with the node_threshold_leaf preventing the childeren to be loaded in the output of the json of admin/Modals/editorInternalLink/field/PageID/tree.

For the editor this looks like this: image

How to reproduce

  1. Install default Silverstripe installation
  2. In the CMS, create 5 pages under About Us-page.
  3. Change title of one of these pages to ABCDEF
  4. Edit the homepage Content, and create a hyperlink to page ABCDEF
  5. Save the page
  6. Observe editing the link, via the TinyMCE interface, shows the currently selected internal page
  7. Add a lower threshold in _config.php, by adding this line: SiteTree::config()->set('node_threshold_leaf', 3);
  8. Observe editing the link, via the TinyMCE interface, does NOT show the currently selected internal page

In the network panel this is visible, by openig the XHR-request in a new tab:

  1. Open https://localhost/admin/Modals/editorInternalLink/field/PageID/tree?forceValue=9&format=json
  2. Change the node_threshold_leaf value
  3. Refresh the json-page and see the children missing

This is even better visible, when changing the URL to &format=x

When the limit is not reached, this looks something like:

Home
About Us
Home
About Us
  - New Page
  - New Page
  - ABCDEF
  - New Page
Contact Us

But when the threshold is reached:

Home
About Us
  - Too many children (0)
Contact Us

Possible Solution

No response

Additional Context

No response

Validations