-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sets the editor content decorator script helpers in the window object. (
#1290) * Updated the headerlinks script to attach the helper function to the window object. * Updated the codeblock highlight script to append the helper function to the window object. * Updated the documentation.
- Loading branch information
1 parent
516b2b0
commit 298353c
Showing
3 changed files
with
60 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// eslint-disable-next-line @bigbinary/neeto/file-name-and-export-name-standards | ||
import { buildHeaderLinks } from "./utils/headers"; | ||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
const applyDecorations = () => { | ||
const editorContent = document.querySelector(".neeto-editor-content"); | ||
|
||
if (editorContent) buildHeaderLinks(editorContent); | ||
}); | ||
}; | ||
|
||
(() => { | ||
if (document.readyState === "loading") { | ||
document.addEventListener("DOMContentLoaded", applyDecorations); | ||
} else applyDecorations(); | ||
|
||
window.neetoEditor = window.neetoEditor ?? {}; | ||
window.neetoEditor.applyHeaderDecorations = applyDecorations; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters