Commit 91311eb6 authored by Deciphered's avatar Deciphered Committed by joseph.olstad

Issue #2355961 by Deciphered, joseph.olstad: Use selected editor text as media file link text

parent a10ef32f
......@@ -13,6 +13,11 @@ Drupal.media = Drupal.media || {};
*/
Drupal.wysiwyg.plugins.media = {
/**
* The selected text string.
*/
selectedText: null,
/**
* Determine whether a DOM element belongs to this plugin.
*
......@@ -51,6 +56,9 @@ Drupal.wysiwyg.plugins.media = {
insert.onSelect([media_file]);
}
else {
// Store currently selected text.
this.selectedText = data.content;
// Insert new media.
insert.prompt(settings.global);
}
......@@ -118,7 +126,8 @@ InsertMedia.prototype = {
fid: this.mediaFile.fid,
view_mode: formatted_media.type,
attributes: this.mediaFile.attributes,
fields: formatted_media.options
fields: formatted_media.options,
link_text: Drupal.wysiwyg.plugins.media.selectedText
});
// Get the markup and register it for the macro / placeholder handling.
var markup = Drupal.media.filter.getWysiwygHTML(element);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment