Skip to content

Commit 7fc5c23

Browse files
committed
Fixes to comment based on cursor pos
Identify CSS <style> blocks Only if we didn't identify caretLocType and have a fileName do we go by file extension
1 parent edc9f85 commit 7fc5c23

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

processes/on-editor-load.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@
160160
if(caretChunk.lastIndexOf("<script")>caretChunk.lastIndexOf("/script>")&&caretLocType=="Unknown") {caretLocType = "JavaScript";}
161161
else if (caretChunk.lastIndexOf("<?")>caretChunk.lastIndexOf("?>")&&caretLocType=="Unknown") {caretLocType = "PHP";}
162162
else if (caretChunk.lastIndexOf("<%")>caretChunk.lastIndexOf("%>")&&caretLocType=="Unknown") {caretLocType = "Ruby";}
163+
else if (caretChunk.lastIndexOf("<style")>caretChunk.lastIndexOf("/style>")&&caretLocType=="Unknown") {caretLocType = "CSS";}
163164
else if (caretChunk.lastIndexOf("<")>caretChunk.lastIndexOf(">")&&caretLocType=="Unknown") {caretLocType = "HTML";}
164165
else if (caretLocType=="Unknown") {caretLocType = "Content";};
165166

166167
fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
167-
if (fileName) {
168+
if (caretLocType == "Content" && fileName) {
168169
fileExt = fileName.split(".");
169170
fileExt = fileExt[fileExt.length-1];
170171
caretLocType =

0 commit comments

Comments
 (0)