Skip to content

Commit db9d6b3

Browse files
authored
Merge pull request #954 from julien/feature/extra_buttons
Add extra buttons from liferay-portal
2 parents 29cec4f + 73f21f1 commit db9d6b3

File tree

162 files changed

+5110
-4508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+5110
-4508
lines changed

package-lock.json

Lines changed: 899 additions & 3102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
"sinon": "1.15.4",
4848
"uglifyjs-webpack-plugin": "^1.2.4",
4949
"walk": "^2.3.9",
50-
"webpack": "^4.6.0",
51-
"webpack-cli": "^2.0.12",
52-
"webpack-dev-server": "^3.1.1",
53-
"webpack-merge": "^4.1.2",
50+
"webpack": "^4.28.1",
51+
"webpack-cli": "^3.2.1",
52+
"webpack-dev-server": "^3.1.14",
53+
"webpack-merge": "^4.2.1",
5454
"yargs": "6.6.0"
5555
},
5656
"main": "dist/alloy-editor/alloy-editor-no-react.js",
@@ -77,6 +77,7 @@
7777
},
7878
"homepage": "http://alloyeditor.com",
7979
"dependencies": {
80+
"clay-css": "2.5.1",
8081
"create-react-class": "^15.6.3",
8182
"prop-types": "^15.6.2",
8283
"react": "^16.6.3",

scripts/build/gulp/_hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c53f3ac54b9661a152f35743c3075261527c3b82
1+
cc3dcb64e9a96a8c6ea572d15efbb68a3b70ca02

scripts/build/gulp/tasks/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ gulp.task('build', function(callback) {
2020
[
2121
'build-css',
2222
'copy-ckeditor',
23-
'copy-languages'
23+
'copy-languages',
24+
'copy-svgs'
2425
],
2526
task,
2627
callback

scripts/build/gulp/tasks/icons.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const Constants = require('../constants');
2+
const gulp = require('gulp');
3+
const path = require('path');
4+
5+
gulp.task('copy-svgs', function() {
6+
var iconsPath = path.join(Constants.rootDir, 'node_modules', 'clay-css', 'lib', 'images', 'icons', 'icons.svg');
7+
8+
return gulp.src(iconsPath)
9+
.pipe(gulp.dest(path.join(Constants.editorDistFolder, 'assets', 'icons')));
10+
});

src/adapter/core.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import UI from '../components/main.jsx';
1212
import React from 'react';
1313
import ReactDOM from 'react-dom';
1414

15+
const EMBED_VIDEO_WIDTH = 560;
16+
const EMBED_VIDEO_HEIGHT = 315;
17+
1518
/**
1619
* AlloyEditor main class. Creates instance of the editor and provides the user configuration
1720
* to the UI.
@@ -51,13 +54,17 @@ extend(Core, Base, {
5154

5255
editor.config.extraPlugins = this.get('extraPlugins');
5356

57+
editor.config.embedProviders = this.get('embedProviders');
58+
5459
editor.config.placeholderClass = this.get('placeholderClass');
5560

5661
editor.config.pasteFromWordRemoveStyles = false;
5762
editor.config.pasteFromWordRemoveFontStyles = false;
5863

5964
editor.config.selectionKeystrokes = this.get('selectionKeystrokes');
6065

66+
editor.config.spritemap = this.get('spritemap');
67+
6168
Lang.mix(editor.config, config);
6269

6370
if (CKEDITOR.env.ie && !CKEDITOR.env.edge) {
@@ -315,6 +322,65 @@ extend(Core, Base, {
315322
writeOnce: true
316323
},
317324

325+
326+
/**
327+
* List of embed providers for videos
328+
*
329+
* @memberof Core
330+
* @instance
331+
* @property embedProviders
332+
* @default []
333+
* @type Array}
334+
*/
335+
embedProviders: {
336+
validator: Lang.isArray,
337+
value: [
338+
{
339+
id: 'facebook',
340+
tpl: `<iframe allowFullScreen="true" allowTransparency="true"
341+
frameborder="0" height="${EMBED_VIDEO_HEIGHT}"
342+
src="https://www.facebook.com/plugins/video.php?href={embedId}'
343+
&show_text=0&width=${EMBED_VIDEO_WIDTH}&height=${EMBED_VIDEO_HEIGHT}" scrolling="no"
344+
style="border:none;overflow:hidden" width="${EMBED_VIDEO_WIDTH}}"></iframe>`,
345+
urlSchemes: [
346+
'(https?:\\/\\/(?:www\\.)?facebook.com\\/\\S*\\/videos\\/\\S*)'
347+
]
348+
},
349+
{
350+
id: 'twitch',
351+
tpl: `<iframe allowfullscreen="true" frameborder="0"
352+
height="${EMBED_VIDEO_HEIGHT}"
353+
src="https://player.twitch.tv/?autoplay=false&video={embedId}"
354+
scrolling="no" width="${EMBED_VIDEO_WIDTH}"></iframe>`,
355+
urlSchemes: [
356+
'https?:\\/\\/(?:www\\.)?twitch.tv\\/videos\\/(\\S*)$'
357+
]
358+
},
359+
{
360+
id: 'vimeo',
361+
tpl: `<iframe allowfullscreen frameborder="0" height="${EMBED_VIDEO_HEIGHT}"
362+
mozallowfullscreen src="https://player.vimeo.com/video/{embedId}"
363+
webkitallowfullscreen width="${EMBED_VIDEO_WIDTH}"></iframe>`,
364+
urlSchemes: [
365+
'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/album\\/.*\\/video\\/(\\S*)',
366+
'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/channels\\/.*\\/(\\S*)',
367+
'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/groups\\/.*\\/videos\\/(\\S*)',
368+
'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\S*)$'
369+
]
370+
},
371+
{
372+
id: 'youtube',
373+
tpl: `<iframe allow="autoplay; encrypted-media" allowfullscreen
374+
height="${EMBED_VIDEO_HEIGHT}" frameborder="0"
375+
src="https://www.youtube.com/embed/{embedId}?rel=0"
376+
width="${EMBED_VIDEO_WIDTH}"></iframe>`,
377+
urlSchemes: [
378+
'https?:\\/\\/(?:www\\.)?youtube.com\\/watch\\?v=(\\S*)$'
379+
]
380+
}
381+
]
382+
},
383+
318384
/**
319385
* Specifies whether AlloyEditor set the contenteditable attribute
320386
* to "true" on its srcNode.
@@ -456,6 +522,21 @@ extend(Core, Base, {
456522
}]
457523
},
458524

525+
/**
526+
* The path to the spritemap SVG used for icons
527+
*
528+
* @memberof Core
529+
* @instance
530+
* @property spritemap
531+
* @type String
532+
* @writeOnce
533+
*/
534+
spritemap: {
535+
validator: Lang.isString,
536+
value: 'alloy-editor/assets/icons/icons.svg',
537+
writeOnce: true
538+
},
539+
459540
/**
460541
* The Node ID or HTMl node, which AlloyEditor should use as an editable area.
461542
*

src/assets/lang/en.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
{
22
"add": "Add",
3+
"ariaUpdateManyToolbars": "{toolbars} toolbars are available. Press ALT+F10 to focus.",
34
"ariaUpdateNoToolbar": "No toolbars are available",
45
"ariaUpdateOneToolbar": "{toolbars} toolbar is available. Press ALT+F10 to focus.",
5-
"ariaUpdateManyToolbars": "{toolbars} toolbars are available. Press ALT+F10 to focus.",
66
"camera": "Insert Image from Camera",
77
"cameraDisabled": "The browser does not support this action, or it is available on https only (Chrome).",
88
"cite": "Cite",
99
"clearInput": "Clear Input Field",
10+
"clear": "Clear",
1011
"code": "Code",
1112
"columns": "Cols",
1213
"confirm": "Confirm",
14+
"danger": "Danger",
1315
"deleteEmbed": "Delete embed",
16+
"disabled": "Disabled",
1417
"editLink": "Type or paste link here",
18+
"enterValidUrl": "Please enter a valid url",
1519
"image": "Insert Image",
20+
"info": "Info",
1621
"link": "Link",
1722
"linkTargetBlank": "_blank (new tab)",
1823
"linkTargetDefault": "default",
1924
"linkTargetParent": "_parent",
2025
"linkTargetSelf": "_self (same tab)",
2126
"linkTargetTop": "_top",
27+
"normal": "Normal",
28+
"pasteVideoLink": "Paste Video Link",
29+
"platformNotSupported": "Sorry, this platform is not supported",
30+
"primary": "Primary",
2231
"removeLink": "Remove link",
2332
"rows": "Rows",
24-
"table": "Insert Table"
33+
"success": "Success",
34+
"table": "Insert Table",
35+
"videoPlaybackDisabled": "Video playback is disabled during edit mode",
36+
"warning": "Warning"
2537
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ae-svg-icon {
2+
fill: $svg-icon;
3+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.ae-svg-icon {
2+
display: inline-block;
3+
height: $svg-icon-size;
4+
margin-top: $svg-icon-margin-top;
5+
pointer-events: none;
6+
vertical-align: middle;
7+
width: $svg-icon-size;
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$svg-icon: currentColor;

0 commit comments

Comments
 (0)