Skip to content

Commit 542b090

Browse files
committed
feat: add support for shtml custom server live previews
1 parent 86eddec commit 542b090

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

src/extensions/default/HTMLCodeHints/integ-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ define(function (require, exports, module) {
311311
await closeSession();
312312
}
313313

314-
const extensions = ["html", "htm", "xhtml", "php", "asp", "aspx", "jsp"];
314+
const extensions = ["html", "htm", "xhtml", "php", "asp", "aspx", "jsp", "shtml"];
315315

316316
for(let extn of extensions){
317317
it(`should be able to add the class name by selecting the code hint in ${extn} file`, async function () {

src/extensionsIntegrated/Phoenix-live-preview/main.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ define(function (require, exports, module) {
676676
}
677677
const fullPath = changedFile.fullPath;
678678
if(changedFile && _shouldShowCustomServerBar(fullPath)){
679-
_showCustomServerBar();
679+
_showCustomServerBar(fullPath);
680680
}
681681
const shouldUseInbuiltPreview = utils.isMarkdownFile(fullPath) || utils.isSVG(fullPath);
682682
if(urlPinned || (LivePreviewSettings.isUsingCustomServer() &&
@@ -722,7 +722,7 @@ define(function (require, exports, module) {
722722
if(!editor || !_shouldShowCustomServerBar(editor.document.file.fullPath)){
723723
return;
724724
}
725-
_showCustomServerBar();
725+
_showCustomServerBar(editor.document.file.fullPath);
726726
}
727727

728728
function _shouldShowCustomServerBar(fullPath) {
@@ -734,14 +734,17 @@ define(function (require, exports, module) {
734734
return utils.isServerRenderedFile(fullPath);
735735
}
736736

737-
function _showCustomServerBar() {
737+
function _showCustomServerBar(fullFilePath) {
738738
if(customServerModalBar){
739+
$(".custom-banner-setup-server-text-message").html(
740+
StringUtils.format(Strings.LIVE_DEV_SETTINGS_BANNER, path.extname(fullFilePath))
741+
);
739742
return;
740743
}
741744
// Show the search bar
742745
const searchBarHTML =`<div style="display: flex;justify-content: end;align-items: baseline;">
743-
<div style="margin-right: 5px;">
744-
${Strings.LIVE_DEV_SETTINGS_BANNER}
746+
<div style="margin-right: 5px;" class="custom-banner-setup-server-text-message">
747+
${StringUtils.format(Strings.LIVE_DEV_SETTINGS_BANNER, path.extname(fullFilePath))}
745748
</div>
746749
<button class="btn btn-mini live-preview-settings" style="margin-right: 5px;">
747750
${Strings.LIVE_DEV_SETTINGS}

src/extensionsIntegrated/Phoenix-live-preview/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ define(function (require, exports, module) {
7979
function isServerRenderedFile(filePath) {
8080
let extension = getExtension(filePath);
8181
return [
82+
"shtml",
8283
"asp",
8384
"aspx",
8485
"php",

src/nls/root/strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ define({
159159
"LIVE_DEV_CLICK_TO_PIN_UNPIN": "Pin or Unpin Preview Page",
160160
"LIVE_DEV_STATUS_TIP_SYNC_ERROR": "Live Preview (not updating due to syntax error)",
161161
"LIVE_DEV_SETTINGS": "Live Preview Settings\u2026",
162-
"LIVE_DEV_SETTINGS_BANNER": "Set up a custom server to live preview PHP, JSP, and other server-rendered files",
162+
"LIVE_DEV_SETTINGS_BANNER": "Set up a custom server to live preview `<b>{0}</b>` and other server-rendered files (PHP, JSP, etc.)",
163163
"LIVE_DEV_SETTINGS_TITLE": "Live Preview Settings",
164164
"LIVE_DEV_SETTINGS_STARTUP": "Show Live Preview Panel at Startup",
165165
"LIVE_DEV_SETTINGS_SERVER_PREFERENCE": "true to enable custom development server",

test/spec/Extn-HTMLCodeHints-Lint-integ-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ define(function (require, exports, module) {
179179
await SpecRunnerUtils.deletePathAsync(validNameJSON, true, FileSystem);
180180
}, 6000);
181181

182-
const testExtensions = [".htm", ".xhtml", ".jsp", ".asp", ".aspx", ".php"];
182+
const testExtensions = [".htm", ".xhtml", ".shtml", ".jsp", ".asp", ".aspx", ".php"];
183183
for(let testExtension of testExtensions) {
184184
// eslint-disable-next-line no-loop-func
185185
it(`should show html lint error in ${testExtension} files`, async function () {

test/spec/LiveDevelopmentCustomServer-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ define(function (require, exports, module) {
535535
}, 30000);
536536

537537
const SERVER_FILES = [
538+
"shtml",
538539
"asp",
539540
"aspx",
540541
"php",

0 commit comments

Comments
 (0)