diff --git a/src/asset_manager/model/Asset.js b/src/asset_manager/model/Asset.js index 553b29d6a..d4e51c5d6 100644 --- a/src/asset_manager/model/Asset.js +++ b/src/asset_manager/model/Asset.js @@ -1,8 +1,5 @@ define(['backbone'], function (Backbone) { - /** - * @class Asset - * */ return Backbone.Model.extend({ idAttribute: 'src', @@ -14,8 +11,8 @@ define(['backbone'], /** * Get filename of the asset - * - * @return {String} + * @return {string} + * @private * */ getFilename: function(){ return this.get('src').split('/').pop(); @@ -23,8 +20,8 @@ define(['backbone'], /** * Get extension of the asset - * - * @return {String} + * @return {string} + * @private * */ getExtension: function(){ return this.getFilename().split('.').pop(); diff --git a/src/asset_manager/model/AssetImage.js b/src/asset_manager/model/AssetImage.js index 09d8e9e9c..1c99f3d8d 100644 --- a/src/asset_manager/model/AssetImage.js +++ b/src/asset_manager/model/AssetImage.js @@ -1,8 +1,5 @@ define(['backbone', './Asset'], function (Backbone, Asset) { - /** - * @class AssetImage - * */ return Asset.extend({ defaults: _.extend({}, Asset.prototype.defaults, { diff --git a/src/asset_manager/model/Assets.js b/src/asset_manager/model/Assets.js index db83bf2c2..189dbd8a0 100644 --- a/src/asset_manager/model/Assets.js +++ b/src/asset_manager/model/Assets.js @@ -1,8 +1,5 @@ define(['backbone', './Asset', './AssetImage'], function (Backbone, Asset, AssetImage) { - /** - * @class Assets - * */ return Backbone.Collection.extend({ model: AssetImage, diff --git a/src/asset_manager/view/AssetImageView.js b/src/asset_manager/view/AssetImageView.js index 52d9b9440..d11946d06 100644 --- a/src/asset_manager/view/AssetImageView.js +++ b/src/asset_manager/view/AssetImageView.js @@ -1,8 +1,5 @@ define(['./AssetView','text!./../template/assetImage.html'], function (AssetView, assetTemplate) { - /** - * @class AssetImageView - * */ return AssetView.extend({ events:{ @@ -21,8 +18,7 @@ define(['./AssetView','text!./../template/assetImage.html'], /** * Trigger when asset is been selected - * - * @return void + * @private * */ selected: function(){ this.model.collection.trigger('deselectAll'); @@ -33,8 +29,7 @@ define(['./AssetView','text!./../template/assetImage.html'], /** * Trigger when asset is been chosen (double clicked) - * - * @return void + * @private * */ chosen: function(){ this.updateTarget(this.model.get('src')); @@ -47,8 +42,7 @@ define(['./AssetView','text!./../template/assetImage.html'], /** * Update target if exists * @param {String} v Value - * - * @return void + * @private * */ updateTarget: function(v){ var target = this.model.collection.target; @@ -61,8 +55,7 @@ define(['./AssetView','text!./../template/assetImage.html'], /** * Remove asset from collection - * - * @return void + * @private * */ removeItem: function(e){ e.stopPropagation(); diff --git a/src/asset_manager/view/AssetsView.js b/src/asset_manager/view/AssetsView.js index 1301c5266..4d6290792 100644 --- a/src/asset_manager/view/AssetsView.js +++ b/src/asset_manager/view/AssetsView.js @@ -1,8 +1,5 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!./../template/assets.html'], function (Backbone, AssetView, AssetImageView, FileUploader, assetsTemplate) { - /** - * @class AssetsView - * */ return Backbone.View.extend({ template: _.template(assetsTemplate), @@ -25,6 +22,7 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!. * Add new asset to the collection via string * @param {Event} e Event object * @return {this} + * @private */ addFromStr: function(e){ e.preventDefault(); @@ -67,6 +65,7 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!. /** * Add asset to collection + * @private * */ addToAsset: function(model){ this.addAsset(model); @@ -76,8 +75,8 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!. * Add new asset to collection * @param Object Model * @param Object Fragment collection - * * @return Object Object created + * @private * */ addAsset: function(model, fragmentEl){ var fragment = fragmentEl || null; @@ -105,8 +104,7 @@ define(['backbone', './AssetView', './AssetImageView', './FileUploader', 'text!. /** * Deselect all assets - * - * @return void + * @private * */ deselectAll: function(){ this.$el.find('.' + this.pfx + 'highlight').removeClass(this.pfx + 'highlight'); diff --git a/src/asset_manager/view/FileUploader.js b/src/asset_manager/view/FileUploader.js index d80ed95d4..4b156a1ea 100644 --- a/src/asset_manager/view/FileUploader.js +++ b/src/asset_manager/view/FileUploader.js @@ -1,9 +1,5 @@ define(['backbone', 'text!./../template/fileUploader.html'], function (Backbone, fileUploaderTemplate) { - /** - * @class FileUploader - * */ - return Backbone.View.extend({ template: _.template(fileUploaderTemplate), @@ -24,8 +20,7 @@ define(['backbone', 'text!./../template/fileUploader.html'], /** * Upload files * @param {Object} e Event - * - * @return void + * @private * */ uploadFile : function(e){ var files = e.dataTransfer ? e.dataTransfer.files : e.target.files, @@ -60,8 +55,7 @@ define(['backbone', 'text!./../template/fileUploader.html'], /** * Make input file droppable - * - * @return void + * @private * */ initDrop: function(){ var that = this; diff --git a/src/block_manager/main.js b/src/block_manager/main.js index 55436d7b5..60d7a740e 100644 --- a/src/block_manager/main.js +++ b/src/block_manager/main.js @@ -1,5 +1,4 @@ /** - * * [init](#init) * * [add](#add) * * [get](#get) * * [getAll](#getall) @@ -14,6 +13,17 @@ * ``` * * @module BlockManager + * @param {Object} config Configurations + * @param {Array} [config.blocks=[]] Default blocks + * @example + * ... + * { + * blocks: [ + * {id:'h1-block' label: 'Heading', content:'

...

'}, + * ... + * ], + * } + * ... */ define(function(require) { @@ -36,17 +46,8 @@ define(function(require) { /** * Initialize module. Automatically called with a new instance of the editor * @param {Object} config Configurations - * @param {Array} [config.blocks=[]] Default blocks * @return {this} - * @example - * ... - * { - * blocks: [ - * {id:'h1-block' label: 'Heading', content:'

...

'}, - * ... - * ], - * } - * ... + * @private */ init: function(config) { c = config || {}; diff --git a/src/css_composer/main.js b/src/css_composer/main.js index 4857e05b8..0821179a4 100644 --- a/src/css_composer/main.js +++ b/src/css_composer/main.js @@ -6,7 +6,7 @@ * * [store](#store) * * This module contains and manage CSS rules for the template inside the canvas - * Before using methods you should get first the module from the editor instance, in this way: + * Before using the methods you should get first the module from the editor instance, in this way: * * ```js * var cssComposer = editor.CssComposer; @@ -59,7 +59,7 @@ define(function(require) { }, /** - * Initialize module. Automatically called with a new instance of the editor + * Initializes module. Automatically called with a new instance of the editor * @param {Object} config Configurations * @private */ @@ -177,7 +177,7 @@ define(function(require) { }, /** - * Get rule + * Get the rule * @param {Array} selectors Array of selectors * @param {String} state Css rule state * @param {String} width For which device this style is oriented @@ -213,7 +213,7 @@ define(function(require) { }, /** - * Render block of CSS rules + * Render the block of CSS rules * @return {HTMLElement} * @private */ diff --git a/src/css_composer/model/CssRule.js b/src/css_composer/model/CssRule.js index ddccd0e94..464f60ff8 100644 --- a/src/css_composer/model/CssRule.js +++ b/src/css_composer/model/CssRule.js @@ -1,8 +1,5 @@ define(['backbone', './Selectors'], function (Backbone, Selectors) { - /** - * @class CssRule - * */ return Backbone.Model.extend({ defaults: { @@ -38,8 +35,8 @@ define(['backbone', './Selectors'], * @param {Object} selectors Collection of selectors * @param {String} state Css rule state * @param {String} width For which device this style is oriented - * * @return {Boolean} + * @private */ compare: function(selectors, state, width){ var st = state || ''; diff --git a/src/css_composer/model/CssRules.js b/src/css_composer/model/CssRules.js index 4167e7199..e37bf3db0 100644 --- a/src/css_composer/model/CssRules.js +++ b/src/css_composer/model/CssRules.js @@ -1,8 +1,5 @@ define(['backbone','./CssRule'], function (Backbone, CssRule) { - /** - * @class CssRules - * */ return Backbone.Collection.extend({ initialize: function(models, opt){ diff --git a/src/css_composer/model/Selectors.js b/src/css_composer/model/Selectors.js index 0df48c182..5c7bef5eb 100644 --- a/src/css_composer/model/Selectors.js +++ b/src/css_composer/model/Selectors.js @@ -1,9 +1,5 @@ define([ 'backbone', 'require'], function (Backbone, require) { - /** - * @class Selectors - * */ - return Backbone.Collection.extend({ initialize: function(models, opt){ diff --git a/src/css_composer/view/CssRuleView.js b/src/css_composer/view/CssRuleView.js index 837f184bb..8c8649c14 100644 --- a/src/css_composer/view/CssRuleView.js +++ b/src/css_composer/view/CssRuleView.js @@ -1,8 +1,5 @@ define(['backbone'], function (Backbone) { - /** - * @class CssRuleView - * */ return Backbone.View.extend({ tagName: 'style', @@ -18,6 +15,7 @@ define(['backbone'], /** * Triggered when some selector is changed + * @private */ selChanged: function(){ this.selStr = this.renderSelectors(); @@ -26,8 +24,8 @@ define(['backbone'], /** * Returns string of selectors - * * @return {String} + * @private */ renderSelectors: function(){ var sel = []; @@ -39,8 +37,8 @@ define(['backbone'], /** * Returns string of properties - * * @return {String} + * @private */ renderProperties: function(){ var sel = [], diff --git a/src/css_composer/view/CssRulesView.js b/src/css_composer/view/CssRulesView.js index fa65f85f8..281eed27a 100644 --- a/src/css_composer/view/CssRulesView.js +++ b/src/css_composer/view/CssRulesView.js @@ -1,8 +1,5 @@ define(['backbone','./CssRuleView'], function (Backbone, CssRuleView) { - /** - * @class CssRulesView - * */ return Backbone.View.extend({ initialize: function(o) { @@ -16,6 +13,7 @@ define(['backbone','./CssRuleView'], /** * Add to collection * @param {Object} model + * @private * */ addTo: function(model){ //console.log('Added'); @@ -26,8 +24,8 @@ define(['backbone','./CssRuleView'], * Add new object to collection * @param {Object} model * @param {Object} fragmentEl - * * @return {Object} + * @private * */ addToCollection: function(model, fragmentEl){ var fragment = fragmentEl || null; diff --git a/src/modal_dialog/main.js b/src/modal_dialog/main.js index 4bda5388a..66aff4407 100644 --- a/src/modal_dialog/main.js +++ b/src/modal_dialog/main.js @@ -62,7 +62,7 @@ define(function(require) { }, /** - * Open modal window + * Open the modal window * @return {this} */ open: function(){ @@ -71,7 +71,7 @@ define(function(require) { }, /** - * Close modal window + * Close the modal window * @return {this} */ close: function(){ @@ -80,7 +80,7 @@ define(function(require) { }, /** - * Checks if modal window is open + * Checks if the modal window is open * @return {Boolean} */ isOpen: function(){ @@ -88,7 +88,7 @@ define(function(require) { }, /** - * Set title to the modal window + * Set the title to the modal window * @param {string} title Title * @return {this} * @example @@ -100,7 +100,7 @@ define(function(require) { }, /** - * Returns title of the modal window + * Returns the title of the modal window * @return {string} */ getTitle: function(){ @@ -108,7 +108,7 @@ define(function(require) { }, /** - * Set content of the modal window + * Set the content of the modal window * @param {string|HTMLElement} content Content * @return {this} * @example @@ -120,7 +120,7 @@ define(function(require) { }, /** - * Get content of the modal window + * Get the content of the modal window * @return {string} */ getContent: function(){ diff --git a/src/selector_manager/main.js b/src/selector_manager/main.js index 56101575a..d76fb3e24 100644 --- a/src/selector_manager/main.js +++ b/src/selector_manager/main.js @@ -1,9 +1,7 @@ /** - * * [init](#init) * * [add](#add) * * [get](#get) * * [getAll](#getall) - * * [render](#render) * * Selectors in GrapesJS are used in CSS Composer inside Rules and in Components as classes. To get better this concept let's take * a look at this code: @@ -33,6 +31,26 @@ * ``` * * @module SelectorManager + * @param {Object} config Configurations + * @param {Array} [config.selectors=[]] Default selectors + * @param {Array} [config.states=[]] Default states + * @param {String} [config.label='Classes'] Classes label + * @param {String} [config.statesLabel='- State -'] The empty state label + * @return {this} + * @example + * ... + * { + * selectors: [ + * {name:'myselector1'}, + * ... + * ], + * states: [{ + * name: 'hover', label: 'Hover' + * },{ + * name: 'active', label: 'Click' + * }], + * statesLabel: '- Selecte State -', + * } */ define(function(require) { @@ -55,25 +73,8 @@ define(function(require) { /** * Initialize module. Automatically called with a new instance of the editor * @param {Object} config Configurations - * @param {Array} [config.selectors=[]] Default selectors - * @param {Array} [config.states=[]] Default states - * @param {String} [config.label='Classes'] Classes label - * @param {String} [config.statesLabel='- State -'] The empty state label * @return {this} - * @example - * ... - * { - * selectors: [ - * {name:'myselector1'}, - * ... - * ], - * states: [{ - * name: 'hover', label: 'Hover' - * },{ - * name: 'active', label: 'Click' - * }], - * statesLabel: '- Selecte State -', - * } + * @private */ init: function(conf) { c = conf || {}; @@ -96,7 +97,7 @@ define(function(require) { }, /** - * Add new selector to collection if it's not already exists. Class type is a default one + * Add the new selector to collection if it's not already exists. Class type is a default one * @param {String} name Selector name * @param {Object} opts Selector options * @param {String} [opts.label=''] Label for the selector, if it's not provided the label will be the same as the name @@ -117,7 +118,7 @@ define(function(require) { }, /** - * Get selector by its name + * Get the selector by its name * @param {String} name Selector name * @return {Model|null} * @example @@ -129,7 +130,7 @@ define(function(require) { /** * Get all selectors - * @return {Collection} + * @return {Collection} * */ getAll: function() { return selectors; @@ -139,6 +140,7 @@ define(function(require) { * Render class selectors. If an array of selectors is provided a new instance of the collection will be rendered * @param {Array} selectors * @return {HTMLElement} + * @private */ render: function(selectors) { if(selectors){ diff --git a/src/selector_manager/model/Selector.js b/src/selector_manager/model/Selector.js index 47f6ff166..8f17945f9 100644 --- a/src/selector_manager/model/Selector.js +++ b/src/selector_manager/model/Selector.js @@ -21,8 +21,8 @@ define(['backbone'], /** * Escape string * @param {string} name - * * @return {string} + * @private */ escapeName: function(name) { return name.toLowerCase().replace(/([^a-z0-9\w]+)/gi, '-'); diff --git a/src/selector_manager/view/ClassTagView.js b/src/selector_manager/view/ClassTagView.js index ecbaadb5a..fe204f50e 100644 --- a/src/selector_manager/view/ClassTagView.js +++ b/src/selector_manager/view/ClassTagView.js @@ -1,8 +1,5 @@ define(['backbone', 'text!./../template/classTag.html'], function (Backbone, tagTemplate) { - /** - * @class ClassTagView - * */ return Backbone.View.extend({ template: _.template(tagTemplate), @@ -32,6 +29,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * Start editing tag + * @private */ startEditTag: function(){ this.$labelInput.prop(this.inputProp, false); @@ -40,6 +38,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * End editing tag. If the class typed already exists the * old one will be restored otherwise will be changed + * @private */ endEditTag: function(){ var value = this.$labelInput.val(); @@ -60,6 +59,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * Update status of the tag + * @private */ changeStatus: function(){ this.model.set('active', !this.model.get('active')); @@ -69,6 +69,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * Remove tag from the selected component * @param {Object} e + * @private */ removeTag: function(e){ var comp = this.target.get('selectedComponent'); @@ -86,6 +87,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * Update status of the checkbox + * @private */ updateStatus: function(){ if(!this.$chk) @@ -102,6 +104,7 @@ define(['backbone', 'text!./../template/classTag.html'], /** * Update label's input + * @private */ updateInputLabel: function(){ if(!this.$labelInput) @@ -111,7 +114,7 @@ define(['backbone', 'text!./../template/classTag.html'], this.$labelInput.attr('size', size); }, - /** @inheritdoc */ + render : function(){ this.$el.html( this.template({ label: this.model.get('label'), diff --git a/src/selector_manager/view/ClassTagsView.js b/src/selector_manager/view/ClassTagsView.js index aaf3e91c4..73ac30d35 100644 --- a/src/selector_manager/view/ClassTagsView.js +++ b/src/selector_manager/view/ClassTagsView.js @@ -1,8 +1,5 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], function (Backbone, tagsTemplate, ClassTagView) { - /** - * @class ClassTagsView - * */ return Backbone.View.extend({ template: _.template(tagsTemplate), @@ -39,6 +36,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Triggered when a tag is removed from collection * @param {Object} model Removed model + * @private */ tagRemoved: function(model){ this.updateStateVis(); @@ -47,6 +45,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Create select input with states * @return {string} String of options + * @private */ getStateOptions: function(){ var strInput = ''; @@ -59,6 +58,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Add new model * @param {Object} model + * @private */ addNew: function(model){ this.addToClasses(model); @@ -67,7 +67,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Start tag creation * @param {Object} e - * + * @private */ startNewTag: function(e) { this.$addBtn.hide(); @@ -77,7 +77,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * End tag creation * @param {Object} e - * + * @private */ endNewTag: function(e) { this.$addBtn.show(); @@ -87,6 +87,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Checks what to do on keyup event * @param {Object} e + * @private */ onInputKeyUp: function(e) { if (e.keyCode === 13) @@ -98,6 +99,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Triggered when component is changed * @param {Object} e + * @private */ componentChanged: function(e){ this.compTarget = this.target.get('selectedComponent'); @@ -111,6 +113,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Update states visibility. Hides states in case there is no tags * inside collection + * @private */ updateStateVis: function(){ if(this.collection.length) @@ -145,6 +148,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Triggered when the select with states is changed * @param {Object} e + * @private */ stateChanged: function(e){ if(this.compTarget){ @@ -158,6 +162,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Add new tag to collection, if possible, and to the component * @param {Object} e + * @private */ addNewTag: function(name){ if(!name) @@ -187,8 +192,8 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], * Add new object to collection * @param {Object} model Model * @param {Object} fragmentEl Fragment collection - * * @return {Object} Object created + * @private * */ addToClasses: function(model, fragmentEl) { var fragment = fragmentEl || null; @@ -211,6 +216,7 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], /** * Render the collection of classes * @return {this} + * @private */ renderClasses: function() { var fragment = document.createDocumentFragment(); @@ -258,8 +264,6 @@ define(['backbone', 'text!./../template/classTags.html', './ClassTagView'], return this.$statesC; }, - - /** @inheritdoc */ render : function(){ this.$el.html( this.template({ label: this.config.label,