Skip to content

Commit

Permalink
5.13.0 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishi Jain committed Jan 18, 2016
1 parent b5c5f85 commit f7c522a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
5.13.0 / 2016-01-18
==================
* Added stickyTopOffset option to keep on the screen a sticky toolbar
* Fixed misplacement of buttons when selection is near to the right edge
* Updated dev dependencies
* Added reference to README for who is using medium-editor

5.12.0 / 2015-12-15
==================
* Fix issue with image-only selections
Expand Down
1 change: 0 additions & 1 deletion dist/css/themes/beagle.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
.medium-editor-toolbar-form a {
color: #ccc;
-webkit-transform: translateY(2px);
-ms-transform: translateY(2px);
transform: translateY(2px); }
.medium-editor-toolbar-form .medium-editor-toolbar-close {
margin-right: 16px; }
Expand Down
2 changes: 1 addition & 1 deletion dist/css/themes/beagle.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions dist/js/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3741,12 +3741,16 @@ MediumEditor.extensions = {};
defaultLeft = diffLeft - halfOffsetWidth;

this.anchorPreview.style.top = Math.round(buttonHeight + boundary.bottom - diffTop + this.window.pageYOffset - this.anchorPreview.offsetHeight) + 'px';
this.anchorPreview.style.right = 'initial';
if (middleBoundary < halfOffsetWidth) {
this.anchorPreview.style.left = defaultLeft + halfOffsetWidth + 'px';
this.anchorPreview.style.right = 'initial';
} else if ((this.window.innerWidth - middleBoundary) < halfOffsetWidth) {
this.anchorPreview.style.left = this.window.innerWidth + defaultLeft - halfOffsetWidth + 'px';
this.anchorPreview.style.left = 'auto';
this.anchorPreview.style.right = 0;
} else {
this.anchorPreview.style.left = defaultLeft + middleBoundary + 'px';
this.anchorPreview.style.right = 'initial';
}
},

Expand Down Expand Up @@ -5111,6 +5115,11 @@ MediumEditor.extensions = {};
*/
sticky: false,

/* stickyTopOffset: [Number]
* Value in pixel of the top offset above the toolbar
*/
stickyTopOffset: 0,

/* updateOnEmptySelection: [boolean]
* When the __static__ option is true, this enables/disables updating
* the state of the toolbar buttons even when the selection is collapsed
Expand Down Expand Up @@ -5603,15 +5612,13 @@ MediumEditor.extensions = {};

if (this.sticky) {
// If it's beyond the height of the editor, position it at the bottom of the editor
if (scrollTop > (containerTop + container.offsetHeight - toolbarHeight)) {
if (scrollTop > (containerTop + container.offsetHeight - toolbarHeight - this.stickyTopOffset)) {
toolbarElement.style.top = (containerTop + container.offsetHeight - toolbarHeight) + 'px';
toolbarElement.classList.remove('medium-editor-sticky-toolbar');

// Stick the toolbar to the top of the window
} else if (scrollTop > (containerTop - toolbarHeight)) {
} else if (scrollTop > (containerTop - toolbarHeight - this.stickyTopOffset)) {
toolbarElement.classList.add('medium-editor-sticky-toolbar');
toolbarElement.style.top = '0px';

toolbarElement.style.top = this.stickyTopOffset + 'px';
// Normal static toolbar position
} else {
toolbarElement.classList.remove('medium-editor-sticky-toolbar');
Expand Down Expand Up @@ -5647,6 +5654,7 @@ MediumEditor.extensions = {};
positionToolbar: function (selection) {
// position the toolbar at left 0, so we can get the real width of the toolbar
this.getToolbarElement().style.left = '0';
this.getToolbarElement().style.right = 'initial';

var range = selection.getRangeAt(0),
boundary = range.getBoundingClientRect();
Expand Down Expand Up @@ -5682,10 +5690,13 @@ MediumEditor.extensions = {};

if (middleBoundary < halfOffsetWidth) {
toolbarElement.style.left = defaultLeft + halfOffsetWidth + 'px';
toolbarElement.style.right = 'initial';
} else if ((windowWidth - middleBoundary) < halfOffsetWidth) {
toolbarElement.style.left = windowWidth + defaultLeft - halfOffsetWidth + 'px';
toolbarElement.style.left = 'auto';
toolbarElement.style.right = 0;
} else {
toolbarElement.style.left = defaultLeft + middleBoundary + 'px';
toolbarElement.style.right = 'initial';
}
}
});
Expand Down Expand Up @@ -6880,7 +6891,7 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.12.0'
'version': '5.13.0'
}).version);

return MediumEditor;
Expand Down
4 changes: 2 additions & 2 deletions dist/js/medium-editor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medium-editor",
"version": "5.12.0",
"version": "5.13.0",
"author": "Davi Ferreira <hi@daviferreira.com>",
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.12.0'
'version': '5.13.0'
}).version);

0 comments on commit f7c522a

Please sign in to comment.