Skip to content

Commit

Permalink
修正
Browse files Browse the repository at this point in the history
  • Loading branch information
r74tech committed Nov 1, 2023
1 parent 6a743b6 commit e4df6ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/script/eventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ const handleEditpageInput = debounce((event) => {
const { target } = event;
if (!(target instanceof HTMLTextAreaElement)) return;

const value = target.value;
const type = "page";
const shortid = getCurrentPageShortId();

Expand Down
16 changes: 8 additions & 8 deletions src/script/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const handleMessage = (event) => {
};
const targetContent = document.getElementById(contentMapping[type]) || document.getElementById('page-content');
const cleanedHtml = html.replace(/<wj-body class="wj-body">/g, '').replace(/<\/wj-body>/g, '');

setInnerHtml(targetContent, cleanedHtml);

const pageStyles = document.getElementById('page-styles');
if (pageStyles) {
setInnerHtml(
pageStyles,
styles.map((v) => `<style>\n${v.replace(/</g, '&lt;')}\n</style>`).join('\n\n')
);
if (styles.length > 0 && pageStyles) {
styles.forEach((style: string) => {
const styleEl = document.createElement('style');
styleEl.textContent = style;
pageStyles.appendChild(styleEl);
});
}

setInnerHtml(targetContent, cleanedHtml);
};

ftml.onmessage = handleMessage;

0 comments on commit e4df6ed

Please sign in to comment.