diff --git a/dev/Common/HtmlEditor.jsx b/dev/Common/HtmlEditor.jsx
index 7bbce944a..0f3393918 100644
--- a/dev/Common/HtmlEditor.jsx
+++ b/dev/Common/HtmlEditor.jsx
@@ -3,6 +3,7 @@ import window from 'window';
import _ from '_';
import $ from '$';
import {htmlEditorDefaultConfig, htmlEditorLangsMap} from 'Common/Globals';
+import {EventKeyCode} from 'Common/Enums';
import * as Settings from 'Storage/Settings';
class HtmlEditor
@@ -268,7 +269,7 @@ class HtmlEditor
this.editor = window.CKEDITOR.appendTo(this.$element[0], config);
this.editor.on('key', (event) => {
- if (event && event.data && 9 /* Tab */ === event.data.keyCode)
+ if (event && event.data && EventKeyCode.Tab === event.data.keyCode)
{
return false;
}
@@ -412,4 +413,3 @@ class HtmlEditor
}
export {HtmlEditor, HtmlEditor as default};
-module.exports = HtmlEditor;
diff --git a/dev/External/ko.js b/dev/External/ko.js
index 886c1c8c4..424f24180 100644
--- a/dev/External/ko.js
+++ b/dev/External/ko.js
@@ -65,7 +65,7 @@ ko.bindingHandlers.editor = {
fUpdateEditorValue();
},
- HtmlEditor = require('Common/HtmlEditor');
+ HtmlEditor = require('Common/HtmlEditor').default;
if (ko.isObservable(fValue) && HtmlEditor)
{
diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js
index 12474eb8a..654b6c997 100644
--- a/dev/View/Popup/Compose.js
+++ b/dev/View/Popup/Compose.js
@@ -14,7 +14,7 @@ var
Globals = require('Common/Globals'),
Events = require('Common/Events'),
Links = require('Common/Links'),
- HtmlEditor = require('Common/HtmlEditor'),
+ HtmlEditor = require('Common/HtmlEditor').default,
Translator = require('Common/Translator'),
Momentor = require('Common/Momentor'),
diff --git a/dev/View/Popup/Template.js b/dev/View/Popup/Template.js
index 90f66b95b..b16e8b66b 100644
--- a/dev/View/Popup/Template.js
+++ b/dev/View/Popup/Template.js
@@ -6,7 +6,7 @@ var
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
- HtmlEditor = require('Common/HtmlEditor'),
+ HtmlEditor = require('Common/HtmlEditor').default,
Remote = require('Remote/User/Ajax'),
diff --git a/gulpfile.js b/gulpfile.js
index 991c933f3..6e050f1a5 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -33,6 +33,9 @@ var
path = require('path'),
notifier = require('node-notifier'),
+ webpack = require('webpack'),
+ webpackCfg = require('./webpack.config.js'),
+
gulp = require('gulp'),
concat = require('gulp-concat-util'),
header = require('gulp-header'),
@@ -50,6 +53,38 @@ var
gutil = require('gulp-util')
;
+// webpack
+if (webpackCfg && webpackCfg.output)
+{
+ webpackCfg.output.publicPath = cfg.paths.staticJS;
+}
+
+if (webpackCfg && webpackCfg.plugins)
+{
+ webpackCfg.plugins.push(new webpack.DefinePlugin({
+ 'RL_COMMUNITY': !!cfg.community,
+ 'process.env': {
+ NODE_ENV: '"production"'
+ }
+ }));
+}
+
+function webpackError(err) {
+ if (err)
+ {
+ gutil.log('[webpack]', '---');
+ gutil.log('[webpack]', err.error ? err.error.toString() : '');
+ gutil.log('[webpack]', err.message || '');
+ gutil.log('[webpack]', '---');
+
+ notifier.notify({
+ 'sound': true,
+ 'title': 'webpack',
+ 'message': err.error ? err.error.toString() : err.message
+ });
+ }
+}
+
function getHead()
{
return !cfg.community ? head.rainloop : head.agpl;
@@ -330,67 +365,25 @@ gulp.task('js:ckeditor:beautify', function() {
.pipe(gulp.dest(cfg.paths.static + 'ckeditor/'));
});
-gulp.task('js:webpack', [], function(callback) {
-
- var
- webpack = require('webpack'),
- webpackCfg = require('./webpack.config.js')
- ;
-
- if (webpackCfg && webpackCfg.output)
- {
- webpackCfg.output.publicPath = cfg.paths.staticJS;
- }
-
- if (webpackCfg && webpackCfg.plugins)
- {
- webpackCfg.plugins.push(new webpack.DefinePlugin({
- 'RL_COMMUNITY': !!cfg.community,
- 'process.env': {
- NODE_ENV: '"production"'
- }
- }));
- }
-
+gulp.task('js:webpack', function(callback) {
webpack(webpackCfg, function(err, stats) {
- var
- fN = function (err) {
- if (err)
- {
- gutil.log('[webpack]', '---');
- gutil.log('[webpack]', err.error ? err.error.toString() : '');
- gutil.log('[webpack]', err.message || '');
- gutil.log('[webpack]', '---');
-
- notifier.notify({
- 'sound': true,
- 'title': 'webpack',
- 'message': err.error ? err.error.toString() : err.message
- });
- }
- }
- ;
-
- if (err)
+ if (err)
{
if (cfg.watch)
{
- fN(err);
+ webpackError(err);
}
else
{
throw new gutil.PluginError('webpack', err);
}
}
- else if (stats && stats.compilation && stats.compilation.errors &&
- stats.compilation.errors[0])
+ else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0])
{
if (cfg.watch)
{
- _.each(stats.compilation.errors, function (err) {
- fN(err);
- });
+ _.each(stats.compilation.errors, webpackError);
}
else
{