Skip to content

Commit

Permalink
run all existing register smart blocks commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dvargas92495 committed Jul 14, 2021
1 parent 1352f23 commit f55d1ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ runExtension("smartblocks", () => {
const isCustomOnly = tree.some((t) =>
toFlexRegex("custom only").test(t.text)
);

window.roamjs.extension.smartblocks = {};
window.roamjs.extension.smartblocks.registerCommand = ({
text,
Expand All @@ -150,6 +151,13 @@ runExtension("smartblocks", () => {
}) => {
handlerByCommand[text] = handler;
};
Object.keys(window.roamjs.extension).forEach((text) => {
if (window.roamjs.extension[text].registerSmartBlocksCommand) {
window.roamjs.extension[text].registerSmartBlocksCommand();
delete window.roamjs.extension[text];
}
});

document.addEventListener("input", (e) => {
const target = e.target as HTMLElement;
if (
Expand Down

0 comments on commit f55d1ab

Please sign in to comment.