small improvements

This commit is contained in:
Murod Khaydarov 2018-06-24 05:06:49 +03:00
commit ad78d12259
No known key found for this signature in database
GPG key ID: C480BA53A8D274C5
9 changed files with 34 additions and 44 deletions

View file

@ -935,7 +935,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var DeleteTune = function () {
/**
* MoveUpTune constructor
* DeleteTune constructor
*
* @param {Object} api
*/
@ -985,7 +985,7 @@ var DeleteTune = function () {
return deleteButton;
}
/**
* Move current block up
* Delete block conditions passed
* @param {MouseEvent} event
*/
@ -2019,11 +2019,9 @@ var BlocksAPI = function (_Module) {
}, {
key: 'delete',
value: function _delete(blockIndex) {
if (!blockIndex) {
this.Editor.BlockManager.removeBlock();
this.Editor.Toolbar.close();
this.Editor.BlockManager.navigatePrevious(true);
}
this.Editor.BlockManager.removeBlock(blockIndex);
this.Editor.Toolbar.close();
this.Editor.BlockManager.navigatePrevious(true);
}
}, {
key: 'methods',
@ -2077,7 +2075,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @class ToolbarsApi
* @class EventsAPI
* provides with methods working with Toolbar
*/
var EventsAPI = function (_Module) {
@ -2096,7 +2094,7 @@ var EventsAPI = function (_Module) {
}
/**
* Available methods
* @return {IBlocksAPI}
* @return {IEventsAPI}
*/
@ -2113,7 +2111,6 @@ var EventsAPI = function (_Module) {
}
/**
* Emit event with data
*
* @param {String} eventName
* @param {Object} data
*/
@ -2125,7 +2122,6 @@ var EventsAPI = function (_Module) {
}
/**
* Unsubscribe from Event
*
* @param {String} eventName
* @param {Function} callback
*/
@ -2261,7 +2257,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @class ToolbarsApi
* @class ToolbarsAPI
* provides with methods working with Toolbar
*/
var ToolbarsAPI = function (_Module) {
@ -2280,7 +2276,7 @@ var ToolbarsAPI = function (_Module) {
}
/**
* Available methods
* @return {IBlocksAPI}
* @return {IToolbarAPI}
*/
@ -3519,7 +3515,7 @@ var Events = function (_Module) {
}
this.subscribers[eventName].reduce(function (previousData, currentHandler) {
var newData = currentHandler.call(currentHandler, previousData);
var newData = currentHandler(previousData);
return newData ? newData : previousData;
}, data);
@ -4656,7 +4652,6 @@ var BlockSettings = function (_Module) {
/**
* @constructor
* @param config
*/
function BlockSettings(_ref) {
var config = _ref.config;

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
# CodeX Editor Events Module
Module allows Developers subscribe on events or trigger callbacks
Module allows Developers to subscribe on events or trigger own events
## Methods

View file

@ -1,5 +1,5 @@
/**
* @class MoveUpTune
* @class DeleteTune
* @classdesc Editor's default tune that moves up selected block
*
* @copyright <CodeX Team> 2018
@ -31,19 +31,7 @@ export default class DeleteTune implements IBlockTune {
private needConfirmation: boolean;
/**
* set false confirmation state
*/
private resetConfirmation: () => void;
/**
* change tune state
*/
private setConfirmation(state): void {
this.needConfirmation = state;
}
/**
* MoveUpTune constructor
* DeleteTune constructor
*
* @param {Object} api
*/
@ -55,6 +43,18 @@ export default class DeleteTune implements IBlockTune {
};
}
/**
* change tune state
*/
private setConfirmation(state): void {
this.needConfirmation = state;
}
/**
* set false confirmation state
*/
private resetConfirmation: () => void;
/**
* Create "Delete" button and add click event listener
* @returns [Element}
@ -66,7 +66,7 @@ export default class DeleteTune implements IBlockTune {
}
/**
* Move current block up
* Delete block conditions passed
* @param {MouseEvent} event
*/
public handleClick(event: MouseEvent): void {

View file

@ -47,11 +47,9 @@ export default class BlocksAPI extends Module implements IBlocksAPI {
* @param blockIndex
*/
public delete(blockIndex?: number): void {
if (!blockIndex) {
this.Editor.BlockManager.removeBlock();
this.Editor.Toolbar.close();
this.Editor.BlockManager.navigatePrevious(true);
}
this.Editor.BlockManager.removeBlock(blockIndex);
this.Editor.Toolbar.close();
this.Editor.BlockManager.navigatePrevious(true);
}
}

View file

@ -3,7 +3,7 @@ declare var Module: any;
import { IEventsAPI } from '../interfaces/api';
/**
* @class ToolbarsApi
* @class EventsAPI
* provides with methods working with Toolbar
*/
export default class EventsAPI extends Module implements IEventsAPI {
@ -18,7 +18,7 @@ export default class EventsAPI extends Module implements IEventsAPI {
/**
* Available methods
* @return {IBlocksAPI}
* @return {IEventsAPI}
*/
get methods(): IEventsAPI {
return {
@ -39,7 +39,6 @@ export default class EventsAPI extends Module implements IEventsAPI {
/**
* Emit event with data
*
* @param {String} eventName
* @param {Object} data
*/
@ -49,7 +48,6 @@ export default class EventsAPI extends Module implements IEventsAPI {
/**
* Unsubscribe from Event
*
* @param {String} eventName
* @param {Function} callback
*/

View file

@ -3,7 +3,7 @@ declare var Module: any;
import { IToolbarAPI } from '../interfaces/api';
/**
* @class ToolbarsApi
* @class ToolbarsAPI
* provides with methods working with Toolbar
*/
export default class ToolbarsAPI extends Module implements IToolbarAPI {
@ -18,7 +18,7 @@ export default class ToolbarsAPI extends Module implements IToolbarAPI {
/**
* Available methods
* @return {IBlocksAPI}
* @return {IToolbarAPI}
*/
get methods(): IToolbarAPI {
return {

View file

@ -47,7 +47,7 @@ export default class Events extends Module {
}
this.subscribers[eventName].reduce(function (previousData, currentHandler) {
let newData = currentHandler.call(currentHandler, previousData);
let newData = currentHandler(previousData);
return newData ? newData : previousData;
}, data);

View file

@ -12,7 +12,6 @@
export default class BlockSettings extends Module {
/**
* @constructor
* @param config
*/
constructor({config}) {
super({config});