Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Update version to 5.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmedina committed Mar 24, 2016
1 parent dc7394c commit 9daa1b1
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This gem integrates [Medium Editor](https://github.com/yabwe/medium-editor) with

## Version

The latest version of Medium Editor bundled by this gem is [5.14.4](https://github.com/yabwe/medium-editor/releases)
The latest version of Medium Editor bundled by this gem is [5.15.0](https://github.com/yabwe/medium-editor/releases)

## Installation

Expand Down
4 changes: 2 additions & 2 deletions lib/medium-editor-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module MediumEditorRails
module Rails
VERSION = '2.1.0'
MEDIUM_EDITOR_VERSION = '5.14.4'
VERSION = '2.2.0'
MEDIUM_EDITOR_VERSION = '5.15.0'
end
end
6 changes: 3 additions & 3 deletions medium-editor-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require 'medium-editor-rails/version'
Gem::Specification.new do |gem|
gem.name = 'medium-editor-rails'
gem.version = MediumEditorRails::Rails::VERSION
gem.authors = ['Ahmet Sezgin Duran']
gem.email = ['[email protected]']
gem.summary = %q{Medium Editor integrated in Rails asset pipeline}
gem.authors = ['Ahmet Sezgin Duran', 'Gabriel Medina']
gem.email = ['[email protected]', '[email protected]']
gem.summary = %q{Metdium Editor integrated in Rails asset pipeline}
gem.description = gem.summary
gem.homepage = 'https://github.com/marjinal1st/medium-editor-rails'
gem.license = 'MIT'
Expand Down
64 changes: 57 additions & 7 deletions vendor/assets/javascripts/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,20 @@ MediumEditor.extensions = {};
return range;
},

/**
* Clear the current highlighted selection and set the caret to the start or the end of that prior selection, defaults to end.
*
* @param {DomDocument} doc Current document
* @param {boolean} moveCursorToStart A boolean representing whether or not to set the caret to the beginning of the prior selection.
*/
clearSelection: function (doc, moveCursorToStart) {
if (moveCursorToStart) {
doc.getSelection().collapseToStart();
} else {
doc.getSelection().collapseToEnd();
}
},

/**
* Move cursor to the given node with the given offset.
*
Expand Down Expand Up @@ -3409,6 +3423,11 @@ MediumEditor.extensions = {};
formSaveLabel: '✓',
formCloseLabel: '×',

/* activeClass: [string]
* set class which added to shown form
*/
activeClass: 'medium-editor-toolbar-form-active',

/* hasForm: [boolean]
*
* Setting this to true will cause getForm() to be called
Expand All @@ -3431,14 +3450,34 @@ MediumEditor.extensions = {};
* This function should return true/false reflecting
* whether the form is currently displayed
*/
isDisplayed: function () {},
isDisplayed: function () {
if (this.hasForm) {
return this.getForm().classList.contains(this.activeClass);
}
return false;
},

/* hideForm: [function ()]
*
* This function should show the form element inside
* the toolbar container
*/
showForm: function () {
if (this.hasForm) {
this.getForm().classList.add(this.activeClass);
}
},

/* hideForm: [function ()]
*
* This function should hide the form element inside
* the toolbar container
*/
hideForm: function () {},
hideForm: function () {
if (this.hasForm) {
this.getForm().classList.remove(this.activeClass);
}
},

/************************ Helpers ************************
* The following are helpers that are either set by MediumEditor
Expand Down Expand Up @@ -3627,11 +3666,11 @@ MediumEditor.extensions = {};

// Used by medium-editor when the default toolbar is to be displayed
isDisplayed: function () {
return this.getForm().style.display === 'block';
return MediumEditor.extensions.form.prototype.isDisplayed.apply(this);
},

hideForm: function () {
this.getForm().style.display = 'none';
MediumEditor.extensions.form.prototype.hideForm.apply(this);
this.getInput().value = '';
},

Expand All @@ -3651,7 +3690,7 @@ MediumEditor.extensions = {};

this.base.saveSelection();
this.hideToolbarDefaultActions();
this.getForm().style.display = 'block';
MediumEditor.extensions.form.prototype.showForm.apply(this);
this.setToolbarPosition();

input.value = opts.url;
Expand Down Expand Up @@ -4125,9 +4164,20 @@ MediumEditor.extensions = {};
this.document.execCommand('AutoUrlDetect', false, false);
},

isLastInstance: function () {
var activeInstances = 0;
for (var i = 0; i < this.window._mediumEditors.length; i++) {
var editor = this.window._mediumEditors[i];
if (editor !== null && editor.getExtensionByName('autoLink') !== undefined) {
activeInstances++;
}
}
return activeInstances === 1;
},

destroy: function () {
// Turn AutoUrlDetect back on
if (this.document.queryCommandSupported('AutoUrlDetect')) {
if (this.document.queryCommandSupported('AutoUrlDetect') && this.isLastInstance()) {
this.document.execCommand('AutoUrlDetect', false, true);
}
},
Expand Down Expand Up @@ -7104,7 +7154,7 @@ MediumEditor.parseVersionString = function (release) {

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

return MediumEditor;
Expand Down
3 changes: 3 additions & 0 deletions vendor/assets/stylesheets/medium-editor/medium-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@
margin: 0 10px;
text-decoration: none; }

.medium-editor-toolbar-form-active {
display: block; }

.medium-editor-toolbar-actions:after {
clear: both;
content: "";
Expand Down

0 comments on commit 9daa1b1

Please sign in to comment.