Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 29f893a

Browse files
committed
Add a rotate animation on button
When you click to show the addons button, the main button will rotate (like on medium.com) and the addons list will show up in fade mode (like on medium.com)
1 parent e8985f6 commit 29f893a

File tree

8 files changed

+76
-7
lines changed

8 files changed

+76
-7
lines changed

dist/css/medium-editor-insert-plugin.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,21 @@
117117
font-size: 25px;
118118
line-height: 28px;
119119
text-align: center;
120-
text-decoration: none; }
120+
text-decoration: none;
121+
background: #fff;
122+
-webkit-transform: rotate(0);
123+
-ms-transform: rotate(0);
124+
transform: rotate(0);
125+
-webkit-transition: -webkit-transform 100ms;
126+
transition: -webkit-transform 100ms;
127+
transition: transform 100ms; }
128+
.medium-editor-insert-plugin .medium-insert-buttons .medium-insert-buttons-show.medium-insert-buttons-rotate {
129+
-webkit-transition: -webkit-transform 250ms;
130+
transition: -webkit-transform 250ms;
131+
transition: transform 250ms;
132+
-webkit-transform: rotate(45deg);
133+
-ms-transform: rotate(45deg);
134+
transform: rotate(45deg); }
121135
.medium-editor-insert-plugin .medium-insert-buttons .medium-insert-buttons-addons {
122136
margin: 0;
123137
padding: 0;

dist/css/medium-editor-insert-plugin.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/medium-editor-insert-plugin.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,23 @@ this["MediumInsert"]["Templates"]["src/js/templates/core-buttons.hbs"] = Handleb
2424
return buffer + " </ul>\n</div>\n";
2525
},"useData":true});
2626

27+
28+
2729
this["MediumInsert"]["Templates"]["src/js/templates/core-caption.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2830
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2931
return "<figcaption contenteditable=\"true\" class=\"medium-insert-caption-placeholder\" data-placeholder=\""
3032
+ escapeExpression(((helper = (helper = helpers.placeholder || (depth0 != null ? depth0.placeholder : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"placeholder","hash":{},"data":data}) : helper)))
3133
+ "\"></figcaption>";
3234
},"useData":true});
3335

36+
37+
3438
this["MediumInsert"]["Templates"]["src/js/templates/core-empty-line.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
3539
return "<p><br></p>\n";
3640
},"useData":true});
3741

42+
43+
3844
this["MediumInsert"]["Templates"]["src/js/templates/embeds-toolbar.hbs"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
3945
var stack1, buffer = " <div class=\"medium-insert-embeds-toolbar medium-editor-toolbar medium-toolbar-arrow-under medium-editor-toolbar-active\">\n <ul class=\"medium-editor-toolbar-actions clearfix\">\n";
4046
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.styles : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
@@ -67,17 +73,23 @@ this["MediumInsert"]["Templates"]["src/js/templates/embeds-toolbar.hbs"] = Handl
6773
return buffer;
6874
},"useData":true});
6975

76+
77+
7078
this["MediumInsert"]["Templates"]["src/js/templates/embeds-wrapper.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
7179
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "<div class=\"medium-insert-embeds\" contenteditable=\"false\">\n <figure>\n <div class=\"medium-insert-embed\">\n ";
7280
stack1 = ((helper = (helper = helpers.html || (depth0 != null ? depth0.html : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"html","hash":{},"data":data}) : helper));
7381
if (stack1 != null) { buffer += stack1; }
7482
return buffer + "\n </div>\n </figure>\n <div class=\"medium-insert-embeds-overlay\"></div>\n</div>";
7583
},"useData":true});
7684

85+
86+
7787
this["MediumInsert"]["Templates"]["src/js/templates/images-fileupload.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
7888
return "<input type=\"file\" multiple>";
7989
},"useData":true});
8090

91+
92+
8193
this["MediumInsert"]["Templates"]["src/js/templates/images-image.hbs"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
8294
return " <div class=\"medium-insert-images-progress\"></div>\n";
8395
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
@@ -89,10 +101,14 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-image.hbs"] = Handleb
89101
return buffer + "</figure>";
90102
},"useData":true});
91103

104+
105+
92106
this["MediumInsert"]["Templates"]["src/js/templates/images-progressbar.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
93107
return "<progress min=\"0\" max=\"100\" value=\"0\">0</progress>";
94108
},"useData":true});
95109

110+
111+
96112
this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
97113
var stack1, buffer = "";
98114
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.label : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
@@ -603,6 +619,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
603619

604620
$el.find('.medium-insert-buttons').hide();
605621
$el.find('.medium-insert-buttons-addons').hide();
622+
$el.find('.medium-insert-buttons-show').removeClass('medium-insert-buttons-rotate');
606623
};
607624

608625
/**
@@ -646,7 +663,8 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
646663
*/
647664

648665
Core.prototype.toggleAddons = function () {
649-
this.$el.find('.medium-insert-buttons-addons').toggle();
666+
this.$el.find('.medium-insert-buttons-addons').fadeToggle();
667+
this.$el.find('.medium-insert-buttons-show').toggleClass('medium-insert-buttons-rotate');
650668
};
651669

652670
/**
@@ -657,6 +675,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
657675

658676
Core.prototype.hideAddons = function () {
659677
this.$el.find('.medium-insert-buttons-addons').hide();
678+
this.$el.find('.medium-insert-buttons-show').removeClass('medium-insert-buttons-rotate');
660679
};
661680

662681
/**

dist/js/medium-editor-insert-plugin.min.js

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

src/js/core.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@
470470

471471
$el.find('.medium-insert-buttons').hide();
472472
$el.find('.medium-insert-buttons-addons').hide();
473+
$el.find('.medium-insert-buttons-show').removeClass('medium-insert-buttons-rotate');
473474
};
474475

475476
/**
@@ -513,7 +514,8 @@
513514
*/
514515

515516
Core.prototype.toggleAddons = function () {
516-
this.$el.find('.medium-insert-buttons-addons').toggle();
517+
this.$el.find('.medium-insert-buttons-addons').fadeToggle();
518+
this.$el.find('.medium-insert-buttons-show').toggleClass('medium-insert-buttons-rotate');
517519
};
518520

519521
/**
@@ -524,6 +526,7 @@
524526

525527
Core.prototype.hideAddons = function () {
526528
this.$el.find('.medium-insert-buttons-addons').hide();
529+
this.$el.find('.medium-insert-buttons-show').removeClass('medium-insert-buttons-rotate');
527530
};
528531

529532
/**

0 commit comments

Comments
 (0)