Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React UI update (#103, #104, #106, #107) #105

Merged
merged 4 commits into from
Feb 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,784 changes: 0 additions & 5,784 deletions src/ui/react/demo/bootstrap.css

This file was deleted.

1 change: 1 addition & 0 deletions src/ui/react/gulp-tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ gulp.task('create-alloy-editor-core', function() {
path.join(reactDir, 'src/oop/base.js'),
path.join(reactDir, 'src/adapter/alloy-editor-adapter.js*'),
path.join(reactDir, 'src/components/base/*.js*'),
path.join(reactDir, 'src/components/buttons/*.js*'),
path.join(reactDir, 'src/components/*.js*')
])
.pipe(react()).on('error', errorHandler)
Expand Down
13 changes: 10 additions & 3 deletions src/ui/react/gulp-tasks/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ var pkg = require(path.join(rootDir, 'package.json'));
var distFolder = path.join(rootDir, 'dist');
var editorDistFolder = path.join(distFolder, 'alloy-editor-' + pkg.version, 'alloy-editor');

function errorHandler(error) {
console.error(error.toString());

this.emit('end');
}

function getFolders(dir) {
return fs.readdirSync(dir)
.filter(function(file) {
Expand All @@ -26,9 +32,10 @@ function getFolders(dir) {
gulp.task('sass2css', function() {
return gulp.src(path.join(reactDir, 'src/assets/sass/**/*.scss'))
.pipe(sass({
includePaths: [path.join(rootDir, 'node_modules/bourbon/app/assets/stylesheets')]
}))
.pipe(gulp.dest(path.join(editorDistFolder, 'assets/css')));
includePaths: [path.join(rootDir, 'node_modules/bourbon/app/assets/stylesheets')],
onError: errorHandler.bind(this)
}))
.pipe(gulp.dest(path.join(editorDistFolder, 'assets/css')));
});

gulp.task('join-css', function() {
Expand Down
4 changes: 3 additions & 1 deletion src/ui/react/src/adapter/alloy-editor-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
name: 'image',
buttons: ['imageLeft', 'imageRight'],
test: function(data, editor) {
// body...
var selectionData = data.selectionData;

return (selectionData.element && selectionData.element.getName() === 'img');
}
},
{
Expand Down
4 changes: 0 additions & 4 deletions src/ui/react/src/assets/font/font-template.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
-moz-osx-font-smoothing: grayscale;
}

.alloy-editor-icon-add {
font-size: 14px;
line-height: 1;
}
<% _.each(glyphs, function(glyph) { %>
.alloy-editor-icon-<%= glyph.name %>:before {
content: "\<%= glyph.codepoint.toString(16).toUpperCase() %>";
Expand Down
136 changes: 133 additions & 3 deletions src/ui/react/src/assets/sass/alloy-editor-core.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,145 @@
@import "bourbon";

.alloy-editor-hide {
display: none;
$base_font_size: 14px;
$base_button_height: 24px;
$base_button_width: $base_button_height;
$base_padding: 4px;
$base_spacing: 10px;

$IE9_ONLY: \9;

.alloy-editor-container, [class*=alloy-editor-container-] {
@include align-items(center);
@include display(inline-flex);
@include flex-direction(row);
@include flex-wrap(wrap);

box-sizing: border-box;

*, *:after, *:before {
box-sizing: inherit;
}

.alloy-editor-container, [class*=alloy-editor-container-], .alloy-editor-button {
font-size: $base_font_size;
position: relative;

&:not(:last-child) {
margin-right: $base_spacing;
}
}
}

.alloy-editor-toolbar {
.alloy-editor-toolbar, [class*=alloy-editor-toolbar-] {
line-height: 1;
padding: $base_spacing;
position: absolute;

input, textarea, keygen, select, button {
font-size: $base_font_size;
}

&.alloy-editor-toolbar-transition {
@include transition-property (height, left, opacity, top);
@include transition-duration (0.15s);
@include transition-timing-function (ease-out);
}

.alloy-editor-button {
border-width: 0;
color: inherit;
cursor: pointer;
height: $base_button_height;
margin: 0;
padding: 0;
width: $base_button_width;

&:hover, &:focus {
&.alloy-editor-button-disabled {
color: inherit;
}
}

&.alloy-editor-button-disabled {
cursor: auto;
}
}
}

.alloy-editor-container-input {
@include flex-wrap(nowrap);

float: left !important;
padding-left: 4px;
width: 188px;

[class*=alloy-editor-icon-] {
font-size: $base_button_height;
line-height: $base_button_height;
}

input, .alloy-editor-input {
@include flex-grow(1);

border-width: 0;
box-shadow: none;
font-family: inherit;
height: auto;
line-height: normal;
margin: 0;
outline: none;
padding: 0;

&::-ms-clear {
display: none;
}

display: inline-block $IE9_ONLY;
margin-left: -$base_padding $IE9_ONLY;
margin-top: $base_padding $IE9_ONLY;
padding-left: $base_padding $IE9_ONLY;
width: 164px $IE9_ONLY;
}

.alloy-editor-icon-remove {
float: right $IE9_ONLY;
}

~ .alloy-editor-button {
float: left !important $IE9_ONLY;

~ .alloy-editor-button {
float: right !important $IE9_ONLY;
}
}
}

.alloy-editor-container-link {
padding: 2px 4px;

a, .alloy-editor-link {
color: inherit;
display: inline-block;
font-size: $base_font_size;
font-weight: 300;
overflow: hidden;
max-width: 500px;
text-decoration: none;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;

&:hover, &:focus {
text-decoration: underline;
}

&:before {
content: '\E00E';
display: inline-block;
font-family: 'alloyeditor';
margin-right: 4px;
vertical-align: middle;
}

}
}
69 changes: 34 additions & 35 deletions src/ui/react/src/assets/sass/arrow-box.scss
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
@import "bourbon";

$arrow_height: 4px;
$arrow_width: 10px;

.alloy-editor-arrow-box {
&:after, &:before {
content: ' ';
height: 0;
width: 0;
&:after {
content: '';
margin: auto;
position: absolute;
pointer-events: none;
}

&.alloy-editor-arrow-box-top {
&:after, &:before {
bottom: 100%;
left: 50%;
border-left-width: 5px;
border-right-width: 5px;
border-bottom-width: 4px;
margin-left: -5px;
&.alloy-editor-arrow-box-bottom {
&:after {
@include triangle($arrow_width $arrow_height, currentColor, down);

left: 0;
right: 0;
top: 100%;
}
}

&.alloy-editor-arrow-box-bottom {
&:after, &:before {
top: 100%;
left: 50%;
border-left-width: 5px;
border-right-width: 5px;
border-top-width: 4px;
margin-left: -5px;
&.alloy-editor-arrow-box-top {
&:after {
@include triangle($arrow_width $arrow_height, currentColor, up);

left: 0;
right: 0;
top: -$arrow_height;
}
}

&.alloy-editor-arrow-box-left {
&:after, &:before {
right: 100%;
top: 50%;
border-top-width: 5px;
border-bottom-width: 5px;
border-right-width: 4px;
margin-top: -5px;
&:after {
@include triangle($arrow_width $arrow_height, currentColor, left);

left: -$arrow_height;
top: 0;
bottom: 0;
}
}

&.alloy-editor-arrow-box-right {
&:after, &:before {
left: 100%;
top: 50%;
border-top-width: 5px;
border-bottom-width: 5px;
border-left-width: 4px;
margin-top: -5px;
&:after {
@include triangle($arrow_width $arrow_height, currentColor, right);

right: -$arrow_height;
top: 0;
bottom: 0;
}
}
}
71 changes: 70 additions & 1 deletion src/ui/react/src/assets/sass/skin/ocean/alloy-editor-skin.scss
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
@import "bourbon";
@import "bourbon";

$base_color: #32a8e6;
$button_color: darken($base_color, 12%);

@include selection {
background: #e6f1fa !important;
text-shadow: none;
}

.alloy-editor-toolbar, [class*=alloy-editor-toolbar-] {
background-color: $base_color;
border-radius: 4px;
color: #fff;
font-family: 'Helvetica Neue';

&.alloy-editor-arrow-box:after {
color: $base_color;
}

.alloy-editor-button {
background-color: transparent;

&:hover {
color: $button_color;
}

&.alloy-editor-button-pressed {
background-color: $button_color;

&:hover {
background-color: lighten($button_color, 4%);
color: inherit;
}
}

&.alloy-editor-button-disabled {
opacity: 0.3;
}
}

.alloy-editor-container-input {
background-color: #fff;

[class*=alloy-editor-icon-] {
color: #2b4259;
opacity: 0.4;
}
}
}

.alloy-editor-toolbar-add {
border-radius: 24px;
padding: 0;

&:hover, &:focus {
opacity: 0.7;
}

.alloy-editor-button-add {
&:hover, &:focus {
color: #fff;
}

.alloy-editor-icon-add {
font-size: 12px;
line-height: 24px;
}
}
}
Loading