diff options
-rwxr-xr-x | js/components/ui/icon-list-basic/icon.reel/icon.js | 5 | ||||
-rwxr-xr-x | js/components/ui/tree-basic/treeItem.reel/treeItem.js | 5 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 50 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 44 | ||||
-rwxr-xr-x | js/data/menu-data.js | 2 | ||||
-rwxr-xr-x | js/document/html-document.js | 92 | ||||
-rwxr-xr-x | js/document/templates/montage-html/index.html | 1 | ||||
-rwxr-xr-x | js/document/templates/montage-html/styles.css | 5 | ||||
-rwxr-xr-x | js/io/ui/file-picker/file-input-field.reel/file-input-field.js | 21 | ||||
-rwxr-xr-x | js/io/ui/file-picker/file-picker-controller.js | 36 | ||||
-rw-r--r-- | js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | 26 | ||||
-rwxr-xr-x | js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 38 | ||||
-rw-r--r-- | js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | 36 | ||||
-rwxr-xr-x | js/io/ui/new-file-dialog/new-file-workflow-controller.js | 19 | ||||
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 4 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 73 |
16 files changed, 301 insertions, 156 deletions
diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.js b/js/components/ui/icon-list-basic/icon.reel/icon.js index b0279207..72adbfa1 100755 --- a/js/components/ui/icon-list-basic/icon.reel/icon.js +++ b/js/components/ui/icon-list-basic/icon.reel/icon.js | |||
@@ -131,6 +131,11 @@ var Icon = exports.Icon = Montage.create(Component, { | |||
131 | openFolderEvent.initEvent("openFolder", false, false); | 131 | openFolderEvent.initEvent("openFolder", false, false); |
132 | openFolderEvent.folderUri = this.icondata.uri; | 132 | openFolderEvent.folderUri = this.icondata.uri; |
133 | this.element.dispatchEvent(openFolderEvent); | 133 | this.element.dispatchEvent(openFolderEvent); |
134 | }else{ | ||
135 | var openFolderEvent = document.createEvent("Events"); | ||
136 | openFolderEvent.initEvent("selectFile", false, false); | ||
137 | openFolderEvent.fileUri = this.icondata.uri; | ||
138 | this.element.dispatchEvent(openFolderEvent); | ||
134 | } | 139 | } |
135 | if(evt.bubbles){ | 140 | if(evt.bubbles){ |
136 | evt.stopPropagation(); | 141 | evt.stopPropagation(); |
diff --git a/js/components/ui/tree-basic/treeItem.reel/treeItem.js b/js/components/ui/tree-basic/treeItem.reel/treeItem.js index 755eab8c..4c71cb6b 100755 --- a/js/components/ui/tree-basic/treeItem.reel/treeItem.js +++ b/js/components/ui/tree-basic/treeItem.reel/treeItem.js | |||
@@ -225,6 +225,11 @@ exports.TreeItem = Montage.create(Component, { | |||
225 | openFolderEvent.initEvent("openFolder", false, false); | 225 | openFolderEvent.initEvent("openFolder", false, false); |
226 | openFolderEvent.folderUri = this.treeItemData.uri; | 226 | openFolderEvent.folderUri = this.treeItemData.uri; |
227 | this.element.dispatchEvent(openFolderEvent); | 227 | this.element.dispatchEvent(openFolderEvent); |
228 | }else{ | ||
229 | var openFolderEvent = document.createEvent("Events"); | ||
230 | openFolderEvent.initEvent("selectFile", false, false); | ||
231 | openFolderEvent.fileUri = this.treeItemData.uri; | ||
232 | this.element.dispatchEvent(openFolderEvent); | ||
228 | } | 233 | } |
229 | if(evt.bubbles){ | 234 | if(evt.bubbles){ |
230 | evt.stopPropagation(); | 235 | evt.stopPropagation(); |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index fa611de4..77ae67a1 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -58,6 +58,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
58 | this.eventManager.addEventListener("executeFileOpen", this, false); | 58 | this.eventManager.addEventListener("executeFileOpen", this, false); |
59 | this.eventManager.addEventListener("executeNewFile", this, false); | 59 | this.eventManager.addEventListener("executeNewFile", this, false); |
60 | this.eventManager.addEventListener("executeSave", this, false); | 60 | this.eventManager.addEventListener("executeSave", this, false); |
61 | this.eventManager.addEventListener("executeSaveAs", this, false); | ||
62 | this.eventManager.addEventListener("executeSaveAll", this, false); | ||
61 | 63 | ||
62 | this.eventManager.addEventListener("recordStyleChanged", this, false); | 64 | this.eventManager.addEventListener("recordStyleChanged", this, false); |
63 | 65 | ||
@@ -102,33 +104,57 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
102 | handleExecuteFileOpen: { | 104 | handleExecuteFileOpen: { |
103 | value: function(event) { | 105 | value: function(event) { |
104 | var pickerSettings = event._event.settings || {}; | 106 | var pickerSettings = event._event.settings || {}; |
105 | pickerSettings.callback = this.openFileWithURI.bind(this); | 107 | if (this.application.ninja.coreIoApi.cloudAvailable()) { |
106 | pickerSettings.pickerMode = "read"; | 108 | pickerSettings.callback = this.openFileWithURI.bind(this); |
107 | pickerSettings.inFileMode = true; | 109 | pickerSettings.pickerMode = "read"; |
108 | this.application.ninja.filePickerController.showFilePicker(pickerSettings); | 110 | pickerSettings.inFileMode = true; |
111 | this.application.ninja.filePickerController.showFilePicker(pickerSettings); | ||
112 | } | ||
109 | } | 113 | } |
110 | }, | 114 | }, |
111 | 115 | ||
112 | handleExecuteNewFile: { | 116 | handleExecuteNewFile: { |
113 | value: function(event) { | 117 | value: function(event) { |
114 | var newFileSettings = event._event.settings || {}; | 118 | var newFileSettings = event._event.settings || {}; |
115 | newFileSettings.callback = this.createNewFile.bind(this); | 119 | if (this.application.ninja.coreIoApi.cloudAvailable()) { |
116 | this.application.ninja.newFileController.showNewFileDialog(newFileSettings); | 120 | newFileSettings.callback = this.createNewFile.bind(this); |
121 | this.application.ninja.newFileController.showNewFileDialog(newFileSettings); | ||
122 | } | ||
117 | } | 123 | } |
118 | }, | 124 | }, |
119 | |||
120 | |||
121 | //////////////////////////////////////////////////////////////////// | 125 | //////////////////////////////////////////////////////////////////// |
122 | //TODO: Check for appropiate structures | 126 | //TODO: Check for appropiate structures |
123 | handleExecuteSave: { | 127 | handleExecuteSave: { |
124 | value: function(event) { | 128 | value: function(event) { |
125 | if(!!this.activeDocument){ | 129 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ |
126 | //Text and HTML document classes should return the same save object for fileSave | 130 | //Text and HTML document classes should return the same save object for fileSave |
127 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | 131 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); |
132 | } | ||
128 | } | 133 | } |
134 | }, | ||
135 | //////////////////////////////////////////////////////////////////// | ||
136 | //TODO: Check for appropiate structures | ||
137 | handleExecuteSaveAll: { | ||
138 | value: function(event) { | ||
139 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | ||
140 | //Text and HTML document classes should return the same save object for fileSave | ||
141 | this.application.ninja.ioMediator.fileSave(this.activeDocument.saveAll(), this.fileSaveResult.bind(this)); | ||
142 | } | ||
129 | } | 143 | } |
130 | }, | 144 | }, |
131 | //////////////////////////////////////////////////////////////////// | 145 | //////////////////////////////////////////////////////////////////// |
146 | handleExecuteSaveAs: { | ||
147 | value: function(event) { | ||
148 | var saveAsSettings = event._event.settings || {}; | ||
149 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | ||
150 | saveAsSettings.fileName = this.activeDocument.name; | ||
151 | saveAsSettings.folderUri = this.activeDocument.uri.substring(0, this.activeDocument.uri.lastIndexOf("/")); | ||
152 | //add callback | ||
153 | this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings); | ||
154 | } | ||
155 | } | ||
156 | }, | ||
157 | |||
132 | // | 158 | // |
133 | fileSaveResult: { | 159 | fileSaveResult: { |
134 | value: function (result) { | 160 | value: function (result) { |
@@ -287,7 +313,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
287 | if(this.activeDocument.uuid === id && this._documents.length > 0) {//closing the active document tab | 313 | if(this.activeDocument.uuid === id && this._documents.length > 0) {//closing the active document tab |
288 | var nextDocumentIndex = -1 ; | 314 | var nextDocumentIndex = -1 ; |
289 | if((this._documents.length > 0) && (closeDocumentIndex === 0)){ | 315 | if((this._documents.length > 0) && (closeDocumentIndex === 0)){ |
290 | nextDocumentIndex = 1; | 316 | nextDocumentIndex = 0; |
291 | }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){ | 317 | }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){ |
292 | nextDocumentIndex = closeDocumentIndex - 1; | 318 | nextDocumentIndex = closeDocumentIndex - 1; |
293 | } | 319 | } |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 885d710f..662816f5 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -317,7 +317,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
317 | isInlineStyle : true, | 317 | isInlineStyle : true, |
318 | style : element.style | 318 | style : element.style |
319 | }; | 319 | }; |
320 | 320 | ||
321 | ///// Now splice it into the matched rules | 321 | ///// Now splice it into the matched rules |
322 | ///// By inserting the inline style at the beginning, | 322 | ///// By inserting the inline style at the beginning, |
323 | ///// we keep the correct order of specificity | 323 | ///// we keep the correct order of specificity |
@@ -572,37 +572,36 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
572 | win = element.ownerDocument.defaultView, | 572 | win = element.ownerDocument.defaultView, |
573 | self = this; | 573 | self = this; |
574 | 574 | ||
575 | if(!win) { | ||
576 | return null; | ||
577 | } | ||
578 | |||
579 | if(!omitPseudos) { | 575 | if(!omitPseudos) { |
580 | pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', | 576 | pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', |
581 | 'first-line', 'first-child', 'before', 'after', 'lang', 'target']); | 577 | 'first-line', 'first-child', 'before', 'after', 'lang', 'target']); |
582 | } | 578 | } |
583 | 579 | ||
584 | pseudos.forEach(function(pseudo) { | 580 | try { |
585 | rules = rules.concat(nj.toArray(win.getMatchedCSSRules(element, pseudo)).filter(function(rule) { | 581 | pseudos.forEach(function(pseudo) { |
586 | //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet, | 582 | rules = rules.concat(nj.toArray(win.getMatchedCSSRules(element, pseudo)).filter(function(rule) { |
587 | //// or only use rules for other stylesheets | 583 | //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet, |
588 | 584 | //// or only use rules for other stylesheets | |
589 | var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null, | ||
590 | isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID; | ||
591 | 585 | ||
592 | ///// filter out (return false) depending on flag | 586 | var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null, |
593 | if(useStageStyleSheet && !isStageStyleSheet) { return false; } | 587 | isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID; |
594 | if(!useStageStyleSheet && isStageStyleSheet) { return false; } | ||
595 | 588 | ||
596 | ///// Non-filter code - just assigning specificity to the rule | 589 | ///// filter out (return false) depending on flag |
597 | if(!rule[this.CONST.SPECIFICITY_KEY]) { | 590 | if(useStageStyleSheet && !isStageStyleSheet) { return false; } |
598 | rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity( |