mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-18 12:31:12 +02:00
fix dynamic resource paths and also html generation logic
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
<link rel="stylesheet" href="lib/hint.min.css">
|
<link rel="stylesheet" href="lib/hint.min.css">
|
||||||
<link rel="stylesheet" href="lib/inlet.css">
|
<link rel="stylesheet" href="lib/inlet.css">
|
||||||
<!-- endbuild -->
|
<!-- endbuild -->
|
||||||
|
|
||||||
<link rel="stylesheet" id="editorThemeLinkTag" href="/lib/codemirror/theme/monokai.css"></link>
|
<link rel="stylesheet" id="editorThemeLinkTag" href="lib/codemirror/theme/monokai.css"></link>
|
||||||
|
|
||||||
<!-- build:css style.css -->
|
<!-- build:css style.css -->
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
font-family: 'fontname';
|
font-family: 'fontname';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(../fontname.ttf) format('truetype');
|
src: url(fontname.ttf) format('truetype');
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||||
}
|
}
|
||||||
.Codemirror pre {
|
.Codemirror pre {
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
font-family: 'FiraCode';
|
font-family: 'FiraCode';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(../FiraCode.ttf) format('truetype');
|
src: url(FiraCode.ttf) format('truetype');
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||||
}
|
}
|
||||||
.Codemirror pre {
|
.Codemirror pre {
|
||||||
|
@@ -101,6 +101,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AUTO_SAVE_INTERVAL = 15000; // 15 seconds
|
const AUTO_SAVE_INTERVAL = 15000; // 15 seconds
|
||||||
|
const BASE_PATH = chrome.extension ? '/' : '/dist/';
|
||||||
|
|
||||||
var updateTimer,
|
var updateTimer,
|
||||||
updateDelay = 500,
|
updateDelay = 500,
|
||||||
@@ -996,7 +997,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
'<script src="' +
|
'<script src="' +
|
||||||
(chrome.extension
|
(chrome.extension
|
||||||
? chrome.extension.getURL('lib/screenlog.js')
|
? chrome.extension.getURL('lib/screenlog.js')
|
||||||
: `${location.origin}/lib/screenlog.js`) +
|
: `${location.origin}/${BASE_PATH}/lib/screenlog.js`) +
|
||||||
'"></script>';
|
'"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1008,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
'"></script>';
|
'"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (js !== undefined) {
|
if (typeof js === 'string') {
|
||||||
contents += '<script>\n' + js + '\n//# sourceURL=userscript.js';
|
contents += '<script>\n' + js + '\n//# sourceURL=userscript.js';
|
||||||
} else {
|
} else {
|
||||||
var origin = chrome.i18n.getMessage()
|
var origin = chrome.i18n.getMessage()
|
||||||
@@ -1076,7 +1077,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
|
|
||||||
function createPreviewFile(html, css, js) {
|
function createPreviewFile(html, css, js) {
|
||||||
const shouldInlineJs = !window.webkitRequestFileSystem;
|
const shouldInlineJs = !window.webkitRequestFileSystem;
|
||||||
var contents = getCompleteHtml(html, css, shouldInlineJs ? js : '');
|
var contents = getCompleteHtml(html, css, shouldInlineJs ? js : null);
|
||||||
var blob = new Blob([contents], { type: 'text/plain;charset=UTF-8' });
|
var blob = new Blob([contents], { type: 'text/plain;charset=UTF-8' });
|
||||||
var blobjs = new Blob([js], { type: 'text/plain;charset=UTF-8' });
|
var blobjs = new Blob([js], { type: 'text/plain;charset=UTF-8' });
|
||||||
|
|
||||||
@@ -1721,8 +1722,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
indentationSizeValueEl.textContent = $('[data-setting=indentSize]').value;
|
indentationSizeValueEl.textContent = $('[data-setting=indentSize]').value;
|
||||||
|
|
||||||
// Replace correct css file in LINK tags's href
|
// Replace correct css file in LINK tags's href
|
||||||
editorThemeLinkTag.href =
|
editorThemeLinkTag.href = `lib/codemirror/theme/${prefs.editorTheme}.css`;
|
||||||
'/lib/codemirror/theme/' + prefs.editorTheme + '.css';
|
|
||||||
fontStyleTag.textContent = fontStyleTemplate.textContent.replace(
|
fontStyleTag.textContent = fontStyleTemplate.textContent.replace(
|
||||||
/fontname/g,
|
/fontname/g,
|
||||||
(prefs.editorFont === 'other'
|
(prefs.editorFont === 'other'
|
||||||
@@ -1999,7 +1999,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
|||||||
function init() {
|
function init() {
|
||||||
var lastCode;
|
var lastCode;
|
||||||
|
|
||||||
CodeMirror.modeURL = 'lib/codemirror/mode/%N/%N.js';
|
CodeMirror.modeURL = `${BASE_PATH}/lib/codemirror/mode/%N/%N.js`;
|
||||||
|
|
||||||
function getToggleLayoutButtonListener(mode) {
|
function getToggleLayoutButtonListener(mode) {
|
||||||
return function() {
|
return function() {
|
||||||
|
Reference in New Issue
Block a user