mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 16:46:48 +01:00
Live editing of CSS files
Tries to find CSS files in the stickyTab shown window. If it does it appends a new stylesheet to it as you type.
This commit is contained in:
17
editor.php
17
editor.php
@@ -181,10 +181,23 @@ function createNewCMInstance(num) {
|
||||
}
|
||||
// Update HTML edited files live
|
||||
if (top.ICEcoder.stickyTab.location) {
|
||||
var filename = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
|
||||
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
|
||||
if (["htm","html"].indexOf(fileExt) > -1) {
|
||||
if (["htm","html","txt"].indexOf(fileExt) > -1) {
|
||||
top.ICEcoder.stickyTab.document.documentElement.innerHTML = window['cM'+num].getValue();
|
||||
} else if (["css"].indexOf(fileExt) > -1) {
|
||||
if (top.ICEcoder.stickyTab.document.documentElement.innerHTML.indexOf(filename) > -1) {
|
||||
var css = window['cM'+num].getValue();
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
top.ICEcoder.stickyTab.document.documentElement.appendChild(style);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user