Browse Source

Fix styles

pull/36/head
Artur Arseniev 10 years ago
parent
commit
bd33adc590
  1. 8
      src/rich_text_editor/config/config.js
  2. 14
      src/rich_text_editor/main.js
  3. 22
      src/rich_text_editor/view/CommandButtonSelectView.js
  4. 1
      src/rich_text_editor/view/CommandButtonView.js
  5. 18
      styles/css/main.css
  6. 28
      styles/scss/main.scss

8
src/rich_text_editor/config/config.js

@ -23,10 +23,10 @@ define(function () {
}/*,{ }/*,{
command: 'fontSize', command: 'fontSize',
options: [ options: [
{name: 'Huge', value: '100px'}, {name: 'Huge', value: '7'},
{name: 'Normal', value: '14px'}, {name: 'Normal', value: '5'},
{value: '5px'} {value: '1'}
] ]
}*/], }*/],
}; };
}); });

14
src/rich_text_editor/main.js

@ -4,13 +4,11 @@
* * [getAll](#getall) * * [getAll](#getall)
* * [remove](#remove) * * [remove](#remove)
* *
* This module allows to customize the toolbar of the Rich Text Editor and use commands from the HTML Editing APIs.
* For more info about HTML Editing APIs check here:
* https://developer.mozilla.org/it/docs/Web/API/Document/execCommand
* *
* styleWithCSS * It's highly recommended to keep this toolbar as small as possible, especially from styling commands (eg. 'fontSize')
* removeFormat
*
*
* This module allows to customize the toolbar of the Rich Text Editor. It's highly recommended
* to keep this toolbar as small as possible, especially from styling commands (eg. 'fontSize')
* and leave this task to the Style Manager. * and leave this task to the Style Manager.
* *
* Before using methods you should get first the module from the editor instance, in this way: * Before using methods you should get first the module from the editor instance, in this way:
@ -164,7 +162,7 @@ define(function(require) {
* @private * @private
* */ * */
show: function(){ show: function(){
toolbar.el.style.display = 'block'; toolbar.el.style.display = "block";
}, },
/** /**
@ -172,7 +170,7 @@ define(function(require) {
* @private * @private
* */ * */
hide: function(){ hide: function(){
toolbar.el.style.display = 'none'; toolbar.el.style.display = "none";
}, },
/** /**

22
src/rich_text_editor/view/CommandButtonSelectView.js

@ -1,10 +1,9 @@
define(['backbone'], define(['backbone', './CommandButtonView'],
function (Backbone) { function (Backbone, CommandButtonView) {
return Backbone.View.extend({ return CommandButtonView.extend({
initialize: function(o, config){ initialize: function(o, config){
this.config = config || {}; CommandButtonView.prototype.initialize.apply(this, arguments);
this.className = this.config.stylePrefix + 'btn ' + this.model.get('class');
}, },
getInput: function(){ getInput: function(){
@ -13,6 +12,8 @@ define(['backbone'],
var cmd = m.get('command'); var cmd = m.get('command');
var input = '<select data-edit="' + cmd +'">'; var input = '<select data-edit="' + cmd +'">';
var opts = m.get('options'); var opts = m.get('options');
var label = m.get('title') || m.get('command');
input += '<option>' + label + '</option>';
for(var i = 0, len = opts.length; i < len; i++){ for(var i = 0, len = opts.length; i < len; i++){
var opt = opts[i]; var opt = opts[i];
var value = opt.value; var value = opt.value;
@ -25,9 +26,16 @@ define(['backbone'],
return this.input; return this.input;
}, },
getInputCont: function() {
var input = this.getInput();
var pfx = this.ppfx;
var cont = $('<div class="'+pfx+'field '+pfx+'select"><div class="'+pfx+'sel-arrow"><div class="'+pfx+'d-s-arrow"></div></div></div>');
return cont.append(input);
},
render: function() { render: function() {
this.$el.addClass(this.className); CommandButtonView.prototype.render.apply(this, arguments);
this.$el.html(this.getInput()); this.$el.html(this.getInputCont());
return this; return this;
} }
}); });

1
src/rich_text_editor/view/CommandButtonView.js

@ -6,6 +6,7 @@ define(['backbone'],
initialize: function(o, config){ initialize: function(o, config){
this.config = config || {}; this.config = config || {};
this.ppfx = this.config.pStylePrefix || '';
this.className = this.config.stylePrefix + 'btn ' + this.model.get('class'); this.className = this.config.stylePrefix + 'btn ' + this.model.get('class');
}, },

18
styles/css/main.css

@ -2699,6 +2699,9 @@ $fontColorActive: #4f8ef7;
div.gjs-select { div.gjs-select {
padding: 0; } padding: 0; }
.gjs-select select {
padding-right: 10px; }
.gjs-select:-moz-focusring, .gjs-select:-moz-focusring,
.gjs-select select:-moz-focusring { .gjs-select select:-moz-focusring {
color: transparent; color: transparent;
@ -3103,8 +3106,6 @@ ol.example li.placeholder:before {
position: relative; position: relative;
z-index: 1; } z-index: 1; }
.gjs-field select { .gjs-field select {
color: transparent;
text-shadow: 0 0 0 rgba(255, 255, 255, 0.7);
height: 20px; } height: 20px; }
.gjs-field option { .gjs-field option {
margin: 5px 0; } margin: 5px 0; }
@ -3305,8 +3306,7 @@ ol.example li.placeholder:before {
line-height: normal; } line-height: normal; }
.gjs-sm-sector .gjs-sm-field.gjs-sm-integer select, .gjs-clm-tags .gjs-sm-field.gjs-sm-integer select, .gjs-sm-sector .gjs-sm-integer.gjs-clm-field select, .gjs-clm-tags .gjs-sm-integer.gjs-clm-field select, .gjs-clm-tags #gjs-clm-tags-field select { .gjs-sm-sector .gjs-sm-field.gjs-sm-integer select, .gjs-clm-tags .gjs-sm-field.gjs-sm-integer select, .gjs-sm-sector .gjs-sm-integer.gjs-clm-field select, .gjs-clm-tags .gjs-sm-integer.gjs-clm-field select, .gjs-clm-tags #gjs-clm-tags-field select {
width: auto; width: auto;
padding: 0; padding: 0; }
color: transparent; }
.gjs-sm-sector .gjs-sm-list .gjs-sm-el, .gjs-clm-tags .gjs-sm-list .gjs-sm-el { .gjs-sm-sector .gjs-sm-list .gjs-sm-el, .gjs-clm-tags .gjs-sm-list .gjs-sm-el {
float: left; float: left;
border-left: 1px solid rgba(0, 0, 0, 0.3); } border-left: 1px solid rgba(0, 0, 0, 0.3); }
@ -3562,6 +3562,7 @@ ol.example li.placeholder:before {
background-color: #000; background-color: #000;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0;
z-index: 1; z-index: 1;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -3572,6 +3573,7 @@ ol.example li.placeholder:before {
font-family: Helvetica, sans-serif; font-family: Helvetica, sans-serif;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0;
z-index: 10; z-index: 10;
width: 100%; width: 100%;
height: 100%; } height: 100%; }
@ -3739,13 +3741,14 @@ ol.example li.placeholder:before {
/*************RTE****************/ /*************RTE****************/
#gjs-rte-toolbar { #gjs-rte-toolbar {
display: none;
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
position: absolute; position: absolute;
border-radius: 3px; border-radius: 3px;
overflow: hidden; overflow: hidden;
display: none;
z-index: 5; } z-index: 5; }
#gjs-rte-toolbar .gjs-rte-btn { #gjs-rte-toolbar .gjs-rte-btn {
display: inline-block;
padding: 5px; padding: 5px;
min-width: 25px; min-width: 25px;
border-right: 1px solid rgba(0, 0, 0, 0.3); border-right: 1px solid rgba(0, 0, 0, 0.3);
@ -3758,6 +3761,8 @@ ol.example li.placeholder:before {
background-color: rgba(0, 0, 0, 0.3); } background-color: rgba(0, 0, 0, 0.3); }
#gjs-rte-toolbar .gjs-rte-btn:hover { #gjs-rte-toolbar .gjs-rte-btn:hover {
background-color: rgba(255, 255, 255, 0.1); } background-color: rgba(255, 255, 255, 0.1); }
#gjs-rte-toolbar select {
height: 16px; }
/********* Spectrum **********/ /********* Spectrum **********/
.sp-hue, .sp-slider { .sp-hue, .sp-slider {
@ -3835,3 +3840,6 @@ ol.example li.placeholder:before {
.sp-palette .sp-thumb-el, .sp-palette .sp-thumb-el:hover { .sp-palette .sp-thumb-el, .sp-palette .sp-thumb-el:hover {
border: 1px solid rgba(0, 0, 0, 0.8); } border: 1px solid rgba(0, 0, 0, 0.8); }
.gjs-hidden {
display: none; }

28
styles/scss/main.scss

@ -76,8 +76,8 @@ $fontV: 5;//random(1000)
appearance: $v; appearance: $v;
} }
.#{$app-prefix}fonts{ .#{$app-prefix}fonts{}
}
.#{$app-prefix}fonts:before{ .#{$app-prefix}fonts:before{
display: block; display: block;
font: normal normal normal 14px font3336; // shortening font declaration font: normal normal normal 14px font3336; // shortening font declaration
@ -194,6 +194,9 @@ $fontV: 5;//random(1000)
div.#{$app-prefix}select{ div.#{$app-prefix}select{
padding: 0; padding: 0;
} }
.#{$app-prefix}select select{
padding-right: 10px
}
.#{$app-prefix}select:-moz-focusring, .#{$app-prefix}select:-moz-focusring,
.#{$app-prefix}select select:-moz-focusring{ .#{$app-prefix}select select:-moz-focusring{
color: transparent; color: transparent;
@ -632,8 +635,6 @@ $arrowColor: $mainLhlColor; /*b1b1b1*/
} }
select{ select{
color: transparent;
text-shadow: 0 0 0 $inputFontColor;
height: 20px; height: 20px;
} }
@ -856,7 +857,7 @@ $arrowColor: $mainLhlColor; /*b1b1b1*/
} }
} }
&.#{$sm-prefix}integer select{ width:auto; padding: 0; color: transparent;} &.#{$sm-prefix}integer select{ width:auto; padding: 0;}
} }
/*------------------END Field--------------------*/ /*------------------END Field--------------------*/
@ -1185,7 +1186,8 @@ $paddElClm: 5px 6px;
.#{$mdl-prefix}backlayer { .#{$mdl-prefix}backlayer {
background-color: #000; background-color: #000;
position: absolute; position: absolute;
top: 0; z-index: 1; top: 0; left: 0;
z-index: 1;
width:100%; height:100%; width:100%; height:100%;
@include opacity(0.5); @include opacity(0.5);
} }
@ -1193,7 +1195,8 @@ $paddElClm: 5px 6px;
.#{$mdl-prefix}container { .#{$mdl-prefix}container {
font-family: $mainFont; font-family: $mainFont;
position: absolute; position: absolute;
top: 0; z-index: 10; top: 0; left: 0;
z-index: 10;
width:100%; height:100%; width:100%; height:100%;
} }
@ -1406,15 +1409,16 @@ $uploadPadding: 150px 10px;
##{$rte-prefix}toolbar { ##{$rte-prefix}toolbar {
@extend .#{$app-prefix}bg-main; @extend .#{$app-prefix}bg-main;
display: none;
border: 1px solid $mainDkColor; border: 1px solid $mainDkColor;
position: absolute; position: absolute;
border-radius: 3px; border-radius: 3px;
overflow: hidden; overflow: hidden;
display: none;
z-index: 5; z-index: 5;
.#{$rte-prefix}btn { .#{$rte-prefix}btn {
@extend .#{$app-prefix}color-main; @extend .#{$app-prefix}color-main;
display: inline-block;
padding: 5px; padding: 5px;
min-width: 25px; min-width: 25px;
border-right: 1px solid $mainDkColor; border-right: 1px solid $mainDkColor;
@ -1426,6 +1430,10 @@ $uploadPadding: 150px 10px;
&.btn-info{ background-color: $mainDkColor;} &.btn-info{ background-color: $mainDkColor;}
&:hover { background-color: $mainLhColor;} &:hover { background-color: $mainLhColor;}
} }
select{
height: 16px;
}
} }
/********* Spectrum **********/ /********* Spectrum **********/
@ -1487,4 +1495,6 @@ $uploadPadding: 150px 10px;
} }
.sp-palette .sp-thumb-el, .sp-palette .sp-thumb-el:hover{ .sp-palette .sp-thumb-el, .sp-palette .sp-thumb-el:hover{
border: 1px solid rgba(0, 0, 0, 0.8); border: 1px solid rgba(0, 0, 0, 0.8);
} }
.#{$app-prefix}hidden{ display: none; }
Loading…
Cancel
Save