|
30 | 30 | */ |
31 | 31 | function RemoteFunctions(config) { |
32 | 32 |
|
33 | | - // this is responsible to make the advanced live preview features active or inactive |
34 | | - let isLPEditFeaturesActive = false; |
35 | | - |
36 | 33 | // this will store the element that was clicked previously (before the new click) |
37 | 34 | // we need this so that we can remove click styling from the previous element when a new element is clicked |
38 | 35 | let previouslyClickedElement = null; |
@@ -641,7 +638,7 @@ function RemoteFunctions(config) { |
641 | 638 | create: function() { |
642 | 639 | this.remove(); // remove existing box if already present |
643 | 640 |
|
644 | | - if(!isLPEditFeaturesActive) { |
| 641 | + if(!config.isLPEditFeaturesActive) { |
645 | 642 | return; |
646 | 643 | } |
647 | 644 |
|
@@ -834,7 +831,7 @@ function RemoteFunctions(config) { |
834 | 831 | create: function() { |
835 | 832 | this.remove(); // remove existing box if already present |
836 | 833 |
|
837 | | - if(!isLPEditFeaturesActive) { |
| 834 | + if(!config.isLPEditFeaturesActive) { |
838 | 835 | return; |
839 | 836 | } |
840 | 837 |
|
@@ -1205,7 +1202,7 @@ function RemoteFunctions(config) { |
1205 | 1202 | } |
1206 | 1203 |
|
1207 | 1204 | function onElementHover(event) { |
1208 | | - if (_hoverHighlight && isLPEditFeaturesActive) { |
| 1205 | + if (_hoverHighlight && config.isLPEditFeaturesActive) { |
1209 | 1206 | _hoverHighlight.clear(); |
1210 | 1207 |
|
1211 | 1208 | // Skip highlighting for HTML and BODY tags and for DOM elements which doesn't have 'data-brackets-id' |
@@ -1236,7 +1233,7 @@ function RemoteFunctions(config) { |
1236 | 1233 | } |
1237 | 1234 |
|
1238 | 1235 | function onElementHoverOut(event) { |
1239 | | - if (_hoverHighlight && isLPEditFeaturesActive) { |
| 1236 | + if (_hoverHighlight && config.isLPEditFeaturesActive) { |
1240 | 1237 | _hoverHighlight.clear(); |
1241 | 1238 |
|
1242 | 1239 | // Restore original background color |
@@ -1265,7 +1262,7 @@ function RemoteFunctions(config) { |
1265 | 1262 | function onClick(event) { |
1266 | 1263 | // make sure that the feature is enabled and also the clicked element has the attribute 'data-brackets-id' |
1267 | 1264 | if ( |
1268 | | - isLPEditFeaturesActive && |
| 1265 | + config.isLPEditFeaturesActive && |
1269 | 1266 | event.target.hasAttribute("data-brackets-id") && |
1270 | 1267 | event.target.tagName !== "BODY" && |
1271 | 1268 | event.target.tagName !== "HTML" |
@@ -1314,7 +1311,7 @@ function RemoteFunctions(config) { |
1314 | 1311 | */ |
1315 | 1312 | function onDoubleClick(event) { |
1316 | 1313 | if ( |
1317 | | - isLPEditFeaturesActive && |
| 1314 | + config.isLPEditFeaturesActive && |
1318 | 1315 | event.target.hasAttribute("data-brackets-id") && |
1319 | 1316 | event.target.tagName !== "BODY" && |
1320 | 1317 | event.target.tagName !== "HTML" |
@@ -1786,7 +1783,7 @@ function RemoteFunctions(config) { |
1786 | 1783 |
|
1787 | 1784 | // Function to handle direct editing of elements in the live preview |
1788 | 1785 | function startEditing(element) { |
1789 | | - if (!isLPEditFeaturesActive |
| 1786 | + if (!config.isLPEditFeaturesActive |
1790 | 1787 | || !element |
1791 | 1788 | || element.tagName === "BODY" |
1792 | 1789 | || element.tagName === "HTML" |
@@ -1835,7 +1832,7 @@ function RemoteFunctions(config) { |
1835 | 1832 | // Function to finish editing and apply changes |
1836 | 1833 | // isEditSuccessful: this is a boolean value, defaults to true. false only when the edit operation is cancelled |
1837 | 1834 | function finishEditing(element, isEditSuccessful = true) { |
1838 | | - if (!isLPEditFeaturesActive || !element || !element.hasAttribute("contenteditable")) { |
| 1835 | + if (!config.isLPEditFeaturesActive || !element || !element.hasAttribute("contenteditable")) { |
1839 | 1836 | return; |
1840 | 1837 | } |
1841 | 1838 |
|
@@ -1866,7 +1863,7 @@ function RemoteFunctions(config) { |
1866 | 1863 | // init |
1867 | 1864 | _editHandler = new DOMEditHandler(window.document); |
1868 | 1865 |
|
1869 | | - if (isLPEditFeaturesActive) { |
| 1866 | + if (config.isLPEditFeaturesActive) { |
1870 | 1867 | // Initialize hover highlight with Chrome-like colors |
1871 | 1868 | _hoverHighlight = new Highlight("#c8f9c5", true); // Green similar to Chrome's padding color |
1872 | 1869 |
|
|
0 commit comments