Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in which we could not insert images or links using the editor #1

Merged
merged 3 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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