From 940b9fc0bf71845bcae39de637e85697e5911eea Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 2 Mar 2012 15:54:12 -0800 Subject: Formatting fixes --- js/controllers/selection-controller.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 08eb018f..75968d4a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -76,7 +76,7 @@ exports.SelectionController = Montage.create(Component, { this.application.ninja.selectedElements = currentSelectionArray; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); @@ -92,12 +92,12 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0 ){ + if(this._selectedItems.length === 0) { this._isDocument = true; - }else{ + } else { this._isDocument = false; } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); this._selectionContainer = this.application.ninja.currentSelectedContainer; } @@ -139,7 +139,7 @@ exports.SelectionController = Montage.create(Component, { value: function(event) { this.application.ninja.selectedElements = []; this._isDocument = true; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); } }, -- cgit v1.2.3 From bb9adf8a3162a5bbed5a4a8f0d63deeb75f76e61 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 5 Mar 2012 22:27:19 -0800 Subject: removing repetition from the panel container and using a static list of panels. - Fixing the bugs associated with the repetition of component and PI problems. Signed-off-by: Valerio Virgillito --- js/data/panels-data.js | 25 --- js/ninja.reel/ninja.html | 2 +- .../ComponentsPanelBase.js | 2 +- js/panels/Panel.reel/Panel.js | 101 ++++++----- js/panels/PanelContainer.reel/PanelContainer.html | 110 ++++++++++++ js/panels/PanelContainer.reel/PanelContainer.js | 193 +++++++++++++++++++++ .../PanelContainer.reel/PanelContainer.html | 146 ---------------- .../PanelContainer.reel/PanelContainer.js | 180 ------------------- 8 files changed, 366 insertions(+), 393 deletions(-) create mode 100755 js/panels/PanelContainer.reel/PanelContainer.html create mode 100755 js/panels/PanelContainer.reel/PanelContainer.js delete mode 100755 js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html delete mode 100755 js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js diff --git a/js/data/panels-data.js b/js/data/panels-data.js index aa5057a2..2422f5e7 100644 --- a/js/data/panels-data.js +++ b/js/data/panels-data.js @@ -19,7 +19,6 @@ exports.PanelsData = Montage.create(Montage, { scrollable: false, collapsed: false, open: true, - contentComponent: null, modulePath: "js/panels/Color/colorpanelbase.reel", moduleName: "ColorPanelBase" }, @@ -32,7 +31,6 @@ exports.PanelsData = Montage.create(Montage, { scrollable: true, collapsed: false, open: true, - contentComponent: null, modulePath: "js/panels/properties.reel", moduleName: "Properties" }, @@ -45,7 +43,6 @@ exports.PanelsData = Montage.create(Montage, { collapsed: true, scrollable: true, open: true, - contentComponent: null, modulePath: "js/panels/Materials/materials-library-panel.reel", moduleName: "MaterialsLibraryPanel" }, @@ -58,7 +55,6 @@ exports.PanelsData = Montage.create(Montage, { scrollable: true, collapsed: true, open: true, - contentComponent: null, modulePath: "js/panels/Components/ComponentsPanelBase.reel", moduleName: "ComponentsPanelBase" }, @@ -71,7 +67,6 @@ exports.PanelsData = Montage.create(Montage, { // scrollable: true, // collapsed: false, // open: true, -// content: null, // modulePath: "js/panels/Project/projectpanelbase.reel", // moduleName: "ProjectPanelBase" // }, @@ -84,7 +79,6 @@ exports.PanelsData = Montage.create(Montage, { scrollable: true, collapsed: true, open: true, - contentComponent: null, modulePath: "js/panels/CSSPanel/CSSPanelBase.reel", moduleName: "CSSPanelBase" }, @@ -97,7 +91,6 @@ exports.PanelsData = Montage.create(Montage, { collapsed: true, scrollable: true, open: true, - contentComponent: null, modulePath: "js/panels/presets/content.reel", moduleName: "content" } @@ -118,24 +111,6 @@ exports.PanelsData = Montage.create(Montage, { this._panelOrder = val; } } - - - panels: { - get: function() { - var filtered = this._panels.filter(function(item) { - return item.open; - }); - - filtered.sort(function(a,b) { - a.name - }); - - return filtered; - }, - set : function() { - - } - } */ }); \ No newline at end of file diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 112f844e..430b8aa0 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -167,7 +167,7 @@ }, "panelContainer": { - "module": "js/panels/PanelContainer/PanelContainer.reel", + "module": "js/panels/PanelContainer.reel", "name": "PanelContainer", "properties": { "element": {"#": "rightPanelContent"}, diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index b4eec771..b6bee37d 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -118,7 +118,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component didCreate: { value: function() { // Setup the drop delegate - this.application.ninja.dragDropMediator.dropDelegate = this; +// this.application.ninja.dragDropMediator.dropDelegate = this; // Loop through the component and load the JSON data for them this._loadComponents(); } diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js index e0bf3f18..be03d019 100755 --- a/js/panels/Panel.reel/Panel.js +++ b/js/panels/Panel.reel/Panel.js @@ -9,31 +9,52 @@ var Component = require("montage/ui/component").Component; exports.Panel = Montage.create(Component, { - name: { value: "Panel" }, - collapsedHeight: {value: 26}, - _collapsed: {value: false}, - _height: { value: 200 }, - minHeight: {value: 200 }, - maxHeight: { value: null}, - flexible: {value: true}, - _locked: { value: false}, - isResizing: {value: false }, - resizer: {value: null }, - modulePath: {value: null}, - moduleName: {value: null}, - _contentComponent: {value: null}, - - contentComponent: { - get: function() { - return this._contentComponent; - }, - set: function(val) { - if (val !== null && val !== this._contentComponent) { - this.panelContent.content = val; - this.panelContent.needsDraw = true; - this._contentComponent = val; - } - } + name: { + value: "Panel" + }, + + _collapsed: { + value: false + }, + + _height: { + value: 200 + }, + + minHeight: { + value: 200 + }, + + maxHeight: { + value: null + }, + + flexible: { + value: true + }, + + _locked: { + value: false + }, + + isResizing: { + value: false + }, + + _resizedHeight: { + value: 0 + }, + + resizer: { + value: null + }, + + modulePath: { + value: null + }, + + moduleName: { + value: null }, collapsed: { @@ -63,10 +84,6 @@ exports.Panel = Montage.create(Component, { } }, - _resizedHeight: { - value: 0 - }, - locked: { get: function() { return this._locked; @@ -94,17 +111,21 @@ exports.Panel = Montage.create(Component, { prepareForDraw: { value: function() { - //TODO: This line should not be here this line hits each time a panel is loaded. Will Need to move to instance call; - this.application.ninja.colorController.colorView = this.application.ninja.colorController.colorPanelBase.create(); - var myContent; - var that = this; - - myContent = require.async(this.modulePath) - .then(function(panelContent) { - var componentRequire = panelContent[that.moduleName]; - that.contentComponent = componentRequire.create(); - }) - .end(); + if(this.name === "Color") { + this.application.ninja.colorController.colorView = this.application.ninja.colorController.colorPanelBase.create(); + } + + if(this.modulePath && this.moduleName) { + console.log("load content"); + // Load the slot content + var that = this; + require.async(this.modulePath) + .then(function(panelContent) { + var componentRequire = panelContent[that.moduleName]; + that.panelContent.content = componentRequire.create(); + }) + .end(); + } } }, diff --git a/js/panels/PanelContainer.reel/PanelContainer.html b/js/panels/PanelContainer.reel/PanelContainer.html new file mode 100755 index 00000000..251e86e4 --- /dev/null +++ b/js/panels/PanelContainer.reel/PanelContainer.html @@ -0,0 +1,110 @@ + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js new file mode 100755 index 00000000..51bd2df9 --- /dev/null +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -0,0 +1,193 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +/* +Panel Container - A container for other panels +*/ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.PanelContainer = Montage.create(Component, { + + panelData: { + value: null + }, + + // This will hold the current loaded panels. + panels: { + value: [] + }, + + currentPanelState: { + value: {} + }, + + templateDidLoad: { + value: function() { + + var pLen, storedData; + + // Loop through the panels to add to the repetition and get the saved state + pLen = this.panelData.panels.length; + + // Get the saved panel state + storedData = this.application.localStorage.getItem("panels"); + + for(var i = 0; i < pLen; i++) { + + var p = this.panelData.panels[i]; + + this['panel_'+i].name = p.name; + this['panel_'+i].height = p.height; + this['panel_'+i].minHeight= p.minHeight; + this['panel_'+i].maxHeight = p.maxHeight; + this['panel_'+i].flexible = p.flexible; + this['panel_'+i].modulePath = p.modulePath; + this['panel_'+i].moduleName = p.moduleName; + + this.currentPanelState[p.name] = {}; + this.currentPanelState.version = "1.0"; + + if(storedData && storedData[p.name]) { + this['panel_'+i].collapsed = storedData[p.name].collapsed; + } + + this.currentPanelState[p.name].collapsed = this['panel_'+i].collapsed; + + // Check if current panel is open when feature is enabled + this.panels.push(p); + } + + this.application.localStorage.setItem("panels", this.currentPanelState); + + + } + }, + + prepareForDraw: { + value: function() { + window.addEventListener("resize", this, false); + } + }, + + handlePanelResizing: { + value: function(e) { + this._setPanelsSizes(e.target); + } + }, + + handleResize: { + value: function(e) { + this._setPanelsSizes(null); + } + }, + + handleDropped: { + value: function(e) { + var draggedIndex, droppedIndex = 0; + for(var i = 0; i< this.repeater.childComponents.length; i++ ) { + if (this.repeater.childComponents[i] === e._event.draggedComponent) { + draggedIndex = i; + } + + if (this.repeater.childComponents[i] === e._event.droppedComponent) { + droppedIndex = i; + } + } + + var panelRemoved = this.panelController.content.splice(draggedIndex,1); + this.panelController.content.splice(droppedIndex,0, panelRemoved[0]); + //console.log(draggedIndex, droppedIndex); + this._setPanelsSizes(null); + } + }, + + _setPanelsSizes: { + value: function(panelActivated) { + var len = this.panels.length, setLocked = true; + + for(var i = 0; i < len; i++) { + if(this['panel_'+i] === panelActivated || panelActivated === null) { + setLocked = false; + } + + this['panel_'+i].locked = setLocked; + this['panel_'+i].needsDraw = true; + } + } + }, + + _redrawPanels: { + value: function(panelActivated, unlockPanels) { + var maxHeight = this.element.offsetHeight, setLocked = true; + var len = this.panels.length; + + if(unlockPanels === true) { + setLocked = false; + } + + var childrensMinHeights = ((len - 1) * 26) + panelActivated.minHeight; + + for(var i = 0; i < len; i++) { + var obj = this['panel_'+i]; + + if(obj === panelActivated) { + setLocked = false; + } else if(obj.collapsed) { + //Collapsed Ignore the rest of the code + } else { + if (setLocked) { + if((maxHeight - childrensMinHeights) - obj.height > 0 ) { + childrensMinHeights += obj.height - 26; + } else { + this.currentPanelState[obj.name].collapsed = obj.collapsed = true; + this.application.localStorage.setItem("panels", this.currentPanelState); + } + } else { + if ((maxHeight - childrensMinHeights) - obj.minHeight > 0 ) { + childrensMinHeights += obj.minHeight - 26; + } else { + this.currentPanelState[obj.name].collapsed = obj.collapsed = true; + this.application.localStorage.setItem("panels", this.currentPanelState); + } + } + } + obj.locked = setLocked; + } + } + }, + + handleAction: { + value: function(e) { + var unlockPanels = true; + var afterPanel = false; + var panelName = e.target.parentComponent.name; + switch(e.target.identifier) { + case "btnCollapse": + this.currentPanelState[e.target.parentComponent.name].collapsed = e.target.parentComponent.collapsed; + this.application.localStorage.setItem("panels", this.currentPanelState); + this._setPanelsSizes(e.target.parentComponent); + this._redrawPanels(e.target.parentComponent, unlockPanels); + break; + case "btnClose": + this.panelController.content.forEach(function(obj) { + if(afterPanel) { + if(obj.flexible) { + unlockPanels = false; + } + } + if (obj.name === panelName) { + afterPanel = true; + this.panelController.removeObjects(obj); + } + }); + this._redrawPanels(e.target.parentComponent, unlockPanels); + break; + } + } + } + +}); \ No newline at end of file diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html deleted file mode 100755 index 76f6b9c4..00000000 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - -
-
-
-
-
- - \ No newline at end of file diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js deleted file mode 100755 index 3a141b05..00000000 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js +++ /dev/null @@ -1,180 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -/* -Panel Container - A container for other panels -*/ -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.PanelContainer = Montage.create(Component, { - - panelData: { - value: null - }, - - panels: { - value: [] - }, - - panelController: { - value: null - }, - - currentPanelState: { - value: {} - }, - - templateDidLoad: { - value: function() { - var pLen, storedData; - - // Loop through the panels to add to the repetition and get the saved state - pLen = this.panelData.panels.length; - - // Get the saved panel state - storedData = this.application.localStorage.getItem("panels"); - - for(var i = 0; i < pLen; i++) { - - var p = this.panelData.panels[i]; - - this.currentPanelState[p.name] = {}; - this.currentPanelState.version = "1.0"; - - if(storedData && storedData[p.name]) { - p.collapsed = storedData[p.name].collapsed; - } - - this.currentPanelState[p.name].collapsed = p.collapsed; - - this.panels.push(p); - } - - this.application.localStorage.setItem("panels", this.currentPanelState); - } - }, - - prepareForDraw: { - value: function() { - window.addEventListener("resize", this, false); - } - }, - - handlePanelResizing: { - value: function(e) { - this._setPanelsSizes(e.target); - } - }, - - handleResize: { - value: function(e) { - this._setPanelsSizes(null); - } - }, - - handleDropped: { - value: function(e) { - var draggedIndex, droppedIndex = 0; - for(var i = 0; i< this.repeater.childComponents.length; i++ ) { - if (this.repeater.childComponents[i] === e._event.draggedComponent) { - draggedIndex = i; - } - - if (this.repeater.childComponents[i] === e._event.droppedComponent) { - droppedIndex = i; - } - } - - var panelRemoved = this.panelController.content.splice(draggedIndex,1); - this.panelController.content.splice(droppedIndex,0, panelRemoved[0]); - //console.log(draggedIndex, droppedIndex); - this._setPanelsSizes(null); - } - }, - - _setPanelsSizes: { - value: function(panelActivated) { - var setLocked = true; - this.repeater.childComponents.forEach(function(obj) { - if (obj === panelActivated || panelActivated === null) { - setLocked = false; - } - - obj.locked = setLocked; - obj.needsDraw = true; - }); - } - }, - - _redrawPanels: { - value: function(panelActivated, unlockPanels) { - var maxHeight = this.element.offsetHeight; - var setLocked = true; - if(unlockPanels === true) { - setLocked = false; - } - - var childrensMinHeights = ((this.repeater.childComponents.length - 1) * 26) + panelActivated.minHeight; - - this.repeater.childComponents.forEach(function(obj) { - if(obj === panelActivated) { - setLocked = false; - } else if(obj.collapsed) { - //Collapsed Ignore the rest of the code - } else { - if (setLocked) { - if((maxHeight - childrensMinHeights) - obj.height > 0 ) { - childrensMinHeights += obj.height - 26; - } else { - this.currentPanelState[obj.name].collapsed = obj.collapsed = true; - this.application.localStorage.setItem("panels", this.currentPanelState); - } - } else { - if ((maxHeight - childrensMinHeights) - obj.minHeight > 0 ) { - childrensMinHeights += obj.minHeight - 26; - } else { - this.currentPanelState[obj.name].collapsed = obj.collapsed = true; - this.application.localStorage.setItem("panels", this.currentPanelState); - } - } - } - obj.locked = setLocked; - }, this); - } - }, - - handleAction: { - value: function(e) { - var unlockPanels = true; - var afterPanel = false; - var panelName = e.target.parentComponent.name; - switch(e.target.identifier) { - case "btnCollapse": - this.currentPanelState[e.target.parentComponent.name].collapsed = e.target.parentComponent.collapsed; - this.application.localStorage.setItem("panels", this.currentPanelState); - this._setPanelsSizes(e.target.parentComponent); - this._redrawPanels(e.target.parentComponent, unlockPanels); - break; - case "btnClose": - this.panelController.content.forEach(function(obj) { - if(afterPanel) { - if(obj.flexible) { - unlockPanels = false; - } - } - if (obj.name === panelName) { - afterPanel = true; - this.panelController.removeObjects(obj); - } - }); - this._redrawPanels(e.target.parentComponent, unlockPanels); - break; - } - } - } - -}); \ No newline at end of file -- cgit v1.2.3 From 4c16cf1d8085c70e1ed8fb2098954311bc22f81f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 5 Mar 2012 22:33:51 -0800 Subject: remove console log Signed-off-by: Valerio Virgillito --- js/panels/Panel.reel/Panel.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js index be03d019..2b308258 100755 --- a/js/panels/Panel.reel/Panel.js +++ b/js/panels/Panel.reel/Panel.js @@ -116,7 +116,6 @@ exports.Panel = Montage.create(Component, { } if(this.modulePath && this.moduleName) { - console.log("load content"); // Load the slot content var that = this; require.async(this.modulePath) -- cgit v1.2.3 From 4e35725e6c9044c37bef28b8c8d36f4b5c89bfd9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 5 Mar 2012 23:18:31 -0800 Subject: Adding drag and drop Signed-off-by: Valerio Virgillito --- js/panels/PanelContainer.reel/PanelContainer.js | 22 +++++++++++++--------- js/panels/drag-drop-composer.js | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index 51bd2df9..dd720bd3 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -58,7 +58,7 @@ exports.PanelContainer = Montage.create(Component, { this.currentPanelState[p.name].collapsed = this['panel_'+i].collapsed; // Check if current panel is open when feature is enabled - this.panels.push(p); + this.panels.push(this['panel_'+i]); } this.application.localStorage.setItem("panels", this.currentPanelState); @@ -87,20 +87,24 @@ exports.PanelContainer = Montage.create(Component, { handleDropped: { value: function(e) { - var draggedIndex, droppedIndex = 0; - for(var i = 0; i< this.repeater.childComponents.length; i++ ) { - if (this.repeater.childComponents[i] === e._event.draggedComponent) { - draggedIndex = i; + var draggedIndex, droppedIndex = 0, len = this.panels.length; + +// console.log(e._event.draggedComponent); + for(var i = 0; i < len; i++) { + if(this.panels[i].name === e._event.draggedComponent.name) { + draggedIndex = i; // Actual component being dragged } - if (this.repeater.childComponents[i] === e._event.droppedComponent) { + if(this.panels[i].name === e._target.name) { droppedIndex = i; } } - var panelRemoved = this.panelController.content.splice(draggedIndex,1); - this.panelController.content.splice(droppedIndex,0, panelRemoved[0]); - //console.log(draggedIndex, droppedIndex); + if(draggedIndex !== droppedIndex) { + // switch panels + this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element); + } + this._setPanelsSizes(null); } }, diff --git a/js/panels/drag-drop-composer.js b/js/panels/drag-drop-composer.js index e09f601d..b36c8334 100644 --- a/js/panels/drag-drop-composer.js +++ b/js/panels/drag-drop-composer.js @@ -10,7 +10,7 @@ var Composer = require("montage/ui/composer/composer").Composer; exports.DragDropComposer = Montage.create(Composer, { draggable: { - value: false // TODO: Turning this off until color Panel bug fixes are in + value: true }, droppable: { -- cgit v1.2.3 From 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 6 Mar 2012 11:24:25 -0800 Subject: Fixing WebGL not available bug --- js/document/html-document.js | 6 ++++-- js/mediators/io-mediator.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/js/document/html-document.js b/js/document/html-document.js index 5d507476..536fca47 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -668,7 +668,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } } - return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + //return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + return {mode: 'html', document: this._userDocument, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; } else if (this.currentView === "code"){ //TODO: Would this get call when we are in code of HTML? } else { @@ -691,7 +692,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } } - return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + //return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + return {mode: 'html', document: this._userDocument, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; } else if (this.currentView === "code"){ //TODO: Would this get call when we are in code of HTML? } else { diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index e763c67c..65218526 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -150,7 +150,7 @@ exports.IoMediator = Montage.create(Component, { switch (file.mode) { case 'html': //Copy webGL library if needed - if (file.webgl.length > 0) { + if (file.webgl && file.webgl.length > 0) { for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { //Checking for RDGE library to be available if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { @@ -308,7 +308,7 @@ exports.IoMediator = Montage.create(Component, { } } //Checking for webGL elements in document - if (template.webgl.length) { + if (template.webgl && template.webgl.length) { // var json, matchingtags = [], webgltag, scripts = template.document.content.document.getElementsByTagName('script'); // -- cgit v1.2.3 From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: Squashed commit FileIO-Build-Candidate into Master Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request. Signed-off-by: Valerio Virgillito --- imports/codemirror/LICENSE | 4 + imports/codemirror/keymap/emacs.js | 0 imports/codemirror/keymap/vim.js | 277 +++++++++- imports/codemirror/lib/codemirror.css | 12 +- imports/codemirror/lib/codemirror.js | 554 +++++++++++-------- imports/codemirror/lib/util/dialog.css | 0 imports/codemirror/lib/util/dialog.js | 0 imports/codemirror/lib/util/foldcode.js | 120 +++++ imports/codemirror/lib/util/formatting.js | 9 +- imports/codemirror/lib/util/javascript-hint.js | 67 ++- imports/codemirror/lib/util/match-highlighter.js | 44 ++ imports/codemirror/lib/util/overlay.js | 0 imports/codemirror/lib/util/runmode.js | 38 +- imports/codemirror/lib/util/search.js | 0 imports/codemirror/lib/util/searchcursor.js | 0 imports/codemirror/lib/util/simple-hint.css | 0 imports/codemirror/lib/util/simple-hint.js | 0 imports/codemirror/mode/clike/clike.js | 19 +- imports/codemirror/mode/clike/index.html | 2 +- imports/codemirror/mode/clojure/clojure.js | 2 +- imports/codemirror/mode/clojure/index.html | 0 imports/codemirror/mode/coffeescript/LICENSE | 0 .../codemirror/mode/coffeescript/coffeescript.js | 90 ++-- imports/codemirror/mode/coffeescript/index.html | 0 imports/codemirror/mode/css/css.js | 0 imports/codemirror/mode/css/index.html | 0 imports/codemirror/mode/diff/diff.css | 0 imports/codemirror/mode/diff/diff.js | 0 imports/codemirror/mode/diff/index.html | 0 imports/codemirror/mode/ecl/ecl.js | 203 +++++++ imports/codemirror/mode/ecl/index.html | 42 ++ imports/codemirror/mode/gfm/gfm.js | 2 +- imports/codemirror/mode/gfm/index.html | 0 imports/codemirror/mode/go/go.js | 170 ++++++ imports/codemirror/mode/go/index.html | 72 +++ imports/codemirror/mode/groovy/groovy.js | 0 imports/codemirror/mode/groovy/index.html | 0 imports/codemirror/mode/haskell/haskell.js | 0 imports/codemirror/mode/haskell/index.html | 0 .../codemirror/mode/htmlembedded/htmlembedded.js | 0 imports/codemirror/mode/htmlembedded/index.html | 0 imports/codemirror/mode/htmlmixed/htmlmixed.js | 0 imports/codemirror/mode/htmlmixed/index.html | 0 imports/codemirror/mode/javascript/index.html | 0 imports/codemirror/mode/javascript/javascript.js | 4 +- imports/codemirror/mode/jinja2/index.html | 0 imports/codemirror/mode/jinja2/jinja2.js | 0 imports/codemirror/mode/less/index.html | 588 +++++++++++++++++++++ imports/codemirror/mode/less/less.js | 189 +++++++ imports/codemirror/mode/lua/index.html | 0 imports/codemirror/mode/lua/lua.js | 0 imports/codemirror/mode/markdown/index.html | 0 imports/codemirror/mode/markdown/markdown.js | 82 ++- imports/codemirror/mode/mysql/index.html | 41 ++ imports/codemirror/mode/mysql/mysql.js | 188 +++++++ imports/codemirror/mode/ntriples/index.html | 0 imports/codemirror/mode/ntriples/ntriples.js | 0 imports/codemirror/mode/pascal/LICENSE | 0 imports/codemirror/mode/pascal/index.html | 0 imports/codemirror/mode/pascal/pascal.js | 48 +- imports/codemirror/mode/perl/LICENSE | 0 imports/codemirror/mode/perl/index.html | 0 imports/codemirror/mode/perl/perl.js | 2 +- imports/codemirror/mode/php/index.html | 0 imports/codemirror/mode/php/php.js | 78 ++- imports/codemirror/mode/plsql/index.html | 0 imports/codemirror/mode/plsql/plsql.js | 0 imports/codemirror/mode/properties/index.html | 40 ++ imports/codemirror/mode/properties/properties.css | 3 + imports/codemirror/mode/properties/properties.js | 57 ++ imports/codemirror/mode/python/LICENSE.txt | 0 imports/codemirror/mode/python/index.html | 0 imports/codemirror/mode/python/python.js | 41 +- imports/codemirror/mode/r/LICENSE | 0 imports/codemirror/mode/r/index.html | 0 imports/codemirror/mode/r/r.js | 0 imports/codemirror/mode/rpm/changes/changes.js | 0 imports/codemirror/mode/rpm/changes/index.html | 0 imports/codemirror/mode/rpm/spec/index.html | 0 imports/codemirror/mode/rpm/spec/spec.css | 0 imports/codemirror/mode/rpm/spec/spec.js | 2 +- imports/codemirror/mode/rst/index.html | 0 imports/codemirror/mode/rst/rst.js | 0 imports/codemirror/mode/ruby/LICENSE | 0 imports/codemirror/mode/ruby/index.html | 0 imports/codemirror/mode/ruby/ruby.js | 17 +- imports/codemirror/mode/rust/index.html | 6 +- imports/codemirror/mode/rust/rust.js | 51 +- imports/codemirror/mode/scheme/index.html | 0 imports/codemirror/mode/smalltalk/index.html | 0 imports/codemirror/mode/smalltalk/smalltalk.js | 32 +- imports/codemirror/mode/sparql/index.html | 0 imports/codemirror/mode/sparql/sparql.js | 0 imports/codemirror/mode/stex/index.html | 2 +- imports/codemirror/mode/stex/stex.js | 0 imports/codemirror/mode/tiddlywiki/index.html | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.css | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.js | 0 imports/codemirror/mode/velocity/index.html | 0 imports/codemirror/mode/velocity/velocity.js | 0 imports/codemirror/mode/verilog/index.html | 210 ++++++++ imports/codemirror/mode/verilog/verilog.js | 194 +++++++ imports/codemirror/mode/xml/index.html | 0 imports/codemirror/mode/xml/xml.js | 35 +- imports/codemirror/mode/xmlpure/index.html | 0 imports/codemirror/mode/xmlpure/xmlpure.js | 5 + imports/codemirror/mode/yaml/index.html | 0 imports/codemirror/mode/yaml/yaml.js | 0 imports/codemirror/theme/cobalt.css | 2 +- imports/codemirror/theme/eclipse.css | 0 imports/codemirror/theme/elegant.css | 0 imports/codemirror/theme/monokai.css | 2 +- imports/codemirror/theme/neat.css | 0 imports/codemirror/theme/night.css | 2 +- imports/codemirror/theme/rubyblue.css | 2 +- imports/codemirror/version.txt | 2 +- js/controllers/document-controller.js | 9 +- js/controllers/selection-controller.js | 12 +- js/controllers/undo-controller.js | 17 +- js/document/html-document.js | 181 +++++-- .../picker-navigator.reel/picker-navigator.js | 6 +- js/mediators/io-mediator.js | 163 ++++-- 122 files changed, 3493 insertions(+), 547 deletions(-) mode change 100755 => 100644 imports/codemirror/LICENSE mode change 100755 => 100644 imports/codemirror/keymap/emacs.js mode change 100755 => 100644 imports/codemirror/keymap/vim.js mode change 100755 => 100644 imports/codemirror/lib/codemirror.css mode change 100755 => 100644 imports/codemirror/lib/codemirror.js mode change 100755 => 100644 imports/codemirror/lib/util/dialog.css mode change 100755 => 100644 imports/codemirror/lib/util/dialog.js mode change 100755 => 100644 imports/codemirror/lib/util/foldcode.js mode change 100755 => 100644 imports/codemirror/lib/util/formatting.js mode change 100755 => 100644 imports/codemirror/lib/util/javascript-hint.js create mode 100644 imports/codemirror/lib/util/match-highlighter.js mode change 100755 => 100644 imports/codemirror/lib/util/overlay.js mode change 100755 => 100644 imports/codemirror/lib/util/runmode.js mode change 100755 => 100644 imports/codemirror/lib/util/search.js mode change 100755 => 100644 imports/codemirror/lib/util/searchcursor.js mode change 100755 => 100644 imports/codemirror/lib/util/simple-hint.css mode change 100755 => 100644 imports/codemirror/lib/util/simple-hint.js mode change 100755 => 100644 imports/codemirror/mode/clike/clike.js mode change 100755 => 100644 imports/codemirror/mode/clike/index.html mode change 100755 => 100644 imports/codemirror/mode/clojure/clojure.js mode change 100755 => 100644 imports/codemirror/mode/clojure/index.html mode change 100755 => 100644 imports/codemirror/mode/coffeescript/LICENSE mode change 100755 => 100644 imports/codemirror/mode/coffeescript/coffeescript.js mode change 100755 => 100644 imports/codemirror/mode/coffeescript/index.html mode change 100755 => 100644 imports/codemirror/mode/css/css.js mode change 100755 => 100644 imports/codemirror/mode/css/index.html mode change 100755 => 100644 imports/codemirror/mode/diff/diff.css mode change 100755 => 100644 imports/codemirror/mode/diff/diff.js mode change 100755 => 100644 imports/codemirror/mode/diff/index.html create mode 100644 imports/codemirror/mode/ecl/ecl.js create mode 100644 imports/codemirror/mode/ecl/index.html mode change 100755 => 100644 imports/codemirror/mode/gfm/gfm.js mode change 100755 => 100644 imports/codemirror/mode/gfm/index.html create mode 100644 imports/codemirror/mode/go/go.js create mode 100644 imports/codemirror/mode/go/index.html mode change 100755 => 100644 imports/codemirror/mode/groovy/groovy.js mode change 100755 => 100644 imports/codemirror/mode/groovy/index.html mode change 100755 => 100644 imports/codemirror/mode/haskell/haskell.js mode change 100755 => 100644 imports/codemirror/mode/haskell/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/htmlembedded.js mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/htmlmixed.js mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/javascript.js mode change 100755 => 100644 imports/codemirror/mode/jinja2/index.html mode change 100755 => 100644 imports/codemirror/mode/jinja2/jinja2.js create mode 100644 imports/codemirror/mode/less/index.html create mode 100644 imports/codemirror/mode/less/less.js mode change 100755 => 100644 imports/codemirror/mode/lua/index.html mode change 100755 => 100644 imports/codemirror/mode/lua/lua.js mode change 100755 => 100644 imports/codemirror/mode/markdown/index.html mode change 100755 => 100644 imports/codemirror/mode/markdown/markdown.js create mode 100644 imports/codemirror/mode/mysql/index.html create mode 100644 imports/codemirror/mode/mysql/mysql.js mode change 100755 => 100644 imports/codemirror/mode/ntriples/index.html mode change 100755 => 100644 imports/codemirror/mode/ntriples/ntriples.js mode change 100755 => 100644 imports/codemirror/mode/pascal/LICENSE mode change 100755 => 100644 imports/codemirror/mode/pascal/index.html mode change 100755 => 100644 imports/codemirror/mode/pascal/pascal.js mode change 100755 => 100644 imports/codemirror/mode/perl/LICENSE mode change 100755 => 100644 imports/codemirror/mode/perl/index.html mode change 100755 => 100644 imports/codemirror/mode/perl/perl.js mode change 100755 => 100644 imports/codemirror/mode/php/index.html mode change 100755 => 100644 imports/codemirror/mode/php/php.js mode change 100755 => 100644 imports/codemirror/mode/plsql/index.html mode change 100755 => 100644 imports/codemirror/mode/plsql/plsql.js create mode 100755 imports/codemirror/mode/properties/index.html create mode 100755 imports/codemirror/mode/properties/properties.css create mode 100755 imports/codemirror/mode/properties/properties.js mode change 100755 => 100644 imports/codemirror/mode/python/LICENSE.txt mode change 100755 => 100644 imports/codemirror/mode/python/index.html mode change 100755 => 100644 imports/codemirror/mode/python/python.js mode change 100755 => 100644 imports/codemirror/mode/r/LICENSE mode change 100755 => 100644 imports/codemirror/mode/r/index.html mode change 100755 => 100644 imports/codemirror/mode/r/r.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/changes.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.css mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.js mode change 100755 => 100644 imports/codemirror/mode/rst/index.html mode change 100755 => 100644 imports/codemirror/mode/rst/rst.js mode change 100755 => 100644 imports/codemirror/mode/ruby/LICENSE mode change 100755 => 100644 imports/codemirror/mode/ruby/index.html mode change 100755 => 100644 imports/codemirror/mode/ruby/ruby.js mode change 100755 => 100644 imports/codemirror/mode/rust/index.html mode change 100755 => 100644 imports/codemirror/mode/rust/rust.js mode change 100755 => 100644 imports/codemirror/mode/scheme/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/smalltalk.js mode change 100755 => 100644 imports/codemirror/mode/sparql/index.html mode change 100755 => 100644 imports/codemirror/mode/sparql/sparql.js mode change 100755 => 100644 imports/codemirror/mode/stex/index.html mode change 100755 => 100644 imports/codemirror/mode/stex/stex.js mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/index.html mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.css mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.js mode change 100755 => 100644 imports/codemirror/mode/velocity/index.html mode change 100755 => 100644 imports/codemirror/mode/velocity/velocity.js create mode 100644 imports/codemirror/mode/verilog/index.html create mode 100644 imports/codemirror/mode/verilog/verilog.js mode change 100755 => 100644 imports/codemirror/mode/xml/index.html mode change 100755 => 100644 imports/codemirror/mode/xml/xml.js mode change 100755 => 100644 imports/codemirror/mode/xmlpure/index.html mode change 100755 => 100644 imports/codemirror/mode/xmlpure/xmlpure.js mode change 100755 => 100644 imports/codemirror/mode/yaml/index.html mode change 100755 => 100644 imports/codemirror/mode/yaml/yaml.js mode change 100755 => 100644 imports/codemirror/theme/cobalt.css mode change 100755 => 100644 imports/codemirror/theme/eclipse.css mode change 100755 => 100644 imports/codemirror/theme/elegant.css mode change 100755 => 100644 imports/codemirror/theme/monokai.css mode change 100755 => 100644 imports/codemirror/theme/neat.css mode change 100755 => 100644 imports/codemirror/theme/night.css mode change 100755 => 100644 imports/codemirror/theme/rubyblue.css diff --git a/imports/codemirror/LICENSE b/imports/codemirror/LICENSE old mode 100755 new mode 100644 index 3f7c0bb1..f62410e6 --- a/imports/codemirror/LICENSE +++ b/imports/codemirror/LICENSE @@ -17,3 +17,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Please note that some subdirectories of the CodeMirror distribution +include their own LICENSE files, and are released under different +licences. diff --git a/imports/codemirror/keymap/emacs.js b/imports/codemirror/keymap/emacs.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/keymap/vim.js b/imports/codemirror/keymap/vim.js old mode 100755 new mode 100644 index e03e0128..f8fa5e07 --- a/imports/codemirror/keymap/vim.js +++ b/imports/codemirror/keymap/vim.js @@ -1,5 +1,11 @@ (function() { var count = ""; + var sdir = "f"; + var buf = ""; + var yank = 0; + var mark = []; + function emptyBuffer() { buf = ""; } + function pushInBuffer(str) { buf += str; }; function pushCountDigit(digit) { return function(cm) {count += digit;} } function popCount() { var i = parseInt(count); count = ""; return i || 1; } function countTimes(func) { @@ -41,11 +47,64 @@ } cm.setCursor(cur.line, word[where == "end" ? "to" : "from"], true); } + function joinLineNext(cm) { + var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line); + CodeMirror.commands.goLineEnd(cm); + if (cur.line != cm.lineCount()) { + CodeMirror.commands.goLineEnd(cm); + cm.replaceSelection(" ", "end"); + CodeMirror.commands.delCharRight(cm); + } + } + function editCursor(mode) { + if (mode == "vim-insert") { + // put in your cursor css changing code + } else if (mode == "vim") { + // put in your cursor css changing code + } + } + function delTillMark(cm, cHar) { + var i = mark[cHar], l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l; + cm.setCursor(start); + for (var c = start; c <= end; c++) { + pushInBuffer("\n"+cm.getLine(start)); + cm.removeLine(start); + } + } + function yankTillMark(cm, cHar) { + var i = mark[cHar], l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l; + for (var c = start; c <= end; c++) { + pushInBuffer("\n"+cm.getLine(c)); + } + cm.setCursor(start); + } var map = CodeMirror.keyMap.vim = { "0": function(cm) {count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm);}, - "I": function(cm) {popCount(); cm.setOption("keyMap", "vim-insert");}, + "A": function(cm) {popCount(); cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, + "Shift-A": function(cm) {popCount(); CodeMirror.commands.goLineEnd(cm); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, + "I": function(cm) {popCount(); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, + "Shift-I": function(cm) {popCount(); CodeMirror.commands.goLineStartSmart(cm); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, + "O": function(cm) {popCount(); CodeMirror.commands.goLineEnd(cm); cm.replaceSelection("\n", "end"); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, + "Shift-O": function(cm) {popCount(); CodeMirror.commands.goLineStart(cm); cm.replaceSelection("\n", "start"); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");}, "G": function(cm) {cm.setOption("keyMap", "vim-prefix-g");}, + "D": function(cm) {cm.setOption("keyMap", "vim-prefix-d"); emptyBuffer();}, + "M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];}, + "Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;}, + "/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f"}, + "Shift-/": function(cm) { + var f = CodeMirror.commands.find; + if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; } + }, + "N": function(cm) { + var fn = CodeMirror.commands.findNext; + if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm); + }, + "Shift-N": function(cm) { + var fn = CodeMirror.commands.findNext; + if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm); + }, + "Shift-G": function(cm) {count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count)-1); popCount(); CodeMirror.commands.goLineStart(cm);}, catchall: function(cm) {/*ignore*/} }; // Add bindings for number keys @@ -60,17 +119,229 @@ "Shift-B": function(cm) {moveToWord(cm, bigWord, -1, "end");}, "Shift-E": function(cm) {moveToWord(cm, bigWord, 1, "end");}, "Shift-W": function(cm) {moveToWord(cm, bigWord, 1, "start");}, + "X": function(cm) {CodeMirror.commands.delCharRight(cm)}, + "P": function(cm) { + var cur = cm.getCursor().line; + if (buf!= "") { + CodeMirror.commands.goLineEnd(cm); + cm.replaceSelection(buf, "end"); + } + cm.setCursor(cur+1); + }, + "Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm)}, + "Shift-J": function(cm) {joinLineNext(cm)}, + "Shift-`": function(cm) { + var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1}); + cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase(); + cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1}); + cm.setCursor(cur.line, cur.ch+1); + }, + "Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm)}, + "Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm)}, + "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", "U": "undo", "Ctrl-R": "redo", "Shift-4": "goLineEnd"}, function(key, cmd) { map[key] = countTimes(cmd); }); CodeMirror.keyMap["vim-prefix-g"] = { "E": countTimes(function(cm) { moveToWord(cm, word, -1, "start");}), "Shift-E": countTimes(function(cm) { moveToWord(cm, bigWord, -1, "start");}), - auto: "vim", catchall: function(cm) {/*ignore*/} + auto: "vim", + catchall: function(cm) {/*ignore*/} + }; + + CodeMirror.keyMap["vim-prefix-m"] = { + "A": function(cm) {mark["A"] = cm.getCursor().line;}, + "Shift-A": function(cm) {mark["Shift-A"] = cm.getCursor().line;}, + "B": function(cm) {mark["B"] = cm.getCursor().line;}, + "Shift-B": function(cm) {mark["Shift-B"] = cm.getCursor().line;}, + "C": function(cm) {mark["C"] = cm.getCursor().line;}, + "Shift-C": function(cm) {mark["Shift-C"] = cm.getCursor().line;}, + "D": function(cm) {mark["D"] = cm.getCursor().line;}, + "Shift-D": function(cm) {mark["Shift-D"] = cm.getCursor().line;}, + "E": function(cm) {mark["E"] = cm.getCursor().line;}, + "Shift-E": function(cm) {mark["Shift-E"] = cm.getCursor().line;}, + "F": function(cm) {mark["F"] = cm.getCursor().line;}, + "Shift-F": function(cm) {mark["Shift-F"] = cm.getCursor().line;}, + "G": function(cm) {mark["G"] = cm.getCursor().line;}, + "Shift-G": function(cm) {mark["Shift-G"] = cm.getCursor().line;}, + "H": function(cm) {mark["H"] = cm.getCursor().line;}, + "Shift-H": function(cm) {mark["Shift-H"] = cm.getCursor().line;}, + "I": function(cm) {mark["I"] = cm.getCursor().line;}, + "Shift-I": function(cm) {mark["Shift-I"] = cm.getCursor().line;}, + "J": function(cm) {mark["J"] = cm.getCursor().line;}, + "Shift-J": function(cm) {mark["Shift-J"] = cm.getCursor().line;}, + "K": function(cm) {mark["K"]