diff options
9 files changed, 55 insertions, 26 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 44ca50e1..aa5a4e7f 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -94,11 +94,18 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
94 | // Returns null if sheet not found (as in non-ninja projects) | 94 | // Returns null if sheet not found (as in non-ninja projects) |
95 | // Setter will handle null case | 95 | // Setter will handle null case |
96 | this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); | 96 | this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); |
97 | 97 | ||
98 | //debugger; | 98 | this.userStyleSheets = nj.toArray(document._document.styleSheets).filter(function(sheet) { |
99 | return sheet !== this._stageStylesheet; | ||
100 | }, this); | ||
101 | |||
102 | NJevent('styleSheetsReady', this); | ||
99 | }, | 103 | }, |
100 | enumerable : false | 104 | enumerable : false |
101 | }, | 105 | }, |
106 | userStyleSheets : { | ||
107 | value : null | ||
108 | }, | ||
102 | _stageStylesheet : { | 109 | _stageStylesheet : { |
103 | value : null | 110 | value : null |
104 | }, | 111 | }, |
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 887743c5..49dfd706 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -19,16 +19,18 @@ exports.NJUtils = Object.create(Object.prototype, { | |||
19 | 19 | ||
20 | ///// Quick "getElementById" | 20 | ///// Quick "getElementById" |
21 | $ : { | 21 | $ : { |
22 | value: function(id) { | 22 | value: function(id, doc) { |
23 | return document.getElementById(id); | 23 | doc = doc || document; |
24 | return doc.getElementById(id); | ||
24 | } | 25 | } |
25 | }, | 26 | }, |
26 | 27 | ||
27 | ///// Quick "getElementsByClassName" which also returns as an Array | 28 | ///// Quick "getElementsByClassName" which also returns as an Array |
28 | ///// Can return as NodeList by passing true as second argument | 29 | ///// Can return as NodeList by passing true as second argument |
29 | $$ : { | 30 | $$ : { |
30 | value: function(className, asNodeList) { | 31 | value: function(className, asNodeList, doc) { |
31 | var list = document.getElementsByClassName(className); | 32 | doc = doc || document; |
33 | var list = doc.getElementsByClassName(className); | ||
32 | return (asNodeList) ? list : this.toArray(list); | 34 | return (asNodeList) ? list : this.toArray(list); |
33 | } | 35 | } |
34 | }, | 36 | }, |
diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js index b8223471..db0f494b 100755 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js | |||
@@ -16,6 +16,7 @@ var ComponentsPanel = require("js/panels/Components/ComponentsPanel").Components | |||
16 | var ProjectPanel = require("js/panels/Project/ProjectPanel").ProjectPanel; | 16 | var ProjectPanel = require("js/panels/Project/ProjectPanel").ProjectPanel; |
17 | var MaterialsPanel = require("js/panels/Materials/MaterialsPanel").MaterialsPanel; | 17 | var MaterialsPanel = require("js/panels/Materials/MaterialsPanel").MaterialsPanel; |
18 | var PresetsPanel = require("js/panels/presets/presets-panel").PresetsPanel; | 18 | var PresetsPanel = require("js/panels/presets/presets-panel").PresetsPanel; |
19 | var CSSPanelNew = require("js/panels/css-panel/css-panel-container").CSSPanelContainer; | ||
19 | 20 | ||
20 | exports.PanelContainer = Montage.create(Component, { | 21 | exports.PanelContainer = Montage.create(Component, { |
21 | lastOffset: { | 22 | lastOffset: { |
@@ -45,7 +46,7 @@ exports.PanelContainer = Montage.create(Component, { | |||
45 | }, | 46 | }, |
46 | 47 | ||
47 | initPanelOrder: { | 48 | initPanelOrder: { |
48 | value: ['PropertiesPanel','ColorPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel','PresetsPanel'] | 49 | value: ['CSSPanelNew','PropertiesPanel','ColorPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel','PresetsPanel'] |
49 | }, | 50 | }, |
50 | 51 | ||
51 | panelOrder: { | 52 | panelOrder: { |
@@ -101,6 +102,7 @@ exports.PanelContainer = Montage.create(Component, { | |||
101 | this.addEventListener("change@appModel.CSSPanel", this, false); | 102 | this.addEventListener("change@appModel.CSSPanel", this, false); |
102 | this.addEventListener("change@appModel.MaterialsPanel", this, false); | 103 | this.addEventListener("change@appModel.MaterialsPanel", this, false); |
103 | this.addEventListener("change@appModel.PresetsPanel", this, false); | 104 | this.addEventListener("change@appModel.PresetsPanel", this, false); |
105 | this.addEventListener("change@appModel.CSSPanelNew", this, false); | ||
104 | } | 106 | } |
105 | }, | 107 | }, |
106 | 108 | ||
diff --git a/js/panels/css-panel/css-panel.reel/css-panel.html b/js/panels/css-panel/css-panel.reel/css-panel.html index cc1876c3..86bfbbb7 100644 --- a/js/panels/css-panel/css-panel.reel/css-panel.html +++ b/js/panels/css-panel/css-panel.reel/css-panel.html | |||
@@ -26,9 +26,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
26 | }, | 26 | }, |
27 | "stylesViewContainer": { | 27 | "stylesViewContainer": { |
28 | "module" : "js/panels/css-panel/styles-view-container.reel", | 28 | "module" : "js/panels/css-panel/styles-view-container.reel", |
29 | "name": "StyleSheetView", | 29 | "name": "StylesViewContainer", |
30 | "properties": { | 30 | "properties": { |
31 | "element": {"#": "css-styles-view" } | 31 | "element": {"#": "styles-view-container" } |
32 | } | 32 | } |
33 | } | 33 | } |
34 | } | 34 | } |
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.html b/js/panels/css-panel/style-sheet.reel/style-sheet.html index 4fb94335..43ffec6f 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.html +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.html | |||
@@ -20,7 +20,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
20 | "module": "montage/ui/dynamic-text.reel", | 20 | "module": "montage/ui/dynamic-text.reel", |
21 | "name": "DynamicText", | 21 | "name": "DynamicText", |
22 | "properties": { | 22 | "properties": { |
23 | "element": {"#": "sheet-name"} | 23 | "element": {"#": "sheet-name"}, |
24 | "defaultText": "Style sheet" | ||
24 | }, | 25 | }, |
25 | "bindings": { | 26 | "bindings": { |
26 | "value": { | 27 | "value": { |
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js index daa614c2..a4fe5960 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -34,19 +34,21 @@ exports.StyleSheet = Montage.create(Component, { | |||
34 | this._name = text; | 34 | this._name = text; |
35 | } | 35 | } |
36 | }, | 36 | }, |
37 | _styleSheet : { | 37 | _source : { |
38 | value: null | 38 | value: null |
39 | }, | 39 | }, |
40 | styleSheet : { | 40 | source : { |
41 | get: function() { | 41 | get: function() { |
42 | return this._styleSheet; | 42 | return this._source; |
43 | }, | 43 | }, |
44 | set: function(sheet) { | 44 | set: function(sheet) { |
45 | console.log('sheet being set'); | ||
45 | if(sheet.href) { | 46 | if(sheet.href) { |
46 | this.name = sheet.href.substring(sheet.href.lastIndexOf('/')); | 47 | this.name = sheet.href.substring(sheet.href.lastIndexOf('/')); |
47 | } else { | 48 | } else { |
48 | this.name = 'Style Tag'; | 49 | this.name = 'Style Tag'; |
49 | } | 50 | } |
51 | this._source = sheet; | ||
50 | } | 52 | } |
51 | } | 53 | } |
52 | }); \ No newline at end of file | 54 | }); \ No newline at end of file |
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html index 78836f21..d1dbfa2b 100644 --- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html +++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html | |||
@@ -16,22 +16,31 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
16 | "element" : {"#" : "style-sheet-view-container"} | 16 | "element" : {"#" : "style-sheet-view-container"} |
17 | } | 17 | } |
18 | }, | 18 | }, |
19 | "arrayController" : { | ||
20 | "module" : "montage/ui/controller/array-controller", | ||
21 | "name": "ArrayController", | ||
22 | "bindings": { | ||
23 | "content": { | ||
24 | "boundObject": {"@": "owner"}, | ||
25 | "boundObjectPropertyPath": "styleSheets", | ||
26 | "oneway": true | ||
27 | } | ||
28 | } | ||
29 | }, | ||
19 | "styleSheetList": { | 30 | "styleSheetList": { |
20 | "module" : "montage/ui/list.reel", | 31 | "module" : "montage/ui/list.reel", |
21 | "name": "List", | 32 | "name": "List", |
22 | "properties": { | 33 | "properties": { |
23 | "element": {"#": "sheet-list" } | 34 | "element": {"#": "sheet-list" }, |
24 | }, | 35 | "contentController": {"@": "arrayController"} |
25 | "bindings": { | ||
26 | "content": { | ||
27 | "boundObject": {"@": "owner" }, | ||
28 | "boundObjectPropertyPath": "styleSheets" | ||
29 | } | ||
30 | } | 36 | } |
31 | }, | 37 | }, |
32 | "sheet": { | 38 | "sheet": { |
33 | "module": "js/panels/css-panel/style-sheet.reel", | 39 | "module": "js/panels/css-panel/style-sheet.reel", |
34 | "name": "StyleSheet", | 40 | "name": "StyleSheet", |
41 | "properties": { | ||
42 | "element": {"#": "sheet-item"} | ||
43 | }, | ||
35 | "bindings": { | 44 | "bindings": { |
36 | "source": { | 45 | "source": { |
37 | "boundObject": {"@": "styleSheetList"}, | 46 | "boundObject": {"@": "styleSheetList"}, |
@@ -61,7 +70,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||