-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 new element content-edit to add annotations in pages rel=#75
- Loading branch information
Showing
4 changed files
with
117 additions
and
18 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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* RenoirBoulanger.com client-side boostraptator. thing. | ||
* | ||
* #WIP-Mingle-CustomElements-From-ESM-Modules: Added on 2024-09-18 during migration. | ||
*/ | ||
|
||
import { registerCustomElement } from 'https://renoirb.com/esm-modules/element-utils.mjs' | ||
|
||
const ELEMENTS = [ | ||
['rb-notice-box', import('https://renoirb.com/esm-modules/notice-box-element.mjs')], | ||
] | ||
|
||
/** | ||
* This should work for file:/// URLs | ||
* (assuming it's supported, Safari does, not Chromium thus far 2023-02-03) | ||
*/ | ||
const SITE_ROOT_BASE_URL = await import.meta.url?.replace('main.mjs', '') | ||
|
||
/** | ||
* Do things here. | ||
* rel=#WIP-Mingle-CustomElements-From-ESM-Modules | ||
*/ | ||
const main = async () => { | ||
|
||
ELEMENTS.push( | ||
['rb-content-edit', import(`${SITE_ROOT_BASE_URL}esm-modules/element-content-edit/0.1.0/index.mjs`)], | ||
) | ||
|
||
await Promise.resolve() | ||
const errors = [] | ||
ELEMENTS.forEach(async ([elementName, importator]) => { | ||
const closature = await importator | ||
try { | ||
registerCustomElement(window, elementName, closature.default) | ||
} catch (_) { | ||
const message = `Element ${elementName} is already loaded` | ||
errors.push(message) | ||
} | ||
}) | ||
|
||
if (errors.length > 0) { | ||
errors.forEach((msg) => { | ||
console.error(msg) | ||
}) | ||
} | ||
} | ||
|
||
|
||
// ---------------------------------------------------------------------------- | ||
main().catch(e => { | ||
console.error(`Something went wrong`, e) | ||
}) |