aurelia-froala-editor 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "./node_modules/aurelia-tools/.eslintrc.json"
3
+ }
package/.tfignore ADDED
@@ -0,0 +1,4 @@
1
+ build\*
2
+ dist\*
3
+ jspm_packages\*
4
+ node_modules\*
package/README.md ADDED
@@ -0,0 +1,333 @@
1
+ # Aurelia Froala WYSIWYG HTML Editor
2
+
3
+ [![npm](https://img.shields.io/npm/v/aurelia-froala-editor.svg)](https://www.npmjs.com/package/aurelia-froala-editor)
4
+ [![npm](https://img.shields.io/npm/dm/aurelia-froala-editor.svg)](https://www.npmjs.com/package/aurelia-froala-editor)
5
+ [![npm](https://img.shields.io/npm/l/aurelia-froala-editor.svg)](https://www.npmjs.com/package/aurelia-froala-editor)
6
+
7
+ >This package provides a custom element for the [Froala WYSIWYG HTML Editor](https://www.froala.com/wysiwyg-editor) in [Aurelia](http://aurelia.io/).
8
+
9
+ ## Table of contents
10
+
11
+ 1. [Installation instructions](#installation-instructions)
12
+ 2. [Update editor instructions](#update-editor-instructions)
13
+ 3. [Integration](#integration)
14
+ 1. [With Aurelia CLI](#with-aurelia-cli)
15
+ 2. [With Webpack](#with-webpack)
16
+ 3. [With JSPM](#with-jspm)
17
+ 4. [Usage](#usage)
18
+ 5. [License](#license)
19
+
20
+ #### Note
21
+ >To use third-party plugins (i.e font-awesome,spell-checker,embedly and advanced image-edit) please use Aurelia with Webpack.
22
+
23
+ ## Installation instructions
24
+
25
+ Install `aurelia-froala-editor` from `npm`
26
+
27
+ ```bash
28
+ npm install aurelia-froala-editor --save
29
+ ```
30
+
31
+ ## Update editor instructions
32
+
33
+ ```bash
34
+ npm update froala-editor
35
+ ```
36
+
37
+ ## Integration
38
+
39
+ ### With Aurelia CLI
40
+
41
+ #### Installing aurelia-cli
42
+
43
+ *Note*: you can skip this part if you already have application generated.
44
+
45
+ ```bash
46
+ npm install aurelia-cli -g
47
+ au new my-app
48
+ cd my-app
49
+ ```
50
+
51
+ #### Add aurelia-froala-editor
52
+
53
+ - Install the aurelia plugin
54
+
55
+ ```bash
56
+ npm install aurelia-froala-editor --save
57
+ ```
58
+
59
+ - In your `src/main.js` or `src/main.ts` file add:
60
+
61
+
62
+ ```javascript
63
+
64
+ // Use the aurelia-froala-editor plugin.
65
+ aurelia.use.plugin('aurelia-froala-editor');
66
+ ```
67
+
68
+ - In your `src/app.html` include CSS files and Froala Editor component inside `<template>` tag :
69
+
70
+ ```html
71
+ <require from="froala-editor/css/froala_editor.pkgd.min.css"></require>
72
+ <require from="froala-editor/css/froala_style.min.css"></require>
73
+
74
+ <froala-editor></froala-editor>
75
+ ```
76
+
77
+ - If you are using bundler then in `aurelia_project/aurelia.json` file set the builder loader plugins stub to `false`
78
+
79
+ ```json
80
+ "loader": {
81
+ "type": "require",
82
+ "configTarget": "vendor-bundle.js",
83
+ "includeBundleMetadataInConfig": "auto",
84
+ "plugins": [
85
+ {
86
+ "name": "text",
87
+ "extensions": [
88
+ ".html",
89
+ ".css"
90
+ ],
91
+ "stub": false
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ - In `aurelia_project/aurelia.json` add to `vendor_bundle`
98
+
99
+ ```javascript
100
+ {
101
+ "name": "aurelia-froala-editor",
102
+ "path": "../node_modules/aurelia-froala-editor/dist/amd",
103
+ "main": "index",
104
+ "resources": [
105
+ "froala-editor.js",
106
+ "froala-editor.html"
107
+ ],
108
+ "deps": [
109
+ "froala-editor"
110
+ ]
111
+ }
112
+ ```
113
+
114
+ #### Run aurelia-cli
115
+
116
+ ```bash
117
+ au run --watch
118
+ ```
119
+
120
+
121
+
122
+ ### With Webpack
123
+
124
+ To configure your project with Webpack, follow the resources from Aurelia Docs:
125
+ https://aurelia.io/docs/build-systems/webpack/.
126
+
127
+ ```bash
128
+ git clone git@github.com:aurelia/skeleton-navigation.git
129
+ cd skeleton-navigation/skeleton-esnext-webpack
130
+ npm install
131
+ ```
132
+
133
+ #### Add aurelia-froala-editor
134
+
135
+ - Install the aurelia plugin
136
+
137
+ ```bash
138
+ npm install aurelia-froala-editor --save
139
+ ```
140
+
141
+ - In your `src/main.js` or `src/main.ts` file add:
142
+
143
+ ```javascript
144
+ import { PLATFORM } from "aurelia-pal";
145
+
146
+ // Editor files.
147
+ import "froala-editor/js/froala_editor.pkgd.min";
148
+ //Import third-party plugins
149
+ // import "./../node_modules/froala-editor/js/third_party/image_tui.min";
150
+ // import "./../node_modules/froala-editor/js/third_party/embedly.min";
151
+ // import "./../node_modules/froala-editor/js/third_party/font_awesome.min";
152
+ // import "./../node_modules/froala-editor/js/third_party/spell_checker.min";
153
+
154
+ ...
155
+
156
+ // Use the aurelia-froala-editor plugin.
157
+ aurelia.use.plugin(PLATFORM.moduleName('aurelia-froala-editor'));
158
+ ```
159
+
160
+ - In your `src/app.html` include CSS files and Froala Editor component inside `<template>` tag :
161
+
162
+ ```html
163
+ <require from="froala-editor/css/froala_editor.pkgd.min.css"></require>
164
+ <require from="froala-editor/css/froala_style.min.css"></require>
165
+
166
+ <froala-editor></froala-editor>
167
+ ```
168
+
169
+ - In `webpack.config.js` file include the Aurelia Froala Editor plugin:
170
+
171
+ ```js
172
+ const { AureliaPlugin, ModuleDependenciesPlugin } = require('aurelia-webpack-plugin');
173
+ resolve: {
174
+ extensions: ['.js'],
175
+ modules: [srcDir, path.resolve("node_modules")],
176
+ alias: {
177
+ "FroalaEditor": 'froala_editor.pkgd.min.js'
178
+ }
179
+ },
180
+ plugins: [
181
+ new AureliaPlugin(),
182
+ new ProvidePlugin({
183
+ FroalaEditor: 'froala_editor.pkgd.min.js',
184
+ 'Promise': 'bluebird',
185
+ Popper: ['popper.js', 'default'] // Bootstrap 4 Dependency.
186
+ }),
187
+ new ModuleDependenciesPlugin({
188
+ "aurelia-froala-editor": [ './froala-editor' ],
189
+ "parent-module": [ "child-module" ],
190
+ }),
191
+ ]
192
+ ```
193
+
194
+ #### Run application
195
+
196
+ ```bash
197
+ npm run start
198
+ ```
199
+
200
+
201
+
202
+ ### With JSPM
203
+
204
+ #### Installing aurelia-cli
205
+
206
+ To configure your project with JSPM, follow the resources from Aurelia Docs:
207
+ https://aurelia.io/docs/build-systems/jspm.
208
+
209
+
210
+
211
+ ```bash
212
+ git clone git@github.com:aurelia/skeleton-navigation.git
213
+ cd skeleton-navigation/skeleton-esnext
214
+ npm install
215
+ jspm install -y
216
+ ```
217
+
218
+ ####
219
+
220
+ #### Add aurelia-froala-editor
221
+
222
+ - Install the aurelia plugin
223
+
224
+ ```bash
225
+ jspm install aurelia-froala-editor
226
+ jspm install npm:froala-editor -o "{format: 'global'}"
227
+ ```
228
+
229
+ - In your `src/main.js` or `src/main.ts` file add:
230
+
231
+ ```javascript
232
+
233
+ // Use the aurelia-froala-editor plugin.
234
+ aurelia.use.plugin('aurelia-froala-editor');
235
+ ```
236
+
237
+ - In your `src/app.html` include CSS files and Froala Editor component inside `<template>` tag :
238
+
239
+ ```html
240
+ <require from="froala-editor/css/froala_editor.pkgd.min.css"></require>
241
+ <require from="froala-editor/css/froala_style.min.css"></require>
242
+
243
+ <froala-editor></froala-editor>
244
+ ```
245
+
246
+ - In `build/bundles.js` add `aurelia-froala-editor` to `dist/aurelia` bundles:
247
+
248
+ ```javascript
249
+ module.exports = {
250
+ "bundles": {
251
+ ...
252
+ "dist/aurelia": {
253
+ "includes": [
254
+ ...
255
+ "aurelia-froala-editor",
256
+ ...
257
+ ],
258
+ "options": {
259
+ "inject": true,
260
+ "minify": true,
261
+ "depCache": false,
262
+ "rev": false
263
+ }
264
+ }
265
+ }
266
+ }
267
+ ```
268
+
269
+ #### Run application
270
+
271
+ ```bash
272
+ gulp watch
273
+ ```
274
+
275
+
276
+
277
+ ## Usage
278
+
279
+ #### Component
280
+
281
+ In an Aurelia template, just use the aurelia-froala custom element to instantiate an editor.
282
+
283
+ ```html
284
+ <froala-editor></froala-editor>
285
+ ```
286
+
287
+ #### Options
288
+ All [configuration options](https://www.froala.com/wysiwyg-editor/docs/options) can be set via the config attribute.
289
+
290
+ ```html
291
+ <froala-editor
292
+ value.two-way="value"
293
+ config.bind="{
294
+ toolbarButtons: ['redo' , '|', 'fontFamily', '|', 'fontSize', '|', 'paragraphFormat', 'color', '|', 'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'outdent', 'indent', 'clearFormatting', 'insertTable', 'html'],
295
+ toolbarButtonsMD: ['redo' , '|', 'fontFamily', '|', 'fontSize', '|', 'paragraphFormat', 'color'],
296
+ toolbarButtonsSM: ['redo' , '|', 'fontFamily', '|', 'fontSize', '|', 'paragraphFormat', 'color'],
297
+ toolbarButtonsXS: ['redo' , '|', 'fontFamily', '|', 'fontSize', '|', 'paragraphFormat', 'color'],
298
+ fontFamilySelection: true,
299
+ fontSizeSelection: true
300
+ }"></froala-editor>
301
+ ```
302
+
303
+ A custom config can also be passed when the plugin is loaded in `src/main.js` or `src/main.ts`file:
304
+
305
+ ```javascript
306
+ // Use the aurelia-froala-editor plugin.
307
+ aurelia.use.plugin('aurelia-froala-editor', config => {
308
+ config.options({
309
+ toolbarInline: true
310
+ })
311
+ });
312
+ ```
313
+
314
+ #### Events
315
+ One can bind events to editor as given below.
316
+
317
+ >All the [event handlers](https://www.froala.com/wysiwyg-editor/docs/events) are also available.
318
+
319
+ ```html
320
+ <froala-editor
321
+ config.bind="tempCOnfig"></froala-editor>
322
+ ```
323
+ ```js
324
+ events: {
325
+ 'focus': function () {
326
+ console.log('Focus');
327
+ }
328
+ }
329
+ ```
330
+
331
+ ## License
332
+
333
+ The `aurelia-froala-editor` project is under the Apache licence. However, to use the Froala WYSIWYG HTML Editor you should purchase a license for it. Froala has [3 different licenses](https://www.froala.com/wysiwyg-editor/pricing) for commercial use. For details please see [License Agreement](https://www.froala.com/wysiwyg-editor/terms).
package/build/args.js ADDED
@@ -0,0 +1,14 @@
1
+ var yargs = require('yargs');
2
+
3
+ var argv = yargs.argv;
4
+ var validBumpTypes = 'major|minor|patch|prerelease'.split('|');
5
+ var bump = (argv.bump || 'patch').toLowerCase();
6
+
7
+ if (validBumpTypes.indexOf(bump) === -1) {
8
+ throw new Error('Unrecognized bump "' + bump + '".');
9
+ }
10
+
11
+ module.exports = {
12
+ bump: bump,
13
+ depth: parseInt(argv.depth || '0')
14
+ };
@@ -0,0 +1,45 @@
1
+ var path = require('path');
2
+
3
+ exports.base = function() {
4
+ return {
5
+ filename: '',
6
+ filenameRelative: '',
7
+ sourceMap: true,
8
+ sourceRoot: '',
9
+ moduleRoot: path.resolve('src').replace(/\\/g, '/'),
10
+ moduleIds: false,
11
+ comments: false,
12
+ compact: false,
13
+ code: true,
14
+ presets: [['es2015', { loose: true }], 'stage-1'],
15
+ plugins: [
16
+ 'syntax-flow',
17
+ 'transform-decorators-legacy',
18
+ 'transform-flow-strip-types'
19
+ ]
20
+ };
21
+ };
22
+
23
+ exports.commonjs = function() {
24
+ var options = exports.base();
25
+ options.plugins.push('transform-es2015-modules-commonjs');
26
+ return options;
27
+ };
28
+
29
+ exports.amd = function() {
30
+ var options = exports.base();
31
+ options.plugins.push('transform-es2015-modules-amd');
32
+ return options;
33
+ };
34
+
35
+ exports.system = function() {
36
+ var options = exports.base();
37
+ options.plugins.push('transform-es2015-modules-systemjs');
38
+ return options;
39
+ };
40
+
41
+ exports.es2015 = function() {
42
+ var options = exports.base();
43
+ options.presets = ['stage-1'];
44
+ return options;
45
+ };
package/build/paths.js ADDED
@@ -0,0 +1,14 @@
1
+ var appRoot = 'src/';
2
+ var outputRoot = 'dist/';
3
+
4
+ module.exports = {
5
+ root: appRoot,
6
+ source: appRoot + '**/*.js',
7
+ html: appRoot + '**/*.html',
8
+ css: appRoot + '**/*.css',
9
+ style: 'styles/**/*.css',
10
+ output: outputRoot,
11
+ doc: './doc',
12
+ e2eSpecsSrc: 'test/e2e/src/*.js',
13
+ e2eSpecsDist: 'test/e2e/dist/'
14
+ };
@@ -0,0 +1,54 @@
1
+ let gulp = require('gulp');
2
+ let runSequence = require('run-sequence');
3
+ let to5 = require('gulp-babel');
4
+ let paths = require('../paths');
5
+ let compilerOptions = require('../babel-options');
6
+ let assign = Object.assign || require('object.assign');
7
+
8
+ gulp.task('build-html', function() {
9
+ return gulp.src(paths.html)
10
+ .pipe(gulp.dest(paths.output + 'es2015'))
11
+ .pipe(gulp.dest(paths.output + 'commonjs'))
12
+ .pipe(gulp.dest(paths.output + 'amd'))
13
+ .pipe(gulp.dest(paths.output + 'system'));
14
+ });
15
+
16
+ gulp.task('build-css', function() {
17
+ return gulp.src(paths.css)
18
+ .pipe(gulp.dest(paths.output + 'es2015'))
19
+ .pipe(gulp.dest(paths.output + 'commonjs'))
20
+ .pipe(gulp.dest(paths.output + 'amd'))
21
+ .pipe(gulp.dest(paths.output + 'system'));
22
+ });
23
+
24
+ gulp.task('build-es2015', function() {
25
+ return gulp.src(paths.source)
26
+ .pipe(to5(assign({}, compilerOptions.es2015())))
27
+ .pipe(gulp.dest(paths.output + 'es2015'));
28
+ });
29
+
30
+ gulp.task('build-commonjs', function() {
31
+ return gulp.src(paths.source)
32
+ .pipe(to5(assign({}, compilerOptions.commonjs())))
33
+ .pipe(gulp.dest(paths.output + 'commonjs'));
34
+ });
35
+
36
+ gulp.task('build-amd', function() {
37
+ return gulp.src(paths.source)
38
+ .pipe(to5(assign({}, compilerOptions.amd())))
39
+ .pipe(gulp.dest(paths.output + 'amd'));
40
+ });
41
+
42
+ gulp.task('build-system', function() {
43
+ return gulp.src(paths.source)
44
+ .pipe(to5(assign({}, compilerOptions.system())))
45
+ .pipe(gulp.dest(paths.output + 'system'));
46
+ });
47
+
48
+ gulp.task('build', function(callback) {
49
+ return runSequence(
50
+ 'clean',
51
+ ['build-html', 'build-css', 'build-es2015', 'build-commonjs', 'build-amd', 'build-system'],
52
+ callback
53
+ );
54
+ });