Browse Source

Add default panels

pull/36/head
Artur Arseniev 10 years ago
parent
commit
deb3d47144
  1. 20
      src/commands/view/OpenStyleManager.js
  2. 2
      src/editor/main.js
  3. 18
      src/editor/model/Editor.js
  4. 17
      src/panels/config/config.js
  5. 2
      styles/css/main.css
  6. 2
      styles/scss/main.scss

20
src/commands/view/OpenStyleManager.js

@ -5,16 +5,11 @@ define(['StyleManager'], function(StyleManager) {
* */ * */
return { return {
run: function(em, sender) run: function(em, sender) {
{
this.sender = sender; this.sender = sender;
if(!this.$cn){ if(!this.$cn){
var config = em.getConfig(), var config = em.getConfig(),
panels = em.Panels, panels = em.Panels;
pfx = config.styleManager.stylePrefix || 'sm-';
config.styleManager.stylePrefix = config.stylePrefix + pfx;
config.styleManager.target = em.editor;
// Main container // Main container
this.$cn = $('<div/>'); this.$cn = $('<div/>');
@ -32,10 +27,7 @@ define(['StyleManager'], function(StyleManager) {
this.$cn2.append(this.$clm); this.$cn2.append(this.$clm);
} }
// Style Manager manager container this.$cn2.append(em.StyleManager.render());
this.sm = new StyleManager(config.styleManager);
this.$sm = this.sm.render();
this.$cn2.append(this.$sm);
// Create header // Create header
this.$header = $('<div>', { this.$header = $('<div>', {
@ -64,8 +56,7 @@ define(['StyleManager'], function(StyleManager) {
* Toggle Style Manager visibility * Toggle Style Manager visibility
* @private * @private
*/ */
toggleSm: function() toggleSm: function() {
{
if(!this.sender.get('active')) if(!this.sender.get('active'))
return; return;
if(this.target.get('selectedComponent')){ if(this.target.get('selectedComponent')){
@ -77,8 +68,7 @@ define(['StyleManager'], function(StyleManager) {
} }
}, },
stop: function() stop: function() {
{
// Hide secondary container if exists // Hide secondary container if exists
if(this.$cn2) if(this.$cn2)
this.$cn2.hide(); this.$cn2.hide();

2
src/editor/main.js

@ -100,7 +100,7 @@ define(function (require){
StyleManager: em.get('StyleManager'), StyleManager: em.get('StyleManager'),
/** /**
* @property {StyleManager} * @property {Canvas}
*/ */
Canvas: em.get('Canvas'), Canvas: em.get('Canvas'),

18
src/editor/model/Editor.js

@ -12,6 +12,7 @@ define([
'RichTextEditor', 'RichTextEditor',
'DomComponents', 'DomComponents',
'ClassManager', 'ClassManager',
'StyleManager',
'Panels', 'Panels',
'Parser', 'Parser',
'Utils'], 'Utils'],
@ -29,6 +30,7 @@ define([
RichTextEditor, RichTextEditor,
DomComponents, DomComponents,
ClassManager, ClassManager,
StyleManager,
Panels, Panels,
Parser, Parser,
Utils Utils
@ -66,6 +68,7 @@ define([
this.initCanvas(); this.initCanvas();
this.initUndoManager(); this.initUndoManager();
this.initUtils(); this.initUtils();
this.initStyleManager();
this.on('change:selectedComponent', this.componentSelected, this); this.on('change:selectedComponent', this.componentSelected, this);
}, },
@ -96,6 +99,19 @@ define([
this.set('Utils', this.Utils); this.set('Utils', this.Utils);
}, },
/**
* Initialize Style Manager
* @private
* */
initStyleManager: function(){
var cfg = this.config.styleManager,
pfx = cfg.stylePrefix || 'sm-';
cfg.pStylePrefix = this.config.stylePrefix;
cfg.stylePrefix = this.config.stylePrefix + pfx;
cfg.target = this;
this.set('StyleManager', new StyleManager(cfg));
},
/** /**
* Initialize Css Composer * Initialize Css Composer
* @private * @private
@ -337,7 +353,7 @@ define([
cfg.stylePrefix = this.config.stylePrefix + pfx; cfg.stylePrefix = this.config.stylePrefix + pfx;
cfg.em = this; cfg.em = this;
this.pn = new Panels(cfg); this.pn = new Panels(cfg);
this.pn.addPanel({ id: 'views-container'}); //this.pn.addPanel({ id: 'views-container'});
this.Panels = this.pn; this.Panels = this.pn;
this.set('Panels', this.pn); this.set('Panels', this.pn);
}, },

17
src/panels/config/config.js

@ -6,7 +6,8 @@ define(function () {
var imc = 'image-comp'; var imc = 'image-comp';
var swv = 'sw-visibility'; var swv = 'sw-visibility';
var expt = 'export-template'; var expt = 'export-template';
var osm = 'open-sm';
var ola = 'open-layers';
return { return {
stylePrefix: 'pn-', stylePrefix: 'pn-',
@ -54,6 +55,20 @@ define(function () {
command: expt, command: expt,
attributes: { title: 'View code' }, attributes: { title: 'View code' },
}], }],
},{
id: 'views',
buttons : [{
id: osm,
className: 'fa fa-paint-brush',
command: osm,
active: true,
attributes: { title: 'Open Style Manager' },
},{
id: ola,
className: 'fa fa-bars',
command: ola,
attributes : { title: 'Open Layer Manager' },
}],
}], }],
// Editor model // Editor model

2
styles/css/main.css

@ -2593,6 +2593,7 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
.wte-editor { .wte-editor {
font-family: Helvetica, sans-serif; font-family: Helvetica, sans-serif;
background-color: #444;
position: relative; position: relative;
border: 3px solid #444; border: 3px solid #444;
border-left: none; border-left: none;
@ -2612,6 +2613,7 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
z-index: 1; z-index: 1;
/* This simulate body behaviour */ } /* This simulate body behaviour */ }
.wte-cv-canvas > div { .wte-cv-canvas > div {
background-color: #fff;
position: relative; position: relative;
height: 100%; height: 100%;
overflow: auto; overflow: auto;

2
styles/scss/main.scss

@ -78,6 +78,7 @@ $imageCompDim: 50px;
} }
.#{$app-prefix}editor{ .#{$app-prefix}editor{
font-family: $mainFont; font-family: $mainFont;
background-color: $mainColor;
position:relative; position:relative;
border: 3px solid $mainColor; border: 3px solid $mainColor;
border-left:none; border-left:none;
@ -97,6 +98,7 @@ $imageCompDim: 50px;
/* This simulate body behaviour */ /* This simulate body behaviour */
> div { > div {
background-color: #fff;
position: relative; position: relative;
height: 100%; height: 100%;
overflow: auto; overflow: auto;

Loading…
Cancel
Save