Maintain normal column layout while editing.
This commit is contained in:
+18
-10
@@ -269,22 +269,19 @@ import "overlayscrollbars/overlayscrollbars.css";
|
||||
// created page has no pen for commitPending's handover click.
|
||||
renderAuthUi();
|
||||
placeEditPen();
|
||||
// Preview swaps also wipe the .colseg wrappers (the server render has
|
||||
// none), which would drop the multi-column layout until a full reload;
|
||||
// re-split so columns survive both live editing and closing the editor.
|
||||
const main = document.getElementById("main");
|
||||
if (main) applyMulticol(main);
|
||||
});
|
||||
|
||||
function applyEffects() {
|
||||
(window.requestIdleCallback || setTimeout)(preload);
|
||||
const main = document.getElementById("main");
|
||||
addCopyButtons(main);
|
||||
// Fetch-navigation swaps #main, discarding the article pen and corner
|
||||
// buttons; re-add whichever auth UI is appropriate for this session.
|
||||
renderAuthUi();
|
||||
placeEditPen();
|
||||
fitNav();
|
||||
// Multi-column layout only when there is enough text to justify it.
|
||||
// Split the body into columned segments: h1s, h2s and wide figures are
|
||||
// full-width separators and never go inside columns.
|
||||
function applyMulticol(main) {
|
||||
const article = main.querySelector("article");
|
||||
if (article) {
|
||||
if (!article) return;
|
||||
const body = article.querySelector(".body");
|
||||
article.classList.toggle(
|
||||
"multicol",
|
||||
@@ -318,6 +315,17 @@ import "overlayscrollbars/overlayscrollbars.css";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function applyEffects() {
|
||||
(window.requestIdleCallback || setTimeout)(preload);
|
||||
const main = document.getElementById("main");
|
||||
addCopyButtons(main);
|
||||
// Fetch-navigation swaps #main, discarding the article pen and corner
|
||||
// buttons; re-add whichever auth UI is appropriate for this session.
|
||||
renderAuthUi();
|
||||
placeEditPen();
|
||||
fitNav();
|
||||
applyMulticol(main);
|
||||
if (reduceMotion.matches) return;
|
||||
for (const el of main.querySelectorAll(
|
||||
"h2, h3, figure, img, pre, blockquote, table, dl, .task-list-item",
|
||||
|
||||
Reference in New Issue
Block a user