diff --git a/README.md b/README.md index 6c0188412..e51db6e7b 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ $ npm run build Launch server, which also gonna watch some files, and try out the demo on `localhost:8000` ```sh -$ npm run dev +$ npm start ``` Tests are already available inside browser on `localhost:8000/test` @@ -126,7 +126,7 @@ Check the getting started guide here: [wiki] ## API -API References (draft) could be found here: [wiki/API-Reference] +API References (draft) could be found here: [API-Reference] ## Testing @@ -171,4 +171,5 @@ BSD 3-clause [Spectrum]: [FontAwesome]: [wiki]: +[API-Reference]: [CMS]: \ No newline at end of file diff --git a/package.json b/package.json index 178647831..2bca12324 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,6 @@ "postinstall": "node ./node_modules/bower/bin/bower install --config.interactive=false", "build": "./node_modules/.bin/grunt build", "test": "./node_modules/.bin/grunt test", - "dev": "./node_modules/.bin/grunt dev" + "start": "./node_modules/.bin/grunt dev" } } diff --git a/src/block_manager/view/BlockView.js b/src/block_manager/view/BlockView.js index 9b945ebc8..9d1949227 100644 --- a/src/block_manager/view/BlockView.js +++ b/src/block_manager/view/BlockView.js @@ -3,13 +3,15 @@ function(Backbone) { return Backbone.View.extend({ - initialize: function(o) { - this.config = o.config || {}; + initialize: function(o, config) { + this.config = config || {}; + this.ppfx = this.config.pStylePrefix || ''; this.listenTo(this.model, 'destroy', this.remove); }, render: function() { this.el.innerHTML = this.model.get('label'); + this.$el.addClass(this.ppfx + 'block'); return this; }, diff --git a/src/commands/view/OpenBlocks.js b/src/commands/view/OpenBlocks.js index cbf22c766..f8dbdc417 100644 --- a/src/commands/view/OpenBlocks.js +++ b/src/commands/view/OpenBlocks.js @@ -7,7 +7,8 @@ define(function() { var pfx = config.stylePrefix; var bm = editor.BlockManager; if(!this.blocks){ - this.blocks = bm.render(); + this.blocks = $('
').get(0); + this.blocks.appendChild(bm.render()); var panels = editor.Panels; if(!panels.getPanel('views-container')) panelC = panels.addPanel({id: 'views-container'}); diff --git a/src/editor/config/config.js b/src/editor/config/config.js index f0f7864b2..e0c3fdb92 100644 --- a/src/editor/config/config.js +++ b/src/editor/config/config.js @@ -102,9 +102,10 @@ define(function () { id: 'b1', label: 'Block1', content: '

Block 1

', + attributes: { title: 'Block1', class:'b1-cl'} },{ id: 'b2', - label: 'Block2', + label: '♥ Block2', content: '

Block 2

', },{ id: 'b3', diff --git a/styles/css/main.css b/styles/css/main.css index 8b94714a8..fdb93e8e5 100644 --- a/styles/css/main.css +++ b/styles/css/main.css @@ -3393,6 +3393,27 @@ ol.example li.placeholder:before { filter: alpha(opacity=90); } /********* END Style Manager **********/ +/********* Block manager **********/ +.wte-blocks-c { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; } + +.wte-block { + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + width: 45%; + padding: 1em; + box-sizing: border-box; + height: 100px; + cursor: all-scroll; + margin: 2.5%; } + +/********* END Block manager **********/ /********* Class manager **********/ .wte-clm-tags { font-size: 11px; diff --git a/styles/scss/main.scss b/styles/scss/main.scss index 88aef5b82..6eca497a6 100644 --- a/styles/scss/main.scss +++ b/styles/scss/main.scss @@ -4,7 +4,7 @@ $app-prefix: 'wte-'; $nv-prefix: $app-prefix + 'nv-'; $rte-prefix: $app-prefix + 'rte-'; -$comp-prefix: $app-prefix + 'comp-'; +$comp-prefix: $app-prefix + 'comp-'; $mdl-prefix: $app-prefix + 'mdl-'; $am-prefix: $app-prefix + 'am-'; $cm-prefix: $app-prefix + 'cm-'; @@ -974,6 +974,29 @@ $arrowColor: $mainLhlColor; /*b1b1b1*/ } /********* END Style Manager **********/ + + +/********* Block manager **********/ + +.#{$app-prefix}blocks-c{ + display: flex; + flex-wrap: wrap; + justify-content: flex-start; +} +.#{$app-prefix}block{ + @include user-select(none); + width: 45%; + padding: 1em; + box-sizing: border-box; + height: 100px; + cursor:all-scroll; + margin: 2.5%; +} + +/********* END Block manager **********/ + + + /********* Class manager **********/ $addBtnBg: lighten($mainDkColor, 10%); $paddElClm: 5px 6px; diff --git a/test/specs/block_manager/view/BlocksView.js b/test/specs/block_manager/view/BlocksView.js index 0aecb005f..4a68aa0a0 100644 --- a/test/specs/block_manager/view/BlocksView.js +++ b/test/specs/block_manager/view/BlocksView.js @@ -77,7 +77,7 @@ define([path + 'BlocksView', 'BlockManager/model/Blocks'], view.el.children.length.should.equal(2); }); - it("Render children", function (){ + it("Render container", function (){ view.el.getAttribute('class').should.equal(ppfx + 'blocks-c'); });