Loading pre-save_script.js +16 −10 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ const puppeteer = require("puppeteer"); await client.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath, eventsEnabled: true eventsEnabled: true, }); // Wait for the download to complete (adjust timeout as necessary) client.on("Browser.downloadProgress", (e) => { Loading @@ -36,7 +36,6 @@ const puppeteer = require("puppeteer"); } }); // Adjust this path to the directory containing your HTML files const directoryPath = __dirname; Loading @@ -59,13 +58,20 @@ const puppeteer = require("puppeteer"); await page.click(".switch"); // Simulate turning the switch on // Wait for CKEditor5 to initialize await page.waitForSelector(".ck-editor__editable"); try { const editor = await page.waitForSelector(".ck-editor__editable", { timeout: 5000, }); // CKEditor operations here } catch (error) { console.log("CKEditor not found, skipping editor operations"); // Continue with other operations } // Trigger the save/download button await page.waitForSelector("#download_btn"); // Adjust selector for your save button await page.click("#download_btn"); // Simulate clicking the save button console.log(`Processed and triggered download for: ${file}`); } } Loading Loading
pre-save_script.js +16 −10 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ const puppeteer = require("puppeteer"); await client.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath, eventsEnabled: true eventsEnabled: true, }); // Wait for the download to complete (adjust timeout as necessary) client.on("Browser.downloadProgress", (e) => { Loading @@ -36,7 +36,6 @@ const puppeteer = require("puppeteer"); } }); // Adjust this path to the directory containing your HTML files const directoryPath = __dirname; Loading @@ -59,13 +58,20 @@ const puppeteer = require("puppeteer"); await page.click(".switch"); // Simulate turning the switch on // Wait for CKEditor5 to initialize await page.waitForSelector(".ck-editor__editable"); try { const editor = await page.waitForSelector(".ck-editor__editable", { timeout: 5000, }); // CKEditor operations here } catch (error) { console.log("CKEditor not found, skipping editor operations"); // Continue with other operations } // Trigger the save/download button await page.waitForSelector("#download_btn"); // Adjust selector for your save button await page.click("#download_btn"); // Simulate clicking the save button console.log(`Processed and triggered download for: ${file}`); } } Loading