Skip to content

Commit

Permalink
fluid-projectGH-32: add a code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyli committed Dec 19, 2022
1 parent 6e0fef0 commit fa68e7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/js/enactors.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ fluid.defaults("uioPlus.enactor.tableOfContents", {
}
});

// As UIO+ runs on arbitrary sites, inject the necessary ToC container markup into the pages content,
// and this container will then be used by the ToC component.
// 1. If the ToC container already exists, do nothing;
// 2. If the ToC container is not found:
// 2.1 The first choice is to append the ToC container to the page's main content area (e.g. <main>, <article> etc.)
// 2.2 If the main content is not found, for example when a page is marked up like
// `<body><div></div><div></div></body>`, inject the ToC container to the enactor's container.
uioPlus.enactor.tableOfContents.injectToCContainer = function (that) {
if (!that.locate("tocContainer").length) {
if (that.content.length === 1) {
Expand Down

0 comments on commit fa68e7f

Please sign in to comment.