Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

Why isn't TinyMCE media plug-in saving my Alternate Source Url selection?

I am using TinyMCE's Media plugin and unable to get an alternate media source (using the Advanced > 'Alternative source URL' field) to appear in the embedded video code. When I select a 'Source' or 'Media poster (Image URL)' file, these items appear in the embed code as expected. However, the alt source file does not. Additionally, when I close and reopen the Insert Media dialog, my alt media source selection is gone.

I've tried using this template from the TinyMce media plugin docs, but with the same result:

video_template_callback: function(data) {
     return '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">
' + '<source src="' + data.source + '"' + (data.sourcemime ? ' type="' + data.sourcemime + '"' : '') + ' />
' + (data.altsource ? '<source src="' + data.altsource + '"' + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />
' : '') + '</video>';
}

The only solution I found was to use a modified template that always includes a second <source> tag, even if there is no alt source specified. With this second source tag present, any altsource values are added to the tag when I add an alt source through the dialog:

return '<video width="' + data.width + '" height="' + data.height + '"' +
            (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">
' +
            '<source src="' + data.source + '"' + (data.sourcemime ? ' type="' + data.sourcemime + '"' : '') + ' />
' +
            '<source ' + (data.altsource ? 'src="' + data.altsource + '"' : '') + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />
' +
            '</video>';
    }

This seems like a possible TinyMCE bug. However, in testing their site demo, I could not get the odd behavior to reproduce.

Has anyone else run into this issue?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.5k users

...