Skip to content

Commit

Permalink
Merge pull request #1 from teespring/platform#162432786-fix_insert_im…
Browse files Browse the repository at this point in the history
…ages

Fix bug in which we could not insert images or links using the editor
  • Loading branch information
JavierGelatti authored Dec 11, 2018
2 parents 3a2ecde + 1305a63 commit bb68dfc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions vendor/assets/javascripts/bootstrap-wysihtml5/core-b3.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"<h3 class='modal-title'>" + locale.link.insert + "</h3>" +
"</div>" +
"<div class='modal-body'>" +
"<input value='http://' class='bootstrap-wysihtml5-insert-link-url form-control'>" +
"<input placeholder='http://' class='bootstrap-wysihtml5-insert-link-url form-control'>" +
"<label class='checkbox'> <input type='checkbox' class='bootstrap-wysihtml5-insert-link-target' checked>" + locale.link.target + "</label>" +
"</div>" +
"<div class='modal-footer'>" +
Expand All @@ -81,7 +81,7 @@
"<h3 class='modal-title'>" + locale.image.insert + "</h3>" +
"</div>" +
"<div class='modal-body'>" +
"<input value='http://' class='bootstrap-wysihtml5-insert-image-url form-control'>" +
"<input placeholder='http://link-to-your-image.png' class='bootstrap-wysihtml5-insert-image-url form-control'>" +
"</div>" +
"<div class='modal-footer'>" +
"<a href='#' class='btn btn-default' data-dismiss='modal'>" + locale.image.cancel + "</a>" +
Expand Down Expand Up @@ -278,7 +278,7 @@
var activeButton = $(this).hasClass("wysihtml5-command-active");

if (!activeButton) {
self.editor.currentView.element.focus(false);
self.editor.currentView.element.focus({});
caretBookmark = self.editor.composer.selection.getBookmark();
insertImageModal.appendTo('body').modal('show');
insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
Expand Down Expand Up @@ -340,7 +340,7 @@
var activeButton = $(this).hasClass("wysihtml5-command-active");

if (!activeButton) {
self.editor.currentView.element.focus(false);
self.editor.currentView.element.focus({});
caretBookmark = self.editor.composer.selection.getBookmark();
insertLinkModal.appendTo('body').modal('show');
insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
Expand Down Expand Up @@ -496,7 +496,7 @@
target: "Open link in new window"
},
image: {
insert: "Insert image",
insert: "Insert image URL",
cancel: "Cancel"
},
html: {
Expand Down
8 changes: 4 additions & 4 deletions vendor/assets/javascripts/bootstrap-wysihtml5/core.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"<h3>" + locale.link.insert + "</h3>" +
"</div>" +
"<div class='modal-body'>" +
"<input value='http://' class='bootstrap-wysihtml5-insert-link-url input-xlarge'>" +
"<input placeholder='http://' class='bootstrap-wysihtml5-insert-link-url input-xlarge'>" +
"<label class='checkbox'> <input type='checkbox' class='bootstrap-wysihtml5-insert-link-target' checked>" + locale.link.target + "</label>" +
"</div>" +
"<div class='modal-footer'>" +
Expand All @@ -75,7 +75,7 @@
"<h3>" + locale.image.insert + "</h3>" +
"</div>" +
"<div class='modal-body'>" +
"<input value='http://' class='bootstrap-wysihtml5-insert-image-url input-xlarge'>" +
"<input placeholder='http://link-to-your-image.png' class='bootstrap-wysihtml5-insert-image-url input-xlarge'>" +
"</div>" +
"<div class='modal-footer'>" +
"<a href='#' class='btn' data-dismiss='modal'>" + locale.image.cancel + "</a>" +
Expand Down Expand Up @@ -270,7 +270,7 @@
var activeButton = $(this).hasClass("wysihtml5-command-active");

if (!activeButton) {
self.editor.currentView.element.focus(false);
self.editor.currentView.element.focus({});
caretBookmark = self.editor.composer.selection.getBookmark();
insertImageModal.appendTo('body').modal('show');
insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
Expand Down Expand Up @@ -332,7 +332,7 @@
var activeButton = $(this).hasClass("wysihtml5-command-active");

if (!activeButton) {
self.editor.currentView.element.focus(false);
self.editor.currentView.element.focus({});
caretBookmark = self.editor.composer.selection.getBookmark();
insertLinkModal.appendTo('body').modal('show');
insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
Expand Down
4 changes: 2 additions & 2 deletions vendor/assets/javascripts/bootstrap-wysihtml5/wysihtml5.js
Original file line number Diff line number Diff line change
Expand Up @@ -9136,7 +9136,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend(
});

dialog.observe("cancel", function() {
that.editor.focus(false);
that.editor.focus({});
that.editor.fire("cancel:dialog", { command: command, dialogContainer: dialogElement, commandLink: link });
});
}
Expand Down Expand Up @@ -9166,7 +9166,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend(

_execCommand: function(command, commandValue) {
// Make sure that composer is focussed (false => don't move caret to the end)
this.editor.focus(false);
this.editor.focus({});

this.composer.commands.exec(command, commandValue);
this._updateLinkStates();
Expand Down

0 comments on commit bb68dfc

Please sign in to comment.