Skip to content

Commit

Permalink
Merge pull request #2702 from mamhoff/tinymce-strip-links
Browse files Browse the repository at this point in the history
TinyMCE: Trim spaces from pasted links
  • Loading branch information
tvdeyen authored Jan 22, 2024
2 parents 1d81e7f + 59347d8 commit 03641d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog

# Sets the link either in TinyMCE or on an Ingredient.
setLink: (url, title, target) ->
trimmedUrl = url.trim()
if @link_object.editor
@setTinyMCELink(url, title, target)
@setTinyMCELink(trimmedUrl, title, target)
else
@link_object.setLink(url, title, target, @link_type)
@link_object.setLink(trimmedUrl, title, target, @link_type)
return

# Sets a link in TinyMCE editor.
Expand Down

0 comments on commit 03641d4

Please sign in to comment.