From: Aleksander Ɓukasz Date: Thu, 6 Jun 2013 14:25:39 +0000 (+0200) Subject: Moving sourceEditor module to its own directory with its own styles X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/ccd0a4f745a6fab17a228d822e80d8bbb6fa7d5d?ds=inline Moving sourceEditor module to its own directory with its own styles --- diff --git a/modules.js b/modules.js index 1727e00..d8e32f5 100644 --- a/modules.js +++ b/modules.js @@ -9,7 +9,7 @@ define(function(require) { mainBar: require('modules/mainBar/mainBar'), indicator: require('modules/indicator/indicator'), - sourceEditor: require('modules/sourceEditor'), + sourceEditor: require('modules/sourceEditor/sourceEditor'), visualEditor: require('modules/visualEditor'), documentCanvas: require('modules/documentCanvas/documentCanvas'), diff --git a/modules/sourceEditor.js b/modules/sourceEditor.js deleted file mode 100644 index 248c02d..0000000 --- a/modules/sourceEditor.js +++ /dev/null @@ -1,43 +0,0 @@ -define(function() { - -return function(sandbox) { - - var view = $(sandbox.getTemplate('main')()); - var isDirty = false; - - var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]); - editor.setTheme("ace/theme/chrome"); - editor.getSession().setMode("ace/mode/xml"); - $('textarea', view).on('keyup', function() { - isDirty = true; - }); - - editor.getSession().on('change', function() { - isDirty = true; - }) - return { - start: function() { - sandbox.publish('ready'); - }, - getView: function() { - return view; - }, - setDocument: function(document) { - editor.setValue(document); - editor.gotoLine(0) - isDirty = false; - }, - getDocument: function() { - return editor.getValue(); - }, - isDirty: function() { - return isDirty; - }, - setDirty: function(dirty) { - isDirty = dirty; - } - - } -}; - -}); \ No newline at end of file diff --git a/modules/sourceEditor/sourceEditor.js b/modules/sourceEditor/sourceEditor.js new file mode 100644 index 0000000..248c02d --- /dev/null +++ b/modules/sourceEditor/sourceEditor.js @@ -0,0 +1,43 @@ +define(function() { + +return function(sandbox) { + + var view = $(sandbox.getTemplate('main')()); + var isDirty = false; + + var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]); + editor.setTheme("ace/theme/chrome"); + editor.getSession().setMode("ace/mode/xml"); + $('textarea', view).on('keyup', function() { + isDirty = true; + }); + + editor.getSession().on('change', function() { + isDirty = true; + }) + return { + start: function() { + sandbox.publish('ready'); + }, + getView: function() { + return view; + }, + setDocument: function(document) { + editor.setValue(document); + editor.gotoLine(0) + isDirty = false; + }, + getDocument: function() { + return editor.getValue(); + }, + isDirty: function() { + return isDirty; + }, + setDirty: function(dirty) { + isDirty = dirty; + } + + } +}; + +}); \ No newline at end of file diff --git a/modules/sourceEditor/sourceEditor.less b/modules/sourceEditor/sourceEditor.less new file mode 100644 index 0000000..a62e9dd --- /dev/null +++ b/modules/sourceEditor/sourceEditor.less @@ -0,0 +1,4 @@ +#rng-sourceEditor-editor { + width: 940px; + height: 500px; +} \ No newline at end of file diff --git a/styles/main.less b/styles/main.less index 6d44f45..040ff6f 100644 --- a/styles/main.less +++ b/styles/main.less @@ -3,6 +3,7 @@ @import '../modules/rng/rng.less'; @import '../modules/documentCanvas/documentCanvas.less'; +@import '../modules/sourceEditor/sourceEditor.less'; @import '../modules/mainBar/mainBar.less'; @import '../modules/documentToolbar/documentToolbar.less'; @import '../modules/indicator/indicator.less';