Browse Source

Fix sorting with wrapper inside layers

pull/261/head
Artur Arseniev 9 years ago
parent
commit
c00c891c63
  1. 15
      src/commands/view/OpenLayers.js
  2. 15
      src/navigator/view/ItemsView.js

15
src/commands/view/OpenLayers.js

@ -3,7 +3,7 @@ var Layers = require('navigator');
module.exports = {
run(em, sender) {
if (!this.$layers) {
if (!this.toAppend) {
var collection = em.DomComponents.getComponent().get('components');
var config = em.getConfig();
var pfx = config.stylePrefix;
@ -14,8 +14,6 @@ module.exports = {
config.layers.pStylePrefix = config.stylePrefix;
config.layers.em = em.editor;
config.layers.opened = em.editor.get('opened');
var layers = new Layers().init(collection, config.layers);
this.$layers = layers.render();
// Check if panel exists otherwise crate it
if(!panels.getPanel('views-container'))
@ -24,14 +22,17 @@ module.exports = {
this.panel = panels.getPanel('views-container');
const toAppend = $(`<div class="${pfx}layers"></div>`);
toAppend.append(this.$layers);
this.panel.set('appendContent', toAppend).trigger('change:appendContent');
config.layers.sortContainer = toAppend.get(0);
const layers = new Layers().init(collection, config.layers);
this.$layers = layers.render();
toAppend.append(this.$layers);
this.toAppend = toAppend;
}
this.$layers.show();
this.toAppend.show();
},
stop() {
if(this.$layers)
this.$layers.hide();
this.toAppend && this.toAppend.hide();
}
};

15
src/navigator/view/ItemsView.js

@ -3,22 +3,23 @@ var ItemView = require('./ItemView');
module.exports = Backbone.View.extend({
initialize(o) {
initialize(o = {}) {
this.opt = o;
this.config = o.config;
const config = o.config || {};
this.config = config;
this.preview = o.preview;
this.ppfx = o.config.pStylePrefix || '';
this.pfx = o.config.stylePrefix || '';
this.ppfx = config.pStylePrefix || '';
this.pfx = config.stylePrefix || '';
this.parent = o.parent;
this.listenTo(this.collection, 'add', this.addTo);
this.listenTo(this.collection, 'reset resetNavigator', this.render);
this.className = this.pfx + 'items';
if(this.config.sortable && !this.opt.sorter){
if (config.sortable && !this.opt.sorter) {
var pfx = this.pfx;
var utils = this.config.em.get('Utils');
var utils = config.em.get('Utils');
this.opt.sorter = new utils.Sorter({
container: this.el,
container: config.sortContainer || this.el,
containerSel: '.' + pfx + 'items',
itemSel: '.' + pfx + 'item',
ppfx: this.ppfx,

Loading…
Cancel
Save