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

Initialize link dropdown description #894

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/formats/bbcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
getEditorCommand('link')._dropDown(
editor,
caller,
selected,
function (url, text) {
editor.insertText(
'[url=' + url + ']' +
Expand Down
1 change: 1 addition & 0 deletions src/formats/xhtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
getEditorCommand('link')._dropDown(
editor,
caller,
selected,
function (url, text) {
editor.insertText(
'<a href="' + url + '">' +
Expand Down
5 changes: 3 additions & 2 deletions src/lib/defaultCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,14 @@ var defaultCmds = {

// START_COMMAND: Link
link: {
_dropDown: function (editor, caller, cb) {
_dropDown: function (editor, caller, selected, cb) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes an error in WYSIWYG mode as the call to _dropDown in exec: hasn't been updated to pass the selected parameter so cb is is being treated as selected and there is no cb passed.

var content = dom.createElement('div');

dom.appendChild(content, _tmpl('link', {
url: editor._('URL:'),
desc: editor._('Description (optional):'),
ins: editor._('Insert')
ins: editor._('Insert'),
content: selected
}, true));

var linkInput = dom.find(content, '#link')[0];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _templates = {
'<div><label for="link">{url}</label> ' +
'<input type="text" id="link" dir="ltr" placeholder="https://" /></div>' +
'<div><label for="des">{desc}</label> ' +
'<input type="text" id="des" /></div>' +
'<input type="text" id="des" value="{content}"/></div>' +
'<div><input type="button" class="button" value="{ins}" /></div>',

youtubeMenu:
Expand Down