Knowledge Folders and Security Developer Guide - edmozley/freeitsm GitHub Wiki
How folders and the access model are built: the one function that decides who can read what, the four main-pane renderers and why they differ, and how drag-and-drop works across all of them.
The user-facing page is Knowledge โ folders and security. The design reasoning โ including what was ruled out โ is Folders and permissions.
Colour key: โ๏ธ engine ยท ๐ API ยท ๐ฅ๏ธ UI ยท ๐งช tests
| ๐จ | File | What it does |
|---|---|---|
| โ๏ธ | includes/knowledge/visibility.php |
the choke point. KnowledgeViewer, knowledgeVisibilitySql(), knowledgeCanRead(), knowledgeAclSql()
|
| โ๏ธ | includes/knowledge/audit.php |
the one writer of knowledge_audit
|
| โ๏ธ | includes/knowledge/audience.php |
the Audience:: ladder (internal โ customer โ public) |
| ๐ | api/knowledge/folders.php |
list / create / rename / move / delete / move_article / shortcuts / exceptions |
| ๐ | api/knowledge/permissions.php |
get / set_mode / add / remove / search_principals
|
| ๐ | api/knowledge/permission_model.php |
containers-vs-filing, including the blast-radius preview |
| ๐ฅ๏ธ | knowledge/index.php |
the shell, the modals, and the knowledge.js?v=NN cache-buster |
| ๐ฅ๏ธ | assets/js/knowledge.js |
all four renderers, drag-and-drop, selection, the permission modals |
| ๐ฅ๏ธ | assets/css/knowledge.css |
desktop styling ยท assets/css/mobile.css layer 17 for the phone |
| ๐งช | tests/knowledge-visibility/ |
88 integration checks; 07_acl.php is the folder/ACL one |
โ ๏ธ Editingknowledge.jsorknowledge.cssmeans bumping?v=NNinknowledge/index.phpโ and verify it on the served page, not by grepping the source. A full-file rewrite has silently reverted asedbump more than once here, and the symptom is a change that appears not to have been made.
Everything that reads an article goes through one file. That is the whole architecture, and it is worth stating why: before this existed there were ~48 raw SELECT โฆ FROM knowledge_articles across ~30 files, and adding an access model to 30 places means 30 chances to miss one.
[$sql, $params] = knowledgeVisibilitySql($conn, $viewer, 'a', ['lifecycle' => 'live']);
$stmt = $conn->prepare("SELECT * FROM knowledge_articles a WHERE 1=1 $sql");
$stmt->execute($params);The clause is a fragment appended to somebody else's WHERE, not a complete query. That is what lets ~30 differently-shaped readers adopt it.
KnowledgeViewer::forAnalyst($conn, $analystId); // one active company
KnowledgeViewer::forApiKey($conn, $keyId); // acts as the analyst it belongs to
KnowledgeViewer::forPortalUser($conn, $userId);
KnowledgeViewer::forWebChat($conn, $channelId);
KnowledgeViewer::forSystem('reason'); // must SAY why it is unrestrictedThere is no public constructor. A caller cannot assemble a viewer that is more permissive than any real principal, and forSystem() demands a written reason so an unrestricted read is never accidental.
function knowledgeCanRead(PDO $conn, KnowledgeViewer $viewer, $articleId, array $opts = []): boolIt runs the same clause against a single id. This is deliberate and load-bearing: if "can this appear in a list?" and "can this be opened?" were separate implementations they would drift, and the drift would be a disclosure. One clause serves both.
| Axis | Meaning |
|---|---|
tenant_id |
|
audience |
the trust ladder: internal โ customer โ public
|
| the ACL | folders and per-document rules |
๐ Every axis narrows. Nothing widens. An ACL grant cannot lift an article above its audience rung. Test
03_readers.phpasserts exactly this: a portal user granted on aninternalarticle still cannot read it, paired with a positive control proving a granted analyst can.
knowledgeAclSql() resolves the folder tree in PHP, not in SQL. No recursive CTE โ the result is a flat IN (โฆ) of readable article ids folded into the fragment, which keeps it appendable to arbitrary queries.
The order of operations matters:
if ($viewer->isUnrestricted()) return ['', []]; // forSystem
if (!knowledgeAclTablesExist($conn)) return ['', []]; // pre-upgrade install
if (!knowledgeAclHasAnyRows($conn)) return ['', []]; // โ the fast path
// โฆ administrator floor, then the real resolutionThe fast path originally asked only "are there any ACL rows?". It is wrong, and it fails in the most dangerous direction:
A folder marked Restricted with an empty list is the tightest possible setting โ and it has no ACL rows. The fast path saw "nothing configured", returned an empty clause, and the guard was off precisely where it mattered most.
It survived 24 green checks because every fixture had rows in it. The fix ORs in the restricted flags:
$any = (bool)$conn->query("SELECT 1 FROM knowledge_acl LIMIT 1")->fetchColumn()
|| (bool)$conn->query("SELECT 1 FROM knowledge_folders WHERE is_restricted = 1 LIMIT 1")->fetchColumn()
|| (bool)$conn->query("SELECT 1 FROM knowledge_articles WHERE is_restricted = 1 LIMIT 1")->fetchColumn();โญ Generalise it: a fast path keyed on "is anything configured?" is wrong wherever the empty configuration is the strict one.
knowledge_acl has no allow/deny column. An object is either Open (the list is who is excluded) or Restricted (the list is who is admitted), and the rows mean whichever the object says.
That absence is the guarantee: a contradictory ACL is not something the schema can store, so there is no precedence rule and no effective-permissions dialog. Flipping polarity therefore must wipe the list โ permissions.php does, and audits entries_dropped_by_polarity_change.
Cap::KNOWLEDGE_MANAGE always passes, and every use is recorded:
knowledgeAuditAdminOverride($conn, $viewer, $articleId); // action = 'admin_override'07_acl.php asserts both halves.
One entry point, four exits. renderArticleList() in assets/js/knowledge.js:
container.className = 'article-list kb-layout-' + kbLayout;
if (kbLayout === 'tree') { container.innerHTML = renderTreeLayout(); kbRenderSelection(); return; }
if (kbLayout === 'details') { container.innerHTML = renderDetailsLayout(); kbRenderSelection(); return; }
const folderRows = renderFolderRows(); // list + cards share these
const ordered = articles.slice().sort(byTitle);
container.innerHTML = folderRows + ordered.map(cardHtml).join('');
kbRenderSelection();| View | Rendered by | Folder row | Article row |
|---|---|---|---|
| List | the tail of renderArticleList()
|
.kb-folder-card |
.article-card |
| Cards | the same code | .kb-folder-card |
.article-card |
| Tree | renderTreeLayout() |
.kb-tree-folder |
.kb-tree-article |
| Details | renderDetailsLayout() |
.kb-details-folder |
.kb-details-row |
List and cards are one renderer, differing only by the kb-layout-* class on the container โ CSS turns the same markup into rows or a grid. Tree and details replace the whole pane because they draw folders and articles interleaved, which the shared path cannot express.
โ ๏ธ Every return path must callkbRenderSelection(). The tick boxes come out right because each row asks thekbSelectedSet as it is built, but the row highlight is a class applied afterwards. Miss one path and changing view leaves the ticks on and the highlighting off โ a half-selected list. This has been a real bug.
Every article row in every view carries data-article="<id>". Selection, keyboard navigation and range selection all work off that one attribute rather than four view-specific selectors:
function kbVisibleArticleIds() {
return Array.from(document.querySelectorAll('#articleList [data-article]'))
.map(el => Number(el.dataset.article));
}๐ In DOM order, not data order. The details view sorts by whichever column was clicked and the tree groups by folder, so a Shift-range built from the
articlesarray would select rows the user never saw between the two they clicked. A range means "everything between these two, as displayed".
const byName = (a, b) => String(a).localeCompare(String(b), undefined,
{ numeric: true, sensitivity: 'base' });
const walk = (parent, depth) => {
for (const f of kbFolders.filter(x => x.parent_id === parent).sort((a,b) => byName(a.name, b.name))) {
html += folderRow(f, depth);
walk(f.id, depth + 1); // โ subfolders FIRST
for (const a of (byFolder[String(f.id)] || [])) html += article(a, depth + 1);
}
};
walk(null, 0);
for (const a of (byFolder['root'] || [])) html += article(a, 0); // unfiled, at the bottomnumeric: true so Step 2 precedes Step 10. Articles arrive newest-first, which suits a feed and not a tree.
Two bugs came from the same root, and both are the same shape:
(a) When Home was changed to show only top-level articles, the tree kept drawing from that fetch โ a tree of folders with nothing in any of them. Only a test that asserted on the documents caught it.
(b) Clicking a folder in the tree re-fetched "articles in this folder", but kbFolders is a separate fetch that was never narrowed โ so every document vanished while every folder stayed.
// A folder NEVER narrows the tree. Search and tags still do.
const treeShowsEverything = kbLayout === 'tree';
const browsingTop = activeFolder === '' && !search && tagIds.length === 0 && !treeShowsEverything;
if (browsingTop) url += 'folder=root&';
else if (activeFolder !== '' && !treeShowsEverything) url += `folder=${encodeURIComponent(activeFolder)}&`;โญ The tell for this whole class of bug: folders and documents come from DIFFERENT fetches. Filter one and not the other and you get a screen that looks coherent and is wrong.
grid-template-columns: 22px minmax(0,3fr) minmax(0,1.2fr) 110px minmax(0,1.5fr);The first column is the tick. The header row and the folder rows must each supply an empty <span></span> or every column below shifts by one. The harness asserts the Author heading and its column share an x-position.
One state variable, four kinds of source, four kinds of target.
let kbDrag = null; // { type: 'article' | 'folder', id }
function kbDragStart(e, type, id) {
kbDrag = { type, id };
e.currentTarget.classList.add('kb-dragging'); // fade what is in flight
try { e.dataTransfer.setData('text/plain', type + ':' + id); } catch (_) {}
e.dataTransfer.effectAllowed = 'move';
e.stopPropagation();
}The payload is set because some browsers refuse to start a drag with no data, but nothing reads it back โ the handler carries the state itself.
function kbDragOver(e) {
if (!kbDrag) return;
// A folder cannot be dropped on itself. Refusing HERE rather than letting the
// drop land and the server say no means the row never lights up as a target,
// so the answer is visible before the mouse is released.
if (kbDrag.type === 'folder' && String(kbDrag.id) === e.currentTarget.dataset.folder) return;
e.preventDefault(); // โ required, or no drop event fires
e.dataTransfer.dropEffect = 'move';
e.currentTarget.classList.add('drop-target');
}if (drag.type === 'article') {
if (e.ctrlKey && folderId !== null) {
await folderAction({ action: 'add_shortcut', article_id: drag.id, folder_id: folderId }, โฆ);
} else {
await folderAction({ action: 'move_article', article_id: drag.id, folder_id: folderId }, โฆ);
}
} else {
if (String(drag.id) === String(folderId)) return; // the server also refuses cycles
await folderAction({ action: 'move', id: drag.id, parent_id: folderId }, โฆ);
}Ctrl onto Home (folderId === null) is always a move โ a shortcut needs a real folder to live in.
.drop-target is added by JS to whichever row is under the pointer. There were three near-identical CSS copies of the highlight โ left panel, tree, details โ and the fourth kind of row, .kb-folder-card, never got one. The class was being applied correctly the whole time; nothing painted it. Dragging gave no feedback in two views out of four, which reads as the drag not working.
.kb-folder.drop-target,
.kb-tree-folder.drop-target,
.kb-details-folder.drop-target,
.kb-folder-card.drop-target { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }โญ Copies drift, and the way they drift is that one of them never gets written. Keep it one selector list: a new row type then shows up as a missing name, not as a highlight that quietly does nothing.
โ ๏ธ Assert on computed style, not the class. A test that checkedclassList.contains('drop-target')passed on the broken page.
kbDragEnd() clears both classes across the whole document, not just the row that started it โ an abandoned drag otherwise leaves a highlight that reads as a selection.
Every folder link - left panel, trail, folder cards and rows, the folder row in an article's details - calls selectFolder(). It decides the screen from the one that is showing:
| Showing | After a folder click |
|---|---|
| An article |
showView('list') - the folder's list |
| The editor | stays in the editor; syncArticleUrl('list') keeps the address bar on the folder |
| The list | stays; the list reloads |
TRAP: never
showView('list')from the editor here. It would hide an unsaved draft behind a folder's list. And never drop theshowView()from the article branch - the new list loads into a hidden view and the old article stays on screen, which was #250.
tests/knowledge-folder-navigation.php runs the real three functions in a headless browser and covers all three cases.
?article=N is handled by the IIFE at the bottom of assets/js/knowledge.js. It cannot open the article until the first article list and the folder list are back, and it asks the flags the fetches set, never the screen:
| Flag | Set by | Means |
|---|---|---|
kbArticlesLoaded |
loadArticles(), on success |
the first list arrived - an empty one counts |
kbFoldersSettled |
loadFolders(), in finally
|
the folder list arrived or failed |
if (kbArticlesLoaded && kbFoldersSettled) {
clearInterval(checkAndLoad);
Promise.resolve(viewArticle(articleId)).then(() => {
if (!currentArticle || String(currentArticle.id) !== String(articleId)) { showView('list'); return; }
kbHomeLinkedArticle(); // select the article's folder, load its list behindkbHomeLinkedArticle() moves activeFolder to the article's folder_id (null โ '', All articles), repaints the tree with kbRootArticleCount and reloads the list. It does nothing if the folder is not in kbFolders.
TRAP: never move the folder from
viewArticle(). Row clicks, search results, keyboard Enter, the right-click Edit and the AI chat links all open articles through it, and there the list behind is already the one being used - moving it turns a search into one folder's list. That is what PR #252 first did; see the review.TRAP: never wait on the screen's text. The old wait matched
'No articles', which is English only and is never drawn when the top level holds folders. And never wait onarticles.length > 0- an empty top level is a complete answer.TRAP: only into a folder in
kbFolders. An article withinherit_permissions = 0is judged on its own access list, so an analyst can read it while its folder is hidden from them.
tests/knowledge-article-links.php covers all four layouts, the hidden folder and the list click.
From May 2026 the button was a plain <a href="./">, so the address bar would stop naming the article. Every press then reloaded the whole module. Timed in a real browser on a local install:
| Step | Time |
|---|---|
| The page itself (350 KB of HTML, mostly the embedded translations) | ~350 ms |
~25 scripts, TinyMCE (487 KB + plugins) and mobile.js (319 KB) among them |
~330 ms |
| Only then: folders, articles and tags, fetched in parallel | ~100 ms each |
That is about a second on an idle machine and a couple on a busy one, and it threw away the folder, search and tag filters. The server calls were never the slow part, so a database index would not have helped.
syncArticleUrl() keeps the address bar right on every view change now, so the button only needs to show the list that is already behind the article:
<a class="btn btn-secondary" href="./" onclick="return kbBackToList(event)">Back to list</a>function kbBackToList(e) {
if (e && (e.ctrlKey || e.metaKey || e.shiftKey)) return true; // new tab/window: let the link work
if (e) e.preventDefault();
currentArticle = null;
showView('list');
if (kbListNeedsReload || !kbArticlesLoaded) {
kbListNeedsReload = false;
loadArticles(document.getElementById('articleSearch').value, activeTagFilters);
}
return false;
}TRAP: keep it a real link. Middle-click never fires
click, and Ctrl/Cmd/Shift-click returntrue, so opening the list in a new tab still works.TRAP: the list behind is not always the list. An article reached while the recycle bin is open (an AI chat link, say) leaves the bin's rows behind it.
showView()switches the bin off and setskbListNeedsReload, so Back fetches the real list once. A link that opened before the first list arrived has nothing behind it, and!kbArticlesLoadedcovers that.
Measured on the real page: Back showed the list in 1 ms with no fetch, kept folder, tag filter and ?folder= in the address bar, and from the recycle-bin case made exactly one list fetch. tests/knowledge-back-to-list.php covers the same ground on a bare page.
Drive the real page in a same-origin iframe; do not unit-test the functions. Everything in ยง4 and ยง5 above was found that way and would have been missed otherwise.
| Trap | What it looks like |
|---|---|
A top-level const/let is not a window property |
w.kbSelected is undefined forever. Read selection off the DOM instead โ a better assertion anyway. |
| Headless Chrome does not run CSS transitions |
.article-card has transition: all 0.2s, so a computed value stays at its start indefinitely. Inject * { transition: none !important } before measuring. |
| Headless Chrome cannot take a 360px window | Use a 360px iframe and assert body.scrollWidth === innerWidth. |
position: fixed inside a transformed ancestor |
Draws correctly, measures correctly, untappable. Only elementFromPoint catches it. |
| Driving the handler is not driving the gesture | Calling toggleShareDropdown() passed while tapping Share did nothing. Find the element, ask elementFromPoint what a tap hits, dispatch on that. (.click() does not exist on an SVG element; dispatchEvent does.) |
| State is not visibility | "The menu became active" passed while the sheet sat at top: -156px. Assert the rect intersects the viewport. |
| A probe endpoint after the fixture setup | Fetching it re-runs the DELETEs and re-INSERTs, destroying what it was asked to measure. Answer the probe before the setup. |
๐ Pair every "cannot" with a "can". A filter that hides everything from everybody passes every negative test ever written.
07_acl.phpnever asserts a refusal without a matching positive control.
Run: php tests/knowledge-visibility/run.php โ 88 checks, dev installs only.
| Table | Purpose |
|---|---|
knowledge_folders |
parent_id, name, is_restricted, inherit_permissions, is_deleted (a deleted folder kept for its recycled articles - see Folder soft delete: Developer Guide) |
knowledge_acl |
object_type (folder/article), object_id, principal_type, principal_id โ no allow/deny column
|
knowledge_shortcuts |
article_id, folder_id โ a pointer with no permissions of its own |
knowledge_user_groups / _members
|
ad-hoc groups, membership carries expires_at
|
knowledge_audit |
object_type, object_id, action, analyst_id, detail (JSON) |
knowledge_articles also gains folder_id, is_restricted and inherit_permissions.
โฌ Known gap:
knowledge_user_groupsis written by nothing. The ACL acceptsuser_groupprincipals andsearch_principalsfinds them, but there is no screen that creates a group.knowledgeAuditHistory()likewise has no caller โ the audit trail is recorded and never displayed.
renderArticleDetail() ends with kbInitArticlePictures(container.querySelector('.article-content-body')). Nothing new to maintain: it hands the article's pictures to the shared viewer's gallery.
const list = pictures.map((p, i) => ({
kind: 'image',
name: (p.getAttribute('alt') || '').trim() || window.t('knowledge.detail.picture', { n: i + 1 }),
src: srcOf(p), downloadUrl: srcOf(p)
}));
window.FilesViewer.openUrls(list, pictures.indexOf(img));-
kind: 'image'because a Knowledge picture's address (api/knowledge/image.php?id=381) has no extension for the viewer to read. - The listener is on the body element, which
renderArticleDetail()rebuilds per article, so it never stacks up. - Left click only, no modifier: Ctrl / middle click still opens a new tab.
.kb-pictures-zoomable img { cursor: zoom-in; }.
TRAP: a link round a picture. Imported articles wrap each picture in a link to itself (<a href="image.php?id=374"><img src="image.php?id=381"></a>); followed, it left the article. linkIsPicture() decides which links the viewer takes over: the link holds exactly one img and no text, and its href is api/knowledge/image.php, a picture file extension, or the picture's own src. The viewer then opens the link's address (often the full-size picture). Any other link round a picture stays a link - do not widen this to "any link that contains an image".
Move, History, Permissions and Archive moved from the toolbar into a menu in knowledge/index.php:
<div class="share-dropdown kb-more-dropdown">
<button class="btn btn-secondary" id="kbMoreBtn" onclick="kbToggleMoreMenu()" aria-haspopup="menu" aria-expanded="false" aria-controls="kbMoreMenu" ...>
<div class="share-dropdown-menu" id="kbMoreMenu" role="menu">
<a role="menuitem" onclick="kbMoreAction(kbMoveCurrentArticle); return false;">...
<a role="menuitem" id="kbArticleAuditBtn" style="display:none;" ...> <!-- History -->
<a role="menuitem" id="kbArticlePermBtn" style="display:none;" ...> <!-- Permissions -->
<div class="kb-more-sep" role="separator"></div>
<a role="menuitem" class="kb-more-danger" onclick="kbMoreAction(deleteCurrentArticle); ..."> <!-- Archive -->-
It reuses the
.share-dropdownshell on purpose.mobile.cssalready turns.share-dropdown-menu.activeinto a bottom sheet and sizes.article-actionsbuttons for the phone bar, so the phone needed no new CSS. Share's own outside-click handler usesdocument.querySelector('.share-dropdown')- the FIRST one, which is still Share's, because it comes first in the markup. -
kbArticleAuditBtnandkbArticlePermBtnkeep their ids, now on menu items.renderArticleDetail()still shows or hides them withstyle.display(kbCanManagePerms), and the menu's keyboard code skips hidden items. -
kbToggleMoreMenu()closes Share, opens the menu, focuses the first visible item and adds two listeners:kbMoreMenuOutside(click) andkbMoreMenuKeys(capture-phase keydown: Esc closes and returns focus to#kbMoreBtn; Up / Down cycle).kbMoreAction(fn)closes the menu first, then runs the action, so a dialog never opens under an open menu. - Strings:
knowledge.detail.more("More actions", the button'saria-labelandtitle).
Two actions on api/knowledge/knowledge_tags.php, Knowledge administrators only (knowledgeViewerHasAdminFloor()):
| Call | Does |
|---|---|
GET ?action=unused |
{tags: [{id, name}]} - the tags no article uses |
POST {action: 'delete_unused', ids: [...]} |
deletes those of the ids that are STILL unused; answers {deleted, kept}
|
$unusedSql = "FROM knowledge_tags t
WHERE NOT EXISTS (SELECT 1 FROM knowledge_article_tags kat WHERE kat.tag_id = t.id)";
...
$st = $conn->prepare("DELETE t $unusedSql AND t.id IN ($in)");-
"Unused" is decided on the server, from
knowledge_article_tagsacross every article - archived and drafts included. Never from the sidebar'sarticle_count, which uses the list's visibility clause (lifecycle => 'unarchived') and so leaves out archived articles and ones the viewer cannot read. -
The delete re-checks each id, so a tag that gained an article between the confirmation and the click is kept (
keptcounts it). - Tags have no company and no audit object type (
KNOWLEDGE_AUDIT_ACTIONScovers articles and folders), so nothing is written toknowledge_audit. - Client:
renderTagFilters()adds the.kb-tags-tidybutton whenkbCanManagePermsand some tag shows 0;loadFolders()re-renders the tags oncecan_manageis known.kbDeleteUnusedTags()asks for the list, confirms with the names (knowledge.tags.*), posts exactly those ids, drops any deleted tag fromactiveTagFiltersand reloads. - Test:
tests/knowledge-delete-unused-tags.php- through the real endpoint over HTTP (FREEITSM_TEST_URL,FREEITSM_SESS_DIR), committed ZZ fixtures deleted infinally, and it only ever sends its own tag ids. 11 checks, including a positive control that the sidebar really shows 0 for the archived-only tag.
knowledge/help.php section 3 described Draft โ Pending Review โ Approved โ Published, with Changes Requested. None of it existed: an article is is_published 0 or 1, and anyone who may edit it may publish it. The section now uses new keys (knowledge.help.kbreview_*, overview_card2b_*, nav_reviews), not reworded old ones, so the twelve other languages fall back to the correct English instead of keeping the old description until they are re-translated. The old review_* keys are unused except review_drafts. If an approval step is ever built (#466 stays open as the request), the help is rewritten with it.
- Knowledge โ folders and security โ the user-facing page
- Folders and permissions โ design reasoning, and what was ruled out
- Knowledge โ the module overall
- Mobile: Knowledge โ the phone layer
-
Folder soft delete, resizable panel and folder totals: Developer Guide โ
knowledge_folders.is_deleted, its readiness probe,initSidebarResize(),folderTotal() -
Knowledge review reminders: Developer Guide โ the
knowledge_review_remindersjob and theknowledge.review_duenotification -
Files - Developer Guide ยง 8 โ
FilesViewer.openUrls(), which the article pictures use
The pop-out (the โคข button on Edit article) lays the editor out as [editor | 340px side column]. The side column is .kb-editor-side, which holds the properties (.editor-properties) and the Documents, Domains and Projects block (.editor-documents) and scrolls as one. Outside the pop-out the wrapper is display: contents, and order keeps the normal page as properties, then the editor, then documents.
TRAP: anything new in the editor form goes INSIDE
.kb-editor-sideor the editor content, never loose in.editor-form. The documents block was added loose after the pop-out was designed, and in the pop-out's flex row it became an unsized third column that squeezed the editor into the middle of the screen (changelog #2750).TRAP: scope the rules to
.knowledge-container..editor-formis shared with Change Management, which keeps its block layout.
One level of box (#2751). In the pop-out the editor form has no card of its own, and the side column has no panels: the properties and the Domains and Projects blocks are plain sections, divided from the editor by the column's single border-left. Keep that line - without it Title and Tags read as part of the article, worst in dark mode where every surface is the same shade. The flattening overrides .dl-card and .pl-card from domain-links.css and project-links.css only inside .editor-popout .editor-documents, so those cards look unchanged everywhere else.
TRAP: never size
.tox-tinymcein the pop-out without:not(.tox-fullscreen). Full screen (TinyMCE's own button, and the footer's Full screen, which calls the samemceFullScreencommand) works by giving the editor an inline height. The pop-out'sheight: auto !important, which makes the editor fill its column, beat that inline height, so full screen collapsed to a 113px toolbar strip with the page showing through (#2752).