Skip to content

Commit 9a8ffe3

Browse files
committed
refactor: remote icons as remote fn constants instead of config
1 parent 497424e commit 9a8ffe3

File tree

5 files changed

+166
-149
lines changed

5 files changed

+166
-149
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
/*jslint forin: true */
23-
/*global Node, MessageEvent, strings */
23+
/*global Node, MessageEvent, strings, icons */
2424
/*theseus instrument: false */
2525

2626
/**
@@ -1760,40 +1760,40 @@ function RemoteFunctions(config = {}) {
17601760
// Only include select parent option if element supports it
17611761
if (showSelectParentOption) {
17621762
content += `<span data-action="select-parent" title="${strings.selectParent}">
1763-
${config.icons.arrowUp}
1763+
${icons.arrowUp}
17641764
</span>`;
17651765
}
17661766

17671767
// Only include edit text option if element supports it
17681768
if (showEditTextOption) {
17691769
content += `<span data-action="edit-text" title="${strings.editText}">
1770-
${config.icons.edit}
1770+
${icons.edit}
17711771
</span>`;
17721772
}
17731773

17741774
// if its a link element, we show the edit hyperlink icon
17751775
if (this.element && this.element.tagName.toLowerCase() === 'a') {
17761776
content += `<span data-action="edit-hyperlink" title="${strings.editHyperlink}">
1777-
${config.icons.link}
1777+
${icons.link}
17781778
</span>`;
17791779
}
17801780

17811781
// if its an image element, we show the image gallery icon
17821782
if (this.element && this.element.tagName.toLowerCase() === 'img') {
17831783
content += `<span data-action="image-gallery" title="${strings.imageGallery}">
1784-
${config.icons.imageGallery}
1784+
${icons.imageGallery}
17851785
</span>`;
17861786
}
17871787

17881788
// Always include duplicate and delete options
17891789
content += `<span data-action="duplicate" title="${strings.duplicate}">
1790-
${config.icons.duplicate}
1790+
${icons.duplicate}
17911791
</span>
17921792
<span data-action="delete" title="${strings.delete}">
1793-
${config.icons.trash}
1793+
${icons.trash}
17941794
</span>
17951795
<span data-action="more-options" title="${strings.moreOptions}">
1796-
${config.icons.verticalEllipsis}
1796+
${icons.verticalEllipsis}
17971797
</span>
17981798
</div>`;
17991799

@@ -1895,7 +1895,7 @@ function RemoteFunctions(config = {}) {
18951895
</style>
18961896
<div class="hyperlink-input-box">
18971897
<div class="link-icon" title="${currentHref.trim() || strings.hyperlinkNoHref}">
1898-
${config.icons.link}
1898+
${icons.link}
18991899
</div>
19001900
<input type="text" value="${currentHref.trim()}" placeholder="https://example.com" spellcheck="false" />
19011901
</div>
@@ -2113,22 +2113,22 @@ function RemoteFunctions(config = {}) {
21132113
let content = `
21142114
<div class="more-options-dropdown">
21152115
<div class="dropdown-item" data-action="cut">
2116-
<span class="item-icon">${config.icons.cut}</span>
2116+
<span class="item-icon">${icons.cut}</span>
21172117
<span class="item-label">${strings.cut}</span>
21182118
</div>
21192119
<div class="dropdown-item" data-action="copy">
2120-
<span class="item-icon">${config.icons.copy}</span>
2120+
<span class="item-icon">${icons.copy}</span>
21212121
<span class="item-label">${strings.copy}</span>
21222122
</div>
21232123
<div class="dropdown-item" data-action="paste">
2124-
<span class="item-icon">${config.icons.paste}</span>
2124+
<span class="item-icon">${icons.paste}</span>
21252125
<span class="item-label">${strings.paste}</span>
21262126
</div>
21272127
<div class="dropdown-separator"></div>
21282128
<div class="dropdown-item" data-action="toggle-ruler-lines">
2129-
<span class="item-icon">${config.icons.ruler}</span>
2129+
<span class="item-icon">${icons.ruler}</span>
21302130
<span class="item-label show-ruler-label">${strings.showRulerLines}</span>
2131-
<span class="item-checkmark" style="visibility: ${config.showRulerLines ? 'visible' : 'hidden'}">${config.icons.check}</span>
2131+
<span class="item-checkmark" style="visibility: ${config.showRulerLines ? 'visible' : 'hidden'}">${icons.check}</span>
21322132
</div>
21332133
</div>
21342134
`;
@@ -2255,7 +2255,7 @@ function RemoteFunctions(config = {}) {
22552255
if (displayHref.length > 35) {
22562256
displayHref = displayHref.substring(0, 35) + '...';
22572257
}
2258-
content += `<div class='href-info'>${config.icons.link} ${displayHref}</div>`;
2258+
content += `<div class='href-info'>${icons.link} ${displayHref}</div>`;
22592259
}
22602260
}
22612261

@@ -2380,7 +2380,7 @@ function RemoteFunctions(config = {}) {
23802380
<option value="slow">Slow AI</option>
23812381
</select>
23822382
<button class="phoenix-ai-prompt-send-button" disabled>
2383-
${config.icons.paperPlane}
2383+
${icons.paperPlane}
23842384
</button>
23852385
</div>
23862386
</div>
@@ -2614,7 +2614,7 @@ function RemoteFunctions(config = {}) {
26142614
<div class='phoenix-image-gallery-header'>
26152615
<div class='phoenix-image-gallery-header-title'>
26162616
<div class='phoenix-image-gallery-header-icon'>
2617-
${config.icons.imageGallery}
2617+
${icons.imageGallery}
26182618
</div>
26192619
<div class='phoenix-image-gallery-header-text'>
26202620
${strings.imageGallery}
@@ -2623,7 +2623,7 @@ function RemoteFunctions(config = {}) {
26232623
26242624
<div class="phoenix-image-gallery-search-container">
26252625
<div class="search-wrapper">
2626-
<button class="search-icon" title="${strings.imageGallerySearchButton}">${config.icons.search}</button>
2626+
<button class="search-icon" title="${strings.imageGallerySearchButton}">${icons.search}</button>
26272627
<input
26282628
type="text"
26292629
placeholder="${strings.imageGallerySearchPlaceholder}"
@@ -2632,17 +2632,17 @@ function RemoteFunctions(config = {}) {
26322632
</div>
26332633
26342634
<div class='phoenix-image-gallery-upload-container'>
2635-
<button title="${strings.imageGallerySelectFromComputerTooltip}">${config.icons.selectImageFromComputer} ${strings.imageGallerySelectFromComputer}</button>
2635+
<button title="${strings.imageGallerySelectFromComputerTooltip}">${icons.selectImageFromComputer} ${strings.imageGallerySelectFromComputer}</button>
26362636
<input type="file" class="phoenix-file-input" accept="image/*" style="display: none !important;">
26372637
</div>
26382638
26392639
<div class='phoenix-image-gallery-right-buttons'>
26402640
<button class='phoenix-image-gallery-download-folder-button' title="${strings.imageGallerySelectDownloadFolder}">
2641-
${config.icons.folderSettings}
2641+
${icons.folderSettings}
26422642
</button>
26432643
26442644
<button class='phoenix-image-gallery-close-button' title="${strings.imageGalleryClose}">
2645-
${config.icons.close}
2645+
${icons.close}
26462646
</button>
26472647
</div>
26482648
</div>
@@ -3112,7 +3112,7 @@ function RemoteFunctions(config = {}) {
31123112
const downloadIcon = window.document.createElement('div');
31133113
downloadIcon.className = 'phoenix-download-icon';
31143114
downloadIcon.title = strings.imageGalleryUseImage;
3115-
downloadIcon.innerHTML = config.icons.downloadImage;
3115+
downloadIcon.innerHTML = icons.downloadImage;
31163116

31173117
// when the image is clicked we download the image
31183118
thumbDiv.addEventListener('click', (e) => {
@@ -3317,7 +3317,7 @@ function RemoteFunctions(config = {}) {
33173317
<div class="phoenix-hot-corner">
33183318
<div class="hot-corner-indicator"></div>
33193319
<div class="hot-corner-box">
3320-
<button class="hot-corner-play-btn"> ${config.icons.playButton} </button>
3320+
<button class="hot-corner-play-btn"> ${icons.playButton} </button>
33213321
</div>
33223322
</div>`;
33233323

0 commit comments

Comments
 (0)