1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-25 07:51:12 +02:00

mv3 code changes

This commit is contained in:
Kushagra Gour
2024-02-20 10:59:51 +05:30
parent 831cfd74e5
commit 24cdf7ef7c
4 changed files with 31 additions and 29 deletions

View File

@@ -54,12 +54,10 @@ export default class ContentWrapFiles extends Component {
// `clearConsole` is on window because it gets called from inside iframe also. // `clearConsole` is on window because it gets called from inside iframe also.
window.clearConsole = this.clearConsole.bind(this); window.clearConsole = this.clearConsole.bind(this);
this.consoleHeaderDblClickHandler = this.consoleHeaderDblClickHandler.bind( this.consoleHeaderDblClickHandler =
this this.consoleHeaderDblClickHandler.bind(this);
); this.clearConsoleBtnClickHandler =
this.clearConsoleBtnClickHandler = this.clearConsoleBtnClickHandler.bind( this.clearConsoleBtnClickHandler.bind(this);
this
);
this.toggleConsole = this.toggleConsole.bind(this); this.toggleConsole = this.toggleConsole.bind(this);
this.evalConsoleExpr = this.evalConsoleExpr.bind(this); this.evalConsoleExpr = this.evalConsoleExpr.bind(this);
} }
@@ -259,7 +257,7 @@ export default class ContentWrapFiles extends Component {
obj[file.path] = obj[file.path] =
'<script src="' + '<script src="' +
(chrome.extension (chrome.extension
? chrome.extension.getURL('lib/screenlog.js') ? chrome.runtime.getURL('lib/screenlog.js')
: `${location.origin}${ : `${location.origin}${
window.DEBUG ? '' : BASE_PATH window.DEBUG ? '' : BASE_PATH
}/lib/screenlog.js`) + }/lib/screenlog.js`) +
@@ -360,12 +358,13 @@ export default class ContentWrapFiles extends Component {
window.editorThemeLinkTag.href = `lib/codemirror/theme/${prefs.editorTheme}.css`; window.editorThemeLinkTag.href = `lib/codemirror/theme/${prefs.editorTheme}.css`;
} }
window.fontStyleTag.textContent = window.fontStyleTemplate.textContent.replace( window.fontStyleTag.textContent =
/fontname/g, window.fontStyleTemplate.textContent.replace(
(prefs.editorFont === 'other' /fontname/g,
? prefs.editorCustomFont (prefs.editorFont === 'other'
: prefs.editorFont) || 'FiraCode' ? prefs.editorCustomFont
); : prefs.editorFont) || 'FiraCode'
);
} }
// Check all the code wrap if they are minimized or maximized // Check all the code wrap if they are minimized or maximized
@@ -376,7 +375,7 @@ export default class ContentWrapFiles extends Component {
const { currentLayoutMode } = this.props; const { currentLayoutMode } = this.props;
const prop = const prop =
currentLayoutMode === 2 || currentLayoutMode === 5 ? 'width' : 'height'; currentLayoutMode === 2 || currentLayoutMode === 5 ? 'width' : 'height';
[htmlCodeEl].forEach(function(el) { [htmlCodeEl].forEach(function (el) {
const bounds = el.getBoundingClientRect(); const bounds = el.getBoundingClientRect();
const size = bounds[prop]; const size = bounds[prop];
if (size < 100) { if (size < 100) {

View File

@@ -1,16 +1,16 @@
function openApp() { function openApp() {
chrome.tabs.create({ chrome.tabs.create({
url: chrome.extension.getURL('index.html'), url: chrome.runtime.getURL('index.html'),
selected: true selected: true
}); });
} }
chrome.browserAction.onClicked.addListener(function() { chrome.action.onClicked.addListener(function () {
openApp(); openApp();
}); });
// Listen for tabs getting created. // Listen for tabs getting created.
chrome.tabs.onCreated.addListener(function(tab) { chrome.tabs.onCreated.addListener(function (tab) {
// If a new tab is opened (without any URL), check user's // If a new tab is opened (without any URL), check user's
// replace Tab setting and act accordingly. Default is false. // replace Tab setting and act accordingly. Default is false.
if (tab.url === 'chrome://newtab/') { if (tab.url === 'chrome://newtab/') {
@@ -18,12 +18,12 @@ chrome.tabs.onCreated.addListener(function(tab) {
{ {
replaceNewTab: false replaceNewTab: false
}, },
function(items) { function (items) {
if (items.replaceNewTab) { if (items.replaceNewTab) {
chrome.tabs.update( chrome.tabs.update(
tab.id, tab.id,
{ {
url: chrome.extension.getURL('index.html') url: chrome.runtime.getURL('index.html')
}, },
function callback() { function callback() {
console.log('ho gaya'); console.log('ho gaya');

View File

@@ -1,23 +1,26 @@
{ {
"name": "Web Maker", "name": "Web Maker",
"version": "5.2.0", "version": "5.2.0",
"manifest_version": 2, "manifest_version": 3,
"description": "Blazing fast & offline playground for your web experiments", "description": "Blazing fast & offline playground for your web experiments",
"homepage_url": "https://webmaker.app", "homepage_url": "https://webmaker.app",
"permissions": ["storage", "tabs", "<all_urls>"], "permissions": ["storage", "tabs"],
"optional_permissions": ["downloads"], "optional_permissions": ["downloads"],
"content_security_policy": "script-src 'self' filesystem: http://localhost:* https://localhost:* https://apis.google.com https://ajax.googleapis.com https://code.jquery.com https://cdnjs.cloudflare.com https://unpkg.com https://maxcdn.com https://cdn77.com https://maxcdn.bootstrapcdn.com https://cdn.jsdelivr.net/ https://*.stripe.com/ https://builds.framerjs.com/ https://rawgit.com https://wzrd.in https://www.gstatic.com https://semantic-ui.com https://www.google-analytics.com https://cdn.tailwindcss.com 'unsafe-eval'; object-src 'self'", "host_permissions": ["<all_urls>"],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
},
"options_ui": { "options_ui": {
"page": "options.html", "page": "options.html",
"chrome_style": true "open_in_tab": false
}, },
"browser_action": { "action": {
"default_title": "Start Web Maker", "default_title": "Start Web Maker",
"default_icon": "icon-16.png" "default_icon": "icon-16.png"
}, },
"background": { "background": {
"scripts": ["eventPage.js"], "service_worker": "eventPage.js",
"persistent": false "type": "module"
}, },
"icons": { "icons": {
"16": "icon-16.png", "16": "icon-16.png",

View File

@@ -377,7 +377,7 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
contents += contents +=
'<script src="' + '<script src="' +
(chrome.extension (chrome.extension
? chrome.extension.getURL('lib/screenlog.js') ? chrome.runtime.getURL('lib/screenlog.js')
: `${location.origin}${ : `${location.origin}${
window.DEBUG ? '' : BASE_PATH window.DEBUG ? '' : BASE_PATH
}/lib/screenlog.js`) + }/lib/screenlog.js`) +
@@ -388,7 +388,7 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
contents += contents +=
'<script src="' + '<script src="' +
(chrome.extension (chrome.extension
? chrome.extension.getURL('lib/transpilers/babel-polyfill.min.js') ? chrome.runtime.getURL('lib/transpilers/babel-polyfill.min.js')
: `${location.origin}${BASE_PATH}/lib/transpilers/babel-polyfill.min.js`) + : `${location.origin}${BASE_PATH}/lib/transpilers/babel-polyfill.min.js`) +
'"></script>'; '"></script>';
} }
@@ -495,7 +495,7 @@ export function prettify({ file, content, type }) {
} }
const worker = new Worker( const worker = new Worker(
chrome.extension chrome.extension
? chrome.extension.getURL('lib/prettier-worker.js') ? chrome.runtime.getURL('lib/prettier-worker.js')
: `${BASE_PATH !== '/' ? BASE_PATH : ''}/lib/prettier-worker.js` : `${BASE_PATH !== '/' ? BASE_PATH : ''}/lib/prettier-worker.js`
); );
worker.postMessage({ content, type }); worker.postMessage({ content, type });